You can modify the example shown here to:
- Obtain space for your output buffer in your work area in dynamic
storage.
- Obtain space for the parameter list in your work area in dynamic
storage.
- Specify subcommands that have this format:
- The subcommand is prefixed by a two-byte length.
- The subcommand is specified as a single input string.
- Use addresses that are pointer fields.
- Reuse the same parameter list for many requests.
- Reuse your 4-byte token area by specifying TOKEN= on all EXECUTE
forms of EDGXCI. Your 4-byte token area is updated on return from
the DFSMSrmm API.
- Make the list form parameter list large enough for all the parameters
you might specify by using PLISTVER=MAX on the execute form of the
EDGXCI macro.
Note: SAMPLIB member EDGAPISR provides a similar example of
using EDGXCI.
Macro continuation characters must be entered in column 72.
YOURPGM CSECT
R0 EQU 0
R1 EQU 1
R3 EQU 3
R4 EQU 4
R9 EQU 9
R11 EQU 11
R12 EQU 12
R13 EQU 13
R15 EQU 15
* ..
USING *,R11
USING WORKDS,R12
LA R13,REGSAVE Point to register save area
* ..
* ..
LA R0,OUTBUFWK Save the
ST R0,APIOUTB@ address of output buffer
*************************************************************
* Load the API module **
*************************************************************
LOAD EP=EDGXAPI
ST R0,APIMOD@ Save API module address
* ..
XC MYTOKEN,MYTOKEN Ensure no token yet
LA R4,LISTV@ List volume subcmd address
BAL R9,BEGINCMD Begin the command
* ..
*************************************************************
* Going to reuse the resources, instead of releasing**
* resources obtained by the API for the 1st BEGIN **
*************************************************************
LA R4,SEARCHD@ Search subcmd address
BAL R9,BEGINCMD Begin the command
* ..
BAL R9,MOREDATA Get more data for search
* ..
BAL R9,RELEASE All done, release resources
* ..
*************************************************************
* Delete the API module **
*************************************************************
DELETE EP=EDGXAPI
* ..
*************************************************************
** Call API to begin a new subcommand **
*************************************************************
BEGINCMD DS 0H
CALL1 EDGXCI MF=(E,MYPL),PLISTVER=MAX, X
APIADDR=APIMOD@,OPERATION=BEGIN, X
TOKEN=MYTOKEN, X
SUBCMDADDR=(R4),OUTBUFADDR=APIOUTB@
BR R9 Return
*************************************************************
** Call API to get more data for current subcommand **
*************************************************************
MOREDATA DS 0H
CALL2 EDGXCI MF=(E,MYPL,NOCHECK),PLISTVER=MAX, X
OPERATION=CONTINUE,TOKEN=MYTOKEN
BR R9 Return
*************************************************************
** Call API to release resource such as storage and **
** loaded modules. **
*************************************************************
RELEASE DS 0H
REL1 EDGXCI MF=(E,MYPL,NOCHECK),PLISTVER=MAX, X
OPERATION=RELEASE,TOKEN=MYTOKEN
BR R9 Return
*************************************************************
** SEARCH DATA SET SUBCOMMAND **
*************************************************************
SEARCHD DS 0C
DC AL2(SEARCHDL)
DC C'SEARCHDATASET ....'
SEARCHDL EQU *-SEARCHD
SEARCHD@ DC A(SEARCHD)
*************************************************************
** LISTVOLUME SUBCOMMAND **
*************************************************************
LISTV DS 0C Listv command buffer
DC AL2(LISTVL) Length of command
DC C'LISTVOLUME ....'
LISTVL EQU *-LISTV Length of command
LISTV@ DC A(LISTV) Address of command
* ..
*************************************************************
** PROGRAM WORK AREA **
*************************************************************
WORKDS DSECT
APIOUTB@ DS A Pointer to output buffer
APIMOD@ DS A Address of the API module
REGSAVE DS 18F Save area
MYTOKEN DS CL4 Token from the API
*************************************************************
** PARAMETER LIST DEFINITION **
*************************************************************
EDGXCI MF=(L,MYPL,0D),PLISTVER=MAX PLIST area
DS 0D
OUTBUFWK DS CL4096 Output buffer area
*************************************************************
** STRUCTURED FIELD DEFINITIONS **
*************************************************************
SFDEFDS DSECT
EDGXSF
END