PURPOSE: A Command Module (CM) is created with the DEFINE CM command, control is transferred to the edit level, where the text of the CM is entered. Once CM’s are defined and saved, they may later be modified with the MODIFY CM command, which also transfers control to the edit level. A CM is executed with the command “USE CM name”.
CM’s are user-defined programs that consist of commands and control statements. They are generally used to control all or a significant portion of an application.
DEFINE CM name [IN DBL dbl_name]
name |
is the user-assigned name of the CM being created. |
[IN DBL dbl_name] |
is used to define the CM in a DBL other than the currently in use DBL. |
*LIST CM SALESCHECK
00100 USE DS BOOKS
00110 TYPE "DO YOU WANT TO ADD DATA?--Y OR N? ",NOCR
00120 ACCEPT @STRING
00130 IF @STRING = "Y"
00140 ENTER WITH PROMPTS
00150 SORT ON TITLE_CODE, TYPE_CODE
00160 CONTINUE
00170 TYPE "DO YOU WANT A REPORT?--Y OR N? ",NOCR
00180 ACCEPT @STRING
00190 IF @STRING = "Y"
00200 REPORT VIA BOOKREP
00210 CONTINUE
When the SAVE command is given, ACCENT R performs a symatic and syntax check on the entire CM. If errors are found, ACCENT R displays an appropriate error message and leaves control at the edit level so that the CM can be corrected. If the symatic and syntax are found to be correct, SAVE compiles the CM, saves it in executable form, and returns control to the command level.
The HOLD editing command saves the text of the CM but does no checking. The CM cannot be executed until it is saved with the SAVE command. HOLD also leaves control at the edit level, which can be exited by typing STOP.
SEE ALSO: ENABLE CM TRACE