21. 4GL Statement Glossary : Call System
 
Share this page                  
Call System
Calls the operating system from within an application.
Syntax
call system [systemcommand]
systemcommand
Specifies a string expression corresponding to an external system command
Description
The call system statement calls the operating system and executes a single specified systemcommand before returning automatically to the application. Use the call system statement without specifying a command to fork and execute a shell process and place you at the operating system prompt.
VMS: Use the call system statement without specifying a command to spawn a DCL sub process and place you at the operating system prompt.
You can then execute any operating system commands and return to the application by typing the logout command.
The call system statement automatically clears the frame before calling the operating system. When control returns to the application, execution resumes with the statement immediately following call system. The current form is redisplayed at the end of the activation block. The call system command cannot return status information to the application.
When you are at the operating-system level after issuing a call system statement, do not change your default directory. This can cause subsequent call statements to fail.
Note:  While you can use call system to start a second ABF or Vision application, it is more efficient to use the call application statement. See Call for details.
VMS: The VMS inquire command does not execute properly in a command file called with call system. For an alternative, see Using the Call System Statement.
Examples
Call the operating system to execute the command specified in the Cmdname field on the current form:
call system cmdname;
Windows: Call the operating system to edit the file test.txt.
UNIX:
call system 'ed test.txt';
or
filename = test.txt;
call system = 'ed ' + :filename;
VMS:
call system 'edit test.txt';
or
filename = test.txt;
call system = 'edit ' + :filename; 
UNIX:
Call the operating system to execute a shell script:
call system 'sh test.sh'; 
VMS:
Call the operating system to execute a command procedure:
call system '@test.com';