Domain: PROCEDURE
Command description
The INCLUDE-BLOCK command jumps to the BEGIN-BLOCK command with the specified tag (name). After executing the (next) END-BLOCK or EXIT-BLOCK command, execution returns to the command following the INCLUDE-BLOCK command. (See the section “Thebeginning of a block as a jump destination” (The beginning of a block as a jump destination ) for more on BEGIN blocks.)
The INCLUDE-BLOCK command allows you to comfortably execute a subprocedure defined between the BEGIN-BLOCK and END-BLOCK commands. In this case the following rules must be observed:
/INCLUDE-BLOCK jumps to only one /BEGIN-BLOCK with a tag (name). In order to jump to other commands with a tag, you must use the GOTO command.
The BEGIN block with the subprocedure should be placed after the EXIT-PROCEDURE command, of course. This will avoid the unwanted execution of the subprocedure while the procedure is executing.
The subprocedure runs in the same procedure environment as its parent procedure (i.e. in the same variables context, with the same SYSFILE environment, etc.).
The subprocedure may not be called recursively.
Procedures may be nested although this should be avoided as it will make the procedure complicated and avoid the unwanted execution of BEGIN blocks. The procedure can jump directly to the subprocedures regardless of the level of nesting.
The GOTO command can be used in the subprocedure, but the subprocedure itself should only branch to tags within the subprocedure because otherwise execution will leave the subprocedure.
The tags next to the BEGIN-BLOCK command must be unique within the entire procedure.
The INCLUDE-BLOCK command is rejected in the dialog mode.
Note
Expression replacement (&...) is not permissible for this command.
Format
INCLUDE-BLOCK |
BLOCK = <structured-name 1..255> |
Operands
BLOCK = <structured-name 1..255>
Name of the BEGIN block that is to be executed as a subprocedure.
The name is to be entered without the colon at the end.
Command return codes
(SC2) | SC1 | Maincode | Meaning |
0 | CMD0001 | No error | |
1 | CMD0202 | Syntax error | |
1 | SDP0118 | Command in false context | |
1 | SDP0223 | Incorrect environment | |
3 | CMD2203 | Incorrect syntax file | |
32 | CMD0221 | System error (internal error) |
Example
/ASSIGN-SYSLST TO=PROT.EINGABE,SYSLST-NUMBER=1 /... /IF (EING='*START') / INCLUDE-BLOCK INFO-1 /END-IF &* Execution continues here after the subprocedure INFO-1 is complete /... /IF (EING='*END') / INCLUDE-BLOCK INFO-1 /END-IF &* Execution continues here after the subprocedure INFO-1 is complete /... /... /... /INFO-1: BEGIN-BLOCK &* Beginning of the subprocedure INFO-1 / WRITE-TEXT '&(TIME()): You have entered &(EING)',OUTPUT=*SYSLST(1) /END-BLOCK &*End + jump back to the command line following INCLUDE-BLOCK