Sample Code Usage
General considerations
- The user of an exit program must be authorized to the program and the objects it uses.
- If an exit program requires special library list handling to run, it is the user's responsibility to set and reset a job’s library list.
- If any special authorities are required by an exit program it is the user's responsibility to provide those authorities.
The following sample code usage tables are provided below for your convenience:
Check with system operator to see if switch is allowed
The following sample is supplied to show how a program can be used to extend Authority Broker’s authorization processes.
Object Name |
Object Description |
Assign to Exit Point |
---|---|---|
CHECKMSG program |
Sends an inquiry message to system operator requesting authorization to allow switch. |
Before profile switch. |
0 - Allow the switch to occur. The switch is allowed to occur and the next exit program in the sequence will be executed.
1 - Reject the switch. The switch is to be rejected, exit program processing is ended and the attempted switch is stopped.
2 - Allow the switch to occur and bypass further exit program processing. The switch is allowed to occur and no further exit program processing occurs.
Verify user allowed to switch
The following sample is supplied to show how a program can be used to extend Authority Broker’s authorization processes.
Object Name |
Object Description |
Assign to Exit Point |
---|---|---|
CHECKUSER program |
Disallows switch when job is a batch job. Disallows switch if user switching is QSECOFR. If command to run is not QYS/CALL QCMD, it is set to QYS/CALL QCMD. |
Before profile switch. |
Changing Accounting Code
The following samples are supplied to show how a job’s accounting code can be set after a profile switch has occurred and reinstated after the switch is released.
Object Name |
Object Description |
Assign to Exit Point |
---|---|---|
ACCTCDESTR program |
1. Saves job's current accounting code. 2. Sets the job's accounting code to "Payroll Switch." |
After profile switch. |
ACCTCDEEND program |
1. Retrieve initial accounting code saved by ACCTCDESTR. 2. Sets the job's accounting cvode back to its initial value. |
After profile switch. |
Change job’s library list
The following samples are supplied to show how a job’s library list can be altered as part of a profile switch.
Object Name |
Object Description |
Assign to Exit Point |
---|---|---|
CHGLIBLIST program |
Adds library PAYROLL to the user portion of the job's library list. |
After profile switch. |
RPLLIBLIST program |
Removes library PAYROLL to the user portion of the job's library list. |
Before profile switch release. |
List commands run with an “N” in the CD journal entry
The following samples are supplied to show how to use the LEVENTRPT to generate a temporary database file and then report from it.
Object Name |
Object Description |
Assign to Exit Point |
---|---|---|
SAVESTASRT program |
Saves the start date used when running command LEVENTRPT. |
After profile switch. |
NONCLCMDS program |
Submits the job to generate a report listing commands run with an "N" in the CD journal entry. |
After profile switch release. |
GENABRPT program |
1. Runs the LEVENTRPT command. Results are put to an out file in QTEMP. 2. Print the report. |
Not attached to an exit point. |
ABOUTFILE physical file |
Output file for results of LEVENTRPT |
Not attached to an exit point. |
COMMANDLST printer file |
Printer file used to list commands from ABOUTFILE. |
Not attached to an exit point. |
LISTNONCL |
Report commands run with an "N" in the CD journal entry. ABOUTFILE is the data source. |
Not attached to an exit point. |
Collect and list request messages by sequence number
The following sample is supplied to show how request messages can be collected and reported on. Collection is sequenced numerically.
Object Name |
Object Description |
Assign to Exit Point |
---|---|---|
MSGTRACKED physical file |
Request messages collection. |
Not attached to an exit point. |
REPORTCMDS printer file |
Printer file used to list commands from MSGTRACKED. |
Not attached to an exit point. |
SETCMDSTRT program |
1. Writes a Begin collection record. 2. Sends and receives a starting point request message. |
After profile switch. |
SETCMDEND program |
1. Retrieve switch start time from Begin collection record. 2. Collect request messages sent since Begin point. |
Before profile switch release. |
CMDSRUNLST program |
Printer file used to list commands from ABOUTFILE. |
Not attached to an exit point. |
LISTNONCL |
List collected messages. |
After profile switch. |
Collect and list request messages by time run
The following sample is supplied to show how request messages can be collected and reported on. Collection is sequenced by message date and time.
Object Name |
Object Description |
Assign to Exit Point |
---|---|---|
TRACKMSGS physical file |
Request messages collection. |
Not attached to an exit point. |
REPORTCMDS printer file |
Printer file used to list commands from TRACKMSGS. |
Not attached to an exit point. |
SETSTART program |
Write a Begin collection record. |
After profile switch. |
SETEND program |
Retrieve switch start time from Begin collection record. Collect request messages sent since Begin point. Uses message API QMHRCVPM to get date and time message was sent. |
Before profile switch release. |
LISTCMDS |
List collected messages. |
Not attached to an exit point. |