Building the STACK Parameter Block (STPB)

When the list form of the STACK macro instruction expands, it builds a 5-word STACK parameter block (STPB). The list form of the macro instruction initializes this STPB according to the operands you have coded. This initialized block, which you can later modify with the execute form of the macro instruction, indicates to the I/O service routine the functions you want performed.

By using the list form of the macro instruction to initialize the block, and the execute form to modify it, you can use the same STPB to perform different STACK functions. Keep in mind, however, that if you specify an operand in the execute form of the macro instruction, and that operand has a sublist as a value, the default values of the sublist will be coded into the STPB for any of the sublist values not coded. If you do not want the default values, you must code each of the values you require, each time you change any one of them.

For example, if you coded the list form of the STACK macro instruction as follows:

STACK      STORAGE=(element address,PROCN),MF=L

and then overrode it with the execute form of the macro instruction as follows:

STACK      STORAGE=(new element address),
           MF=(E,list address)

The element code in the STACK parameter block would default to SOURCE, the default value. If the new in-storage list was another PROCN list, you would have to respecify PROCN in the execute form of the macro instruction.

The STACK parameter block is defined by the IKJSTPB DSECT, which is provided in SYS1.MACLIB. Table 1 describes the contents of the STPB.


Table 1. The STACK parameter block
Number of bytes Field name Contents or meaning
1 none Operation code. A flag byte which describes the operation to be performed:
1... ....
One element is to be added to the top of the input stack.
.1.. ....
The top element is to be deleted from the input stack.
..1. ....
The current procedure is to be deleted from the input stack. If the top element is not a PROC element, all elements down to and including the first PROC element encountered are deleted, except the bottom element.
...1 ....
All elements except the bottom one (the first element) are to be deleted.
.... 1...
A barrier element is to be deleted from the input stack.
.... .1..
Determine whether there is a CLIST attention routine to run.
.... ..1.
Determine whether there is a CLIST error routine to run.
.... ...1
Determine the type of the topmost element on the input stack.
1 none Element code. A flag byte describing the element to be added to the input stack:
1... ....
A terminal element.
.1.. ....
An in-storage element.
..1. ....
Input ddname present.
...1 ....
Output ddname present.
.... 1...
The in-storage element is an EXEC command element.
.... .1..
Prompting is allowed from the PROC element.
.... ..0.
The in-storage element is a source element.
.... ..1.
The in-storage element is a procedure element.
.... ...1
The list option (PROCL) has been specified.
1 none A flag byte describing the operation to be performed:
1... ....
A barrier element is to be added to the input stack.
.1.. ....
Create a new I/O environment.
..1. ....
Destroy the current I/O environment or the one requested by the caller.
...1 ....
Reset the input stack of the current environment.
.... xxxx
Reserved.
1 none DATASET operation:
xxxx ....
Reserved.
.... 1...
Use BPAM with member.
.... .1..
Do not remove sequence numbers.
.... ..1.
User-specified CNTL.
.... ...1
Close option.
4 STPBALSD The address of the list source descriptor (LSD). An LSD describes an in-storage list. If the input source is the terminal, or if DELETE has been specified, this field will contain zeros.
4 STPBINDD Pointer to input ddname.
4 STPBODDN Pointer to output ddname.
4 STPBMBRN Pointer to membername.
4 STPBECTA Pointer to the environment control table (ECT) created by the STACK service routine when ENVIRON=CREATE is specified.

If the DATASET or DELETE operands have been coded in the STACK macro instruction, the second word of the stack parameter block, the STPBALSD field, will contain zeroes and the control block structure will end with the STPB. Figure 1 describes this condition.

To add an in-storage list element to the input stack, you must describe the in-storage list and pass a pointer to it to the STACK I/O service routine. You do this by building a list source descriptor (LSD).