Programming in assembler

Before the GIMAPI program can be invoked from an assembler program, the load module must be brought into virtual storage using the LOAD macro. It can then be invoked using the CALL macro passing the required parameters. An example of the declares, LOAD, CALL and FREE syntax are shown in Figure 1.
Figure 1. Assembler syntax of GIMAPI invocation
                   LA    2,APIPGM
            LOAD EPLOC=(2),LOADPT=PGMADR

            L     15,PGMADR
            CALL (15),(QUERYCMD,QUERY_PARMS@,CMDOUT,APILANG,RC,CC,MSG@)

            L     15,PGMADR
            CALL (15),(FREECMD,0,CMDOUT,APILANG,RC,CC,MSG@)

   APIPGM   DC     CL8'GIMAPI  '
   QUERYCMD DC     CL8'QUERY   '
   FREECMD  DC     CL8'FREE    '
   APILANG  DC     CL3'ENU'
            DS     0F
   QUERY_PARMS@ DC AL4(QUERY_PARMS)
   PGMADR   DC     AL4(0)
   CMDOUT   DC     AL4(0)
   MSG@     DC     AL4(0)
   RC       DS     F'0'
   CC       DS     F'0'
QUERYCMD
A variable defined as CHAR(8) that contains the string representing the QUERY command GIMAPI is to process.
FREECMD
A variable defined as CHAR(8) that contains the string representing the FREE command GIMAPI is to process.
QUERY_PARMS@
A command parameter structure (QUERY_PARMS) that contains the parameters of the command being processed is declared in the calling program. QUERY_PARMS@ is a pointer variable that contains the address of that structure. The variable is passed to GIMAPI.
CMDOUT
A pointer variable that will be set to the address of the beginning of storage containing the output of the command processing.
APILANGE
3-character national language identifier to use for messages. Valid values are ENU and JPN.
RC
A return code variable declared as a fullword. The value of the variable is set to the return code of GIMAPI call by GIMAPI program.
CC
A condition code variable declared as a fullword. The value of the variable is set to the condition code of GIMAPI call by GIMAPI program.
MSG@
The MSG@ variable is an address variable that is set to the head of a linked list of messages that could be created by GIMAPI processing. The elements to the link list are ITEM_LIST structures.