Calling Authority Broker from a Program
The LSWPPRF command can be called directly from programs.
Consider the following very simple example:
- The user types in the PWRQRY command, and then supplies a User name that they wish to run Queries as.
- The program does a LSWPPRF.
- The program executes the IBM WRKQRY command – resulting in the user running query in a swapped environment.
- When the user exits the WRKQRY screen, an LRLSPRF is performed, and then the program ends.
- The user is returned to their original application.
Sample code for this example (without error checking) is as follows:
Command PWRQRY CMD PROMPT('PowerTech Controlled Query') PARM KWD(QUERYUSER) TYPE(*NAME) LEN(10) MIN(1) + CHOICE('User Name') PROMPT('Query User Name')
Program PWRQRY PGM PARM( &QryUser ) DCL &QryUser *Char 10 LSWPPRF TOUSER( &QryUser ) + REASON( 'Start of PowerTech controlled Query process' ) + CALLTICKET( *NONE ) WRKQRY LRLSPRF TOUSER( &QryUser ) ENDPGM