Caché MultiValue PROC Reference
[Home] [Back] [Next]
InterSystems: The power behind what matters   
Class Reference   

Executes a command from the primary output buffer.
The P PROC command processes a command in the primary output buffer (POB). It transfers the command to the command string for execution, then clears the POB.
In Caché and most emulations, the data stack and the secondary output buffer (SOB) use the same storage area. If the command requires an argument value, P takes this value from the secondary output buffer (SOB) and defines it as the data stack. When the PROC is executed (as opposed to linked to) it takes the value from the data stack, then clears the SOB and data stack.
P can take as a suffix the options P (display buffer contents, do not wait before executing), H (execute, hush output), W (display buffer contents then wait for user input before executing), or X (execute, upon completion exit the PROC), thus forming the PP, PH, PW, and PX commands. You can also specify multiple options in any order, such as PXW or PHP.
The PP and PW commands display the contents of the primary output buffer (POB) and secondary output buffer (SOB) before processing the command from the active output buffer. For the purpose of display, they convert @AM delimiter characters to spaces and remove leading blanks.
PP displays the contents of the output buffers, but does not wait or prompt for user input. It proceeds immediately to executing the displayed command.
PW displays the contents of the output buffers, then issues a terminal prompt, requiring the user to specify whether to process the displayed command or quit the PROC. The prompt acts on the first character typed; it does not require an Enter key. The prompt takes the following user-specified values:
In UniVerse and UniData, the data stack and the secondary output buffer (SOB) are separate storage areas. When the command requires an argument value, P takes this value from the secondary output buffer (SOB) and appends it to the existing data stack.
In most emulations, P strips leading blanks from a command prior to execution.
Following P command execution, the active select list is either retained or deleted, depending on the emulation. In Caché and the UniVerse, PICK, Prime, IN2, PIOPEN, and UniData emulations, the active select list is always retained. In jBASE, D3, R83, and REALITY emulations the active select list is discarded following the execution of a MultiValue Basic program.
In jBASE emulation, the PW command requires that you type a prompt letter then press the Enter key. (Just pressing the Enter key is the same as typing "Y" and pressing the Enter key.) Other emulations immediately process the prompt letter when you type it.
In Reality emulation, there is no PW command; the PP command behaves like the Caché MultiValue PW command.
In UniVerse emulation, the PW "N" prompt not only exits the PROC, but issues an abort, returning control to either the ON.ABORT verb or the MV shell command line. In other emulations, a "N" or "X" prompt stops execution but does not abort.
See Also