How to: |
Available Operating Systems: Windows
Available Languages: reporting
The SYSTEM function calls a DOS program, a batch program, or a Windows application from a procedure. SYSTEM passes a command string to DOS or Windows and the program is executed as if it had been entered at the DOS command line or the command line field in the Windows Program Manager Run dialog box. When you exit the program, control returns to WebFOCUS.
SYSTEM suspends FOCUS execution of subsequent commands until you exit the application. It has an advantage over the FOCUS DOS command, which also enables you to call DOS programs and Windows applications from a procedure.
When executing a command from SYSTEM, the command executes as follows:
SYSTEM(length, 'COMMAND /C string', returncode)
SYSTEM(length, 'string ', returncode)
where:
Integer
Is the length, in characters, of string.
Alphanumeric
Is a valid Windows or DOS command with command line parameters enclosed in single quotation marks.
Double precision
Is the name or length of the variable that contains the value of the DOS error level.
SYSTEM passes the DIR command to the DOS command interpreter to create a sorted directory listing with no heading information or summary, and redirects the output to a file named DIR.LIS:
-SET &RETCODE = SYSTEM(31,'COMMAND /C DIR /O-N /B >DIR.LIS','D4');
SYSTEM changes the default directory and suspends processing until the operation is complete:
-SET &ERRORLEVEL = SYSTEM(15,'CHDIR \CARDATA','D4');
SYSTEM runs the check disk program and redirects the output to a file called CHKDSK.TXT. (Redirecting the output to a file makes it accessible to a program that might want to read it.)
-SET &RETCODE=SYSTEM(19,'CHKDSK > CHKDSK.TXT','D4');