Command to Change Environment?


i have the following Problem. I have written an Programm at my Local Environment which uses USR6004N. Now i’m searching for Commands which i could use to change the Environment like logon to an other library.

My first try was:
unmap; logon locallib; execute myprog; map… ; logon bs2lib

which won’t work. But if it workes this will cause that i have to unmap and map always my BS2000 Connection to change to Local Environment. Is there a way or command which makes it easier?

execute program @ lib @ environment would be great :smiley:


Am I understanding this correctly, “myprog” is the program you wrote and tested locally and now you want to test it remotely ?

No matter how you switch between environments (you can have as many as you like connected at the same time), your local program will always stay there, it won’t automagically change to a “remote” one just by logging on to a remote library.

The only way is to copy the local program to the remote library (which you may probably be able to automate using plugins).

It’s not to Test. It’s a Program that Generates Sourcecode to the Editor Window (As i said - i use USR6004N Userexit to Insert Code at Cursor Position) I would like to put this Program as a Usercommand to the Toolbar.

And the Userexits USR6xx are only available at Local Environment not at Natural for Host.


You can add a “user command” (search help for this topic) and then check this command “Execute command(s) from Local Environment”.
For testing you can use as command: “LOGON SYSEXT;USR6004P”
Then you can add this “user command” by customizing your studio adding a new toolbar item (search help for the topic “Customizing Commands Toolbars Keyboards”).
If a local editor is open, USR6004P will show you the “local” source, if a “remote” editor is open, you will see the “remote” source.

Hi weihnachtsbaer,

thanks for the Hint with the Checkbox. If i try it at an open Local Editor Window the Commands will be executed good. If i try it at an open Remote Editor Window it get the following:

I thried it with “LOGON SYSEXT; MENU” and i get:

 13:45:07             *****  P R E D I C T  4.3.0  *****              2005-07-07
                            - Startup Procedure -                               
  CATASTROPHIC ERROR                                                            
 Error ........ 6972                                                            
 Line number .. 2010                                                            
 Program ...... RESET                                                           
 Level ........ 1                                                               

If i try your Example i get a Window with:

RESET  0380 NAT0917 Fehler 6971 in COPYCODE YRESET.

NAT0917 Error :1: in :2: :3:.



Beware just to call any program.
If you want to read data from your remote maschine you won’t get access to this data just setting this flag.
You need to call the development server, but if you have a look at the plugin documentation (search help for topic “utility protocol”) you can read, that
“… call the development server … the utility protocol is only used internally by Software AG products.”

I tried successfully user command: “LOGON SYSEXT;USR6004P” with NAT611 PL 12.

Now i installed NAT611 PL 13 and don’t get any Error. Problem Solved. Thx @weihnachtsbaer