Comments and Examples
One common use of the EXECUTE statement is copying from within a program. The following example purges records marked for deletion from an operator-chosen file (the file name is entered by the user):
00100 PRINT NEWPAGE 00110 PRINT "Enter FILENAME.EXT to be purged" 00120 LINPUT FILENAME$ 00130 Execute "COPY "&FILENAME$&" TEMP.FYL -DN" 00140 Execute "FREE "&FILENAME$&" -N" 00150 Execute "RENAME TEMP.FYL "&FILENAME$&" -N" 00160 PRINT FILENAME$;" was successfully purged"
Execute statements do not restore the screen after execution. If you wish to restore the screen after an EXECUTE statement, insert an asterisk as the first character of the command string. Line 10 does not restore the screen, but line 20 does.
00010 Execute "DIR" 00020 Execute "*COPY OLDFILE NEWFILE"
- Do not restore screen upon re-entry.
- The asterisk (*) prevents the screen from being restored upon re-entry.
- The "command" is a required parameter in the EXECUTE statement and contains the commands you wish to execute.
- Relevant error conditions include the ERROR, Exit and IOERR conditions. All errors, including syntax errors, are passed back to the EXECUTE statement.
- Along with the CHAIN statement, the LOAD, SAVE, and REPLACE commands cannot be used in an EXECUTE statement because it is illegal to terminate a program with EXECUTE.
- INDEX and SORT may be initiated from within a program with the EXECUTE statement. Business Rules will not perform a CLEAR operation prior to beginning the INDEX or SORT process in this case. As there is not as much memory available, INDEX and SORT may run slowly from an EXECUTE statement, especially in large programs. When there is not enough memory available to complete the INDEX or SORT, Business Rules will generate error code 7607 (for INDEX) or error code 7811 (for SORT).
- EXECUTE may be specified as an immediate statement (without a line number), but Business Rules still considers it to be an active program.
- EXECUTE may be the subject of another EXECUTE statement.
- EXECUTE may be used to initiate express procedures and sub-procedure. See the Procedures chapter for more information.