A single QUERY command can be stored as a named procedure for repeated use without re-entering the command. The commands which can be used in a procedure are listed in Table 2-2 “Procedure Commands”.
You execute a procedure by referencing it with a form of the command used in the procedure. Refer to Table 2-2 “Procedure Commands” for the commands that are used to execute procedures. For example, if a procedure named FINDNAME contains the FIND command, you would execute the procedure by typing:
You store one or more procedures in an MPE file called a Proc-file. Only one Proc-file is "active" at any time. The active Proc-file is called the current Proc-file. When you execute a procedure, QUERY searches the current Proc-file for the specified procedure. Therefore, before executing a procedure, you must specify the current Proc-file with the PROC-ENTITY = command or in response to the prompt issued by the DEFINE command. To access a Proc-file, you must have read and lock access to the group and account in which the Proc-file resides.
Table 2-2 Procedure Commands
USED IN A PROCEDURE | EXECUTES A PROCEDURE |
---|
FIND FIND ALL FIND CHAIN | FIND procedure |
JOIN | JOIN procedure |
MULTIFIND MULTIFIND ALL | MULTIFIND procedure |
REPORT REPORT ALL | REPORT procedure |
SUBSET | SUBSET procedure |
UPDATE ADD [1] UPDATE DELETE [1] UPDATE REPLACE [1] | UPDATE procedure |
| [1] |
A procedure can be created within QUERY or copied from an MPE ASCII file. The QUERY commands that operate on procedures are discussed in Table 2-3 “Commands Used to Define Procedures”.
Table 2-3 Commands Used to Define Procedures
COMMANDS | FUNCTION |
---|
CREATE | Creates a procedure or copies it from an MPE ASCII file
and stores it in the current Proc-file. The CREATE SPACE option shows the number of unused records in the current Proc-file. |
DISPLAY | Lists the names of the procedures in the current Proc-file or lists individual procedures with line numbers for use in editing. |
ALTER | Edits a procedure stored in the current Proc-file. This command is used to insert, replace, and delete lines. |
DESTROY | Deletes a procedure from the current Proc-file. |
RENAME | Changes the name of a procedure in the current Proc-file. |