This variation lends itself to processing in re-entrant code where
subroutines can be created for commonly used code. Here is an example
that shows how the same subroutines can be used to issue and process
multiple subcommand requests with each having its own token and output
buffer area.
******************************************
** Start the first subcommand
******************************************
XC TOKENA,TOKENA No resources/token yet
LA R2,TOKENA Point to 1st token
LA R3,OUTBUF1 Point to 1st buffer
LA R4,SUBCMD1 Point to 1st subcommand
BAS R9,BEGRTN Issue command
...
******************************************
** Start the second subcommand
******************************************
LA R2,TOKENB Point to 2nd token
LA R3,OUTBUF2 Point to 2nd buffer
LA R4,SUBCMD2 Point to 2nd subcommand
BAS R9,BEGRTN Issue command
...
******************************************
** Continue the 2nd subcommand
******************************************
LA R2,TOKENB Point to 2nd token
BAS R9,CONRTN Continue 2nd cmd
...
******************************************
** Continue the 1st subcommand
******************************************
LA R2,TOKENA Point to 1st token
BAS R9,CONRTN Continue 1st cmd
...
******************************************
** Done with the subcommands, release
******************************************
LA R2,TOKENA Point to 1st token
BAS R9,RELTRN Release 1st token
...
LA R2,TOKENB Point to 2nd token
BAS R9,RELTRN Release 2nd token
...
BEGRTN EQU *
EDGXCI MF=(E,BEGINPL),PLISTVER=MAX, X
APIADDR=APIMOD@,OPERATION=BEGIN, X
TOKEN=(R2), X
SUBCMDADDR=(R4),OUTBUFADDR=(R3)
BR R9
...
CONRTN EQU *
******************************************
** Continue the subcommand
******************************************
EDGXCI MF=(E,CONTPL),PLISTVER=MAX, X
APIADDR=APIMOD@,OPERATION=CONTINUE, X
TOKEN=(R2), X
OUTBUFADDR=(R3)
BR R9
...
RELRTN EQU *
******************************************
** Done with the subcommand, release
******************************************
EDGXCI MF=(E,RELPL),PLISTVER=MAX, X
APIADDR=APIMOD@,OPERATION=RELEASE, X
TOKEN=(R2)
BR R9