[ ]

Calls an external Proc subroutine.

Syntax

[file-specifier {item-id}] {label}

Syntax Elements

file-specifier The name of the file containing the Proc to be executed, as defined in Conventions.

The file-name can be the literal file name (not enclosed in quotes) or a direct or indirect reference to a buffer or select register containing it.

The data-section-name can be the literal data section name (not enclosed in quotes) or a direct or indirect reference to a buffer or select register containing it.

item-id The name of the Proc item to be executed.

If item-id is not specified, then the parameter currently pointed to in the active input buffer is used as the item-id.

The item-id can be the literal item-id (not enclosed in quotes) or a direct or indirect reference to a buffer or select register containing the item-id.

label Optionally specifies a label within the called Proc where execution is to commence. Note that a space must precede label in the above syntax. The label in the called Proc is a number at the start of the line containing the command to be executed, and separated from the command by at least one space.

Operation

The [ ] command calls an external Proc subroutine. When a RTN is encountered, control returns to the original Proc. If no more statements remain in the called Proc, then execution terminates at that point.

Note

If a Proc called with the [ ] command does not execute a RTN statement, it will not return to the calling Proc, but will terminate.

The input buffers, output buffers, and file buffers remain unchanged when the [ ] command is executed. All open files remain open. The same information is available to the external Proc subroutine.

External subroutines can call other subroutines, and there is no limit to the number of calls that can be made.

In order to call one Proc from another, the Procs must be of the same type (that is, both PQ or PQN).

Comments

The [ ] command takes longer to process than a ( ) command, so it should only be used when it is necessary to regain control of the original Proc and continue processing.

NEVER execute a Proc via the output buffer. Use the [ ] or the ( ) command instead.

Example

PQN
.
.
[SUBROUTINES SUB1]
RI
IHABC DEF
.
.
.

This example calls Proc subroutine SUB1 in the SUBROUTINES file.