For BBj-specific information, see SCALL() Function - BBj.
The SCALL() function is used in run mode to execute operating system commands in the PRO/5 environment.
Any valid operation system command. For example, the command "dir" is passed to the operating system command processor for execution:
The variable A is set with a return code that reflects the success or failure of the operation. The operating system manual contains information on the values of return codes.
Branch to be taken if an error occurs during execution.
NOTE: Because SCALL() is system
specific, use caution.
Operating system commands are not written in PRO/5, and so are non-portable. For example, although Microsoft Windows is, in effect, "hosted" by MS-DOS, it is an operating system in its own right, with its own sets of rules. DOS-intrinsic commands (DIR, COPY) are not directly implemented in executable files but are built into the command interpreter.
It is possible to execute any Windows or DOS executable file (.com, .exe, .bat, .pif, and the like) from Visual PRO/5. Windows can automatically determine whether the file in question is a DOS or Windows executable. However, only the .exe extension is supplied by default. To run a .com or .bat file, it is necessary to specify the extension. The directories listed in the PATH environment variable are searched.
System Call Types
PRO/5 and Visual PRO/5 support two types of system calls: synchronous and asynchronous. In synchronous system calls, the interpreter waits until the system command is completed to resume operation. This is the default. In asynchronous system calls, the program commands after the SCALL are executed while the system call is executing. To set a system call to asynchronous, insert an ampersand (&) as the last character in the command line.
The following is an MS-DOS SCALL() command:
1000 VAL=SCALL("copy /basis/prog1 /basis/prog2")
The following is a Windows 95/98 SCALL() command to execute the DIR command via the command interpreter:
1000 A=SCALL("C:\command.com /c dir")
The following is a Windows NT/2000 SCALL() command to execute the DIR command via the command interpreter:
1000 A=SCALL("CMD.EXE /c dir")
The following is a UNIX operating system SCALL() command:
1000 A=SCALL("ls -l")