Some possible uses of the ALLOCATE exits are described below:
- Change the operands that the user specifies on the command
You
can use the initialization exit to change the operands that users
specify on the ALLOCATE command. The initialization exit receives
the address of the command buffer. It can change the operands the
user specifies on the ALLOCATE command by using a new command buffer.
For example, the initialization exit can scan the command buffer
to:
- Look for conflicts with the operands a user specifies and correct
any errors. For example, the user cannot specify both the COPIES
and OLD operands on the ALLOCATE command.
- Prevent users from specifying certain operands or certain values
for operands.
To check the command buffer and change its contents, the
initialization exit can:
- Scan the command buffer and decide, based on your own criteria,
to change the command the user issued
- Obtain storage for a new command buffer
- Build the new command buffer
- Update the key, length, and data fields for the new command buffer
as follows:
- Key
- X'02'
- Length
- the length of the new command buffer
- Data
- the address of the new command buffer
- Set a return code of 0 and return control to the ALLOCATE command processor.
The exit must not change the command buffer it receives.
It must create a new command buffer and return the address of the
new command buffer to ALLOCATE.
For more information about the
command buffer and the new command buffer, see TSO/E standard exit parameter list.
For information about the format of the command buffer, see Command buffer.
You must also write a termination
exit to free the storage the initialization exit obtains for the new
command buffer. When the ALLOCATE command processor invokes
the termination exit, it passes the address of the new command buffer
to the termination exit. If the initialization exit returned a new
command buffer to the ALLOCATE command in the new buffer parameter,
the ALLOCATE command replaces the old command buffer address in the command processor parameter list (CPPL)
with the address of the new command buffer. Therefore, when the termination
exit is invoked, the command buffer parameter will point to the new
command buffer obtained by the initialization exit. For the termination
exit, the new command buffer parameter is not used.
- Provide installation-defined pseudo-operands
If users at your
installation print data sets with the same types of characteristics,
you can define pseudo-operands that are equivalent to two or
more ALLOCATE operands. Providing pseudo-operands makes it easier
for users to issue the ALLOCATE command. Users need not remember
several ALLOCATE operands. They can specify the pseudo- operand.
For
example, you could associate a pseudo-operand named ALTINV with three
ALLOCATE operands. The initialization exit can scan the command buffer.
If the exit finds the pseudo-operand ALTINV, it can:
- Obtain storage for a new command buffer
- Build a new command buffer and replace the pseudo-operand with
the appropriate ALLOCATE operands in the new command buffer
- Update the "Key", "Length", and "Data" fields for
the new command buffer as follows:
- Key
- X'02'
- Length
- the length of the new command buffer
- Data
- the address of the new command buffer
- Set a return code of 0 and return control to the ALLOCATE command processor.
You must also provide a termination exit. The termination
exit must free the storage that the initialization exit obtained for
the new command buffer.
- Monitor how long it takes the ALLOCATE command to complete processing.
You
can use the initialization and termination exits to monitor the approximate
time it takes the ALLOCATE
command processor to complete
processing. When the initialization exit receives control, it can:
- Invoke the TIME macro
- Use the exit-to-exit communication word to return the time to
the ALLOCATE command processor.
The exit updates the "Key", "Length", and "Data" fields
for the exit-to-exit communication word as follows:
- Key
- X'01'
- Length
- the length of the data (time)
- Data
- the data (time)
- Set a return code of 0 and return to the ALLOCATE command processor.
When the termination exit gets control, it receives the
time from the initialization exit in the exit-to-exit communication
word. Before the termination exit returns control to ALLOCATE, it
can invoke the TIME macro. The exit can calculate the time difference
between the time from the initialization exit (in the exit-to-exit
communication word) and the time it receives from issuing the TIME
macro. The result is the approximate time it took the ALLOCATE command
to complete its processing. The termination exit can include the
processing time in a data set. You can then periodically print the
data set and review the time calculations.