P

To execute the command that has been built in the primary output buffer.

Syntax

P{P}{H}{Ln}{X}

Options

P Displays the command and prompts to continue.

H Suppresses (hushes) any terminal output that would be generated by the processed command.

LnSets an execution lock (from 0 through 255), so that anyone else using the same Proc (or a Proc or program that sets the same lock) cannot execute at the same time.

If the lock is already set, the Proc waits until it is released. The lock set by PLn is cleared once the TCL command in the output buffer has been executed.

The H and Ln options can be combined as PHLn.

X Terminates the Proc after the command executes. X cannot be used with any other options.

Operation

The simple command form P passes the contents of the output buffer(s) to TCL for processing.

Caution

The P command should only be used to execute TCL commands. If you attempt to execute another Proc in this way, your Proc will not resume on return and the results might not be what you expect. Similarly, do not use the P command to execute a TCL macro unless you are sure that it does not call another Proc.

Error messages can be generated, if required, to help you identify this situation. On V14.1 emulations, these are enabled by default; they can be enabled or disabled as required with the TRAP.EMBEDDED.PROC environment option.

To execute another Proc from within a Proc, use a Proc transfer command: ( ) or [ ].

When the P command is executed, control is passed to TCL and, upon completion of the command, control returns to the Proc for any further processing. Commands and data in the secondary output buffer are made available to interactive processors.

If a command is in the primary output buffer when a Proc terminates, it is executed. For example, the WHERE command is executed when the following Proc is run:

001 PQN
002 MV #1 "WHERE"

The 'PP' versions (PP, PPH, PPLn, and PPHLn) of the P command are generally used as debugging tools. These operate similarly to the P versions, but the contents of both output buffers are displayed before processing and prompt you with a question mark (?). Valid responses are:

After the P command has been processed, both output buffers are cleared, and the stack is turned off. This is also true if a PP command is followed by an S or N response.

Examples

HLIST INV DESC QTY
P

This example moves the English command (LIST INV DESC QTY) to the output buffer and executes it.

HCOPY INVOICE 132
STON
H(BACKORDER X132<
PP

This example moves the COPY command to the primary output buffer. STON turns the stack on. The next command places the response to the TO: prompt into the secondary input buffer. PP prints the contents of both buffers and prompts for the continuation response.