Assembler programming examples

You can look at the sample source code listings here or you can access them online.

The sample programs for the assembler callable interface perform the following functions:

QMF does not supply query Q1 or form F1, but the sample programs use these objects.

This section also shows how to assemble, link-edit, and run an assembler program using the callable interface. QMF does not ship the REXX EXEC, JCL, or CLIST in these examples, but you can copy them from here, altering them to suit your installation.

Sample Assembler program for CICS/MVS and CICS/VSE

The program DSQABFAC is shipped with QMF for CICS.

Figure 27. DSQABFAC, sample HLASM program for CICS/MVS and CICS/VSE
         TITLE 'Sample HLASM Query Callable Interface'                  00001000
*********************************************************************** 00002000
*                                                                     * 00003000
*  Sample Program:  DSQABFAC                                          * 00004000
*  Assembler Version of the SAA Query Callable Interface              * 00005000
*                                                                     * 00006000
*********************************************************************** 00007000
DSQABFAC DFHEIENT CODEREG=(12),DATAREG=(13),EIBREG=(11)                 00008000
         SPACE 1                                                        00009000
*********************************************************************** 00010000
* Start a query interface session                                     * 00011000
*********************************************************************** 00012000
         LA    R4,CICOMM             ESTABLISH ACCESS TO DSQCOMM        00013000
         USING DSQCOMM,R4                                               00014000
         SPACE 1                                                        00015000
         MVC   DSQ_COMM_LEVEL,DSQ_CURRENT_COMM_LEVEL                    00016000
         ST    R4,QMFP1              Address of DSQCOMMA                00017000
         LA    R1,STARTQIL           Address of START command length    00018000
         ST    R1,QMFP2                                                 00019000
         LA    R1,STARTQI            Address of START command           00020000
         ST    R1,QMFP3                                                 00021000
         LA    R1,1                  One Start command parameter        00022000
         ST    R1,NUMPARMS                                              00023000
         LA    R1,NUMPARMS           Address of number of parameters    00024000
         ST    R1,QMFP4                                                 00025000
         LA    R1,STARTKYL           Address of keyword lengths         00026000
         ST    R1,QMFP5                                                 00027000
         LA    R1,STARTKY            Address of keywords                00028000
         ST    R1,QMFP6                                                 00029000
         LA    R1,STARTVL            Address of value lengths           00030000
         ST    R1,QMFP7                                                 00031000
         LA    R1,STARTV             Address of values                  00032000
         ST    R1,QMFP8                                                 00033000
         LA    R1,DSQ_VARIABLE_CHAR  Address of value data type         00034000
         ST    R1,QMFP9                                                 00035000
         OI    QMFP9,X'80'           Set end of parameter list          00036000
         LA    R1,QMFPLIST           Address of parameter list          00037000
         CALL  DSQCIA                                                   00038000
         SPACE 1                                                        00039000
 
*********************************************************************** 00040000
* Set numeric values into query using SET command                     * 00041000
*********************************************************************** 00042000
         SPACE 1                                                        00043000
         LA    R1,20                 Set values for SET GLOBAL command  00044000
         ST    R1,VVAL1                                                 00045000
         LA    R1,40                                                    00046000
         ST    R1,VVAL2                                                 00047000
         LA    R1,84                                                    00048000
         ST    R1,VVAL3                                                 00049000
         LA    R1,SETGL              Addr of SET GLOBAL command length  00050000
         ST    R1,QMFP2                                                 00051000
         LA    R1,SETG               Address of SET GLOBAL command      00052000
         ST    R1,QMFP3                                                 00053000
         LA    R1,3                  Three SET GLOBAL variables         00054000
         ST    R1,NUMPARMS                                              00055000
         LA    R1,NUMPARMS           Address of number of parameters    00056000
         ST    R1,QMFP4                                                 00057000
         LA    R1,VNAME1L            Address of variable name lengths   00058000
         ST    R1,QMFP5                                                 00059000
         LA    R1,VNAME1             Address of variable names          00060000
         ST    R1,QMFP6                                                 00061000
         LA    R1,VVAL1L             Address of value lengths           00062000
         ST    R1,QMFP7                                                 00063000
         LA    R1,VVAL1              Address of values                  00064000
         ST    R1,QMFP8                                                 00065000
         LA    R1,DSQ_VARIABLE_FINT  Address of value data type         00066000
         ST    R1,QMFP9                                                 00067000
         OI    QMFP9,X'80'           Set end of parameter list          00068000
         LA    R1,QMFPLIST           Address of parameter list          00069000
         CALL  DSQCIA                                                   00070000
         SPACE 1                                                        00071000
*********************************************************************** 00072000
* Run a query                                                         * 00073000
*********************************************************************** 00074000
         LA    R1,QUERYL             Addr of RUN QUERY command length   00075000
         ST    R1,QMFP2                                                 00076000
         LA    R1,QUERY              Address of RUN QUERY command       00077000
         ST    R1,QMFP3                                                 00078000
         OI    QMFP3,X'80'           Set end of parameter list          00079000
         LA    R1,QMFPLIST           Address of parameter list          00080000
         CALL  DSQCIA                                                   00081000
         SPACE 1                                                        00082000
*********************************************************************** 00083000
* Print the result of the query                                       * 00084000
*********************************************************************** 00085000
         LA    R1,REPTL              Addr of PRINT Report command lth   00086000
         ST    R1,QMFP2                                                 00087000
         LA    R1,REPT               Address of PRINT Report command    00088000
         ST    R1,QMFP3                                                 00089000
         OI    QMFP3,X'80'           Set end of parameter list          00090000
         LA    R1,QMFPLIST           Address of parameter list          00091000
         CALL  DSQCIA                                                   00092000
         SPACE 1                                                        00093000
*********************************************************************** 00094000
* End the query interface session                                     * 00095000
*********************************************************************** 00096000
         LA    R1,ENDQIL             Address of EXIT command length     00097000
         ST    R1,QMFP2                                                 00098000
         LA    R1,ENDQI              Address of EXIT command            00099000
         ST    R1,QMFP3                                                 00100000
         OI    QMFP3,X'80'           Set end of parameter list          00101000
         LA    R1,QMFPLIST           Address of parameter list          00102000
         CALL  DSQCIA                                                   00103000
         SPACE 1                                                        00104000
*********************************************************************** 00105000
* Return                                                              * 00106000
*********************************************************************** 00107000
         SPACE 1                                                        00108000
         XR    R15,R15            ZERO RETURN CODE                      00109000
         DFHEIRET RCREG=15                                              00110000
*********************************************************************** 00111000
* Data Areas                                                          * 00112000
*********************************************************************** 00113000
         SPACE 1                                                        00114000
*  Query Interface commands                                             00115000
         SPACE 1                                                        00116000
STARTQI  DC    C'START'              START FUNCTION                     00117000
SETG     DC    C'SET GLOBAL'         SET GLOBAL FUNCTION                00118000
QUERY    DC    C'RUN QUERY Q1'       RUN QUERY                          00119000
REPT     DC    C'PRINT REPORT (FORM=F1)'  PRINT REPORT                  00120000
ENDQI    DC    C'EXIT'               END INTERFACE                      00121000
         SPACE 1                                                        00122000
         DS    0F                                                       00123000
STARTQIL DC    AL4(L'STARTQI)        LENGTH OF START FUNCTION           00124000
SETGL    DC    AL4(L'SETG)           LENGTH OF SET GLOBAL FUNCTION      00125000
QUERYL   DC    AL4(L'QUERY)          LENGTH OF RUN QUERY COMMAND        00126000
REPTL    DC    AL4(L'REPT)           LENGTH OF PRINT REPORT COMMAND     00127000
ENDQIL   DC    AL4(L'ENDQI)          LENGTH OF END INTERFACE COMMAND    00128000
         SPACE 1                                                        00129000
*  START command keyword                                                00130000
         SPACE 1                                                        00131000
STARTKY  DC    C'DSQSMODE'                                              00132000
STARTV   DC    C'INTERACTIVE'                                           00133000
         DS    0F                                                       00134000
STARTKYL DC    AL4(L'STARTKY)                                           00135000
STARTVL  DC    AL4(L'STARTV)                                            00136000
         SPACE 1                                                        00137000
*  SET GLOBAL command variable names                                    00138000
         SPACE 1                                                        00139000
VNAME1   DC    C'MYVAR01'                                               00140000
VNAME2   DC    C'SHORT'                                                 00141000
VNAME3   DC    C'MYVAR03'                                               00142000
         DS    0F                                                       00143000
VNAME1L  DC    AL4(L'VNAME1)                                            00144000
VNAME2L  DC    AL4(L'VNAME2)                                            00145000
VNAME3L  DC    AL4(L'VNAME3)                                            00146000
         SPACE 1                                                        00147000
*  SET GLOBAL command values                                            00148000
         SPACE 1                                                        00149000
VVAL1L   DC    AL4(L'VVAL1)                                             00150000
VVAL2L   DC    AL4(L'VVAL2)                                             00151000
VVAL3L   DC    AL4(L'VVAL3)                                             00152000
* Callable interface communications definition                          00153000
         DSQCOMMA                                                       00154000
 
* Equates for registers 0-15                                            00155000
R0       EQU   00                                                       00156000
R1       EQU   01                                                       00157000
R2       EQU   02                                                       00158000
R3       EQU   03                                                       00159000
R4       EQU   04                                                       00160000
R5       EQU   05                                                       00161000
R6       EQU   06                                                       00162000
R7       EQU   07                                                       00163000
R8       EQU   08                                                       00164000
R9       EQU   09                                                       00165000
R10      EQU   10                                                       00166000
R11      EQU   11                                                       00167000
R12      EQU   12                                                       00168000
R13      EQU   13                                                       00169000
R14      EQU   14                                                       00170000
R15      EQU   15                                                       00171000
* Local variables located in CICS working storage                       00172000
DFHEISTG DSECT                                                          00173000
         ORG   DFHEIUSR                                                 00174000
NUMPARMS DS    F                     NUMBER OF KEYWORDS                 00175000
* QMF SET GLOBAL command values                                         00176000
VVAL1    DS    F                                                        00177000
VVAL2    DS    F                                                        00178000
VVAL3    DS    F                                                        00179000
* QMF Callable interface parameter list                                 00180000
QMFPLIST DS   0D                                                        00181000
QMFP1    DS    F                                                        00182000
QMFP2    DS    F                                                        00183000
QMFP3    DS    F                                                        00184000
QMFP4    DS    F                                                        00185000
QMFP5    DS    F                                                        00186000
QMFP6    DS    F                                                        00187000
QMFP7    DS    F                                                        00188000
QMFP8    DS    F                                                        00189000
QMFP9    DS    F                                                        00190000
* Callable interface communications area                                00191000
CICOMM   DS    CL(DSQCOMM_LEN)                                          00192000
         CSECT                                                          00193000
         SPACE 1                                                        00194000
         END   DSQABFAC                                                 00195000
 

Sample Assembler program for TSO and CMS

For TSO and CMS, QMF ships the following program with the product. It is named DSQABFA.

Figure 28. DSQABFA, sample assembler program for TSO and CMS
DSQABFA  TITLE 'SAMPLE SAA QUERY CALLABLE INTERFACE'
DSQABFA  CSECT
***********************************************************************
*                                                                     *
*  Sample Program:  DSQABFA                                           *
*  Assembler Version of the SAA Query Callable Interface              *
*                                                                     *
***********************************************************************
         SPACE 1
         STM   R14,R12,12(R13)       SAVE ENTRY REGISTERS
         BALR  R12,0                 INITIALIZE BASE REGISTER
         USING *,R12
         LA    R2,SAVEAREA           CHAIN SAVE AREAS
         ST    R2,8(R13)
         ST    R13,SAVEAREA+4
         LR    R13,R2                ESTABLISH SAVE AREA
         SPACE 1
***********************************************************************
* Start a query interface session                                     *
***********************************************************************
         LA    R4,CICOMM             ESTABLISH ACCESS TO DSQCOMM
         USING DSQCOMM,R4
         SPACE 1
         MVC   DSQ_COMM_LEVEL,DSQ_CURRENT_COMM_LEVEL
         LA    R1,1                  1 PARAMETER
         ST    R1,NUMPARMS
         CALL  DSQCIA,                                                 X
               (CICOMM,              QI COMMON AREA                    X
               STARTQIL,             START COMMAND LENGTH              X
               STARTQI,              START COMMAND                     X
               NUMPARMS,             NUMBER OF KEYWORDS                X
               STARTKYL,             KEYWORD LENGTHS                   X
               STARTKY,              KEYWORDS                          X
               STARTVL,              VALUE LENGTHS                     X
               STARTV,               VALUES                            X
               DSQ_VARIABLE_CHAR),VL VALUES ARE CHARACTERS
         SPACE 1
***********************************************************************
* Set numeric values into query using SET command                     *
***********************************************************************
         SPACE 1
         LA    R1,20                 SET VALUES TO BE MODIFIED
         ST    R1,VVAL1
         LA    R1,40
         ST    R1,VVAL2
         LA    R1,84
         ST    R1,VVAL3
         LA    R1,3                  3 PARAMETERS
         ST    R1,NUMPARMS
         SPACE 1
         CALL  DSQCIA,                                                 X
               (CICOMM,                                                X
               SETGL,                SET GLOBAL COMMAND LENGTH         X
               SETG,                 SET GLOBAL COMMAND                X
               NUMPARMS,             NUM OF VARIABLES TO BE SET        X
               VNAME1L,              VARIABLE NAME LENGTHS             X
               VNAME1,               VARIABLE NAMES                    X
               VVAL1L,               VALUE LENGTHS                     X
               VVAL1,                VALUES                            X
               DSQ_VARIABLE_FINT),VL VALUES ARE INTEGERS
         SPACE 1
***********************************************************************
* Run a query                                                         *
***********************************************************************
         SPACE 1
         CALL  DSQCIA,                                                 X
               (CICOMM,                                                X
               QUERYL,               QUERY COMMAND LENGTH              X
               QUERY),VL             TEXT OF QUERY COMMAND
         SPACE 1
***********************************************************************
* Print the result of the query                                       *
***********************************************************************
         SPACE 1
         CALL  DSQCIA,(CICOMM,REPTL,REPT),VL
         SPACE 1
***********************************************************************
* End the query interface session                                     *
***********************************************************************
         SPACE 1
         CALL  DSQCIA,(CICOMM,ENDQIL,ENDQI),VL
         SPACE 1
***********************************************************************
* Return                                                              *
***********************************************************************
         SPACE 1
         SR    R15,R15               SET RETURN CODE
         L     R13,4(R13)
         L     R14,12(R13)           RESTORE CALLER REGISTERS
         LM    R0,R12,20(R13)
         BR    R14
         EJECT
***********************************************************************
* Data Areas                                                          *
***********************************************************************
         SPACE 1
*  Query Interface commands
         SPACE 1
STARTQI  DC    C'START'              START FUNCTION
SETG     DC    C'SET GLOBAL'         SET GLOBAL FUNCTION
QUERY    DC    C'RUN QUERY Q1'       RUN QUERY
REPT     DC    C'PRINT REPORT (FORM=F1)'  PRINT REPORT
ENDQI    DC    C'EXIT'               END INTERFACE
         SPACE 1
         DS    0F
STARTQIL DC    AL4(L'STARTQI)        LENGTH OF START FUNCTION
SETGL    DC    AL4(L'SETG)           LENGTH OF SET GLOBAL FUNCTION
QUERYL   DC    AL4(L'QUERY)          LENGTH OF RUN QUERY COMMAND
REPTL    DC    AL4(L'REPT)           LENGTH OF PRINT REPORT COMMAND
ENDQIL   DC    AL4(L'ENDQI)          LENGTH OF END INTERFACE COMMAND
         SPACE 1
*  START command keyword
         SPACE 1
STARTKY  DC    C'DSQSMODE'
STARTV   DC    C'INTERACTIVE'
         DS    0F
STARTKYL DC    AL4(L'STARTKY)
STARTVL  DC    AL4(L'STARTV)
         SPACE 1
*  SET GLOBAL command variable names
         SPACE 1
VNAME1   DC    C'MYVAR01'
VNAME2   DC    C'SHORT'
VNAME3   DC    C'MYVAR03'
         DS    0F
VNAME1L  DC    AL4(L'VNAME1)
VNAME2L  DC    AL4(L'VNAME2)
VNAME3L  DC    AL4(L'VNAME3)
         SPACE 1
*  SET GLOBAL command values
         SPACE 1
VVAL1    DS    F
VVAL2    DS    F
VVAL3    DS    F
VVAL1L   DC    AL4(L'VVAL1)
VVAL2L   DC    AL4(L'VVAL2)
VVAL3L   DC    AL4(L'VVAL3)
         SPACE 1
NUMPARMS DS    F                     NUMBER OF KEYWORDS
         SPACE 1
*  callable interface communications area
         SPACE 1
CICOMM   DS    CL(DSQCOMM_LEN)
         SPACE 1
SAVEAREA DS    18F
         EJECT
         DSQCOMMA
         SPACE 1
R0       EQU   00                    EQUATES FOR REGISTERS 0-15
R1       EQU   01
R2       EQU   02
R3       EQU   03
R4       EQU   04
R5       EQU   05
R6       EQU   06
R7       EQU   07
R8       EQU   08
R9       EQU   09
R10      EQU   10
R11      EQU   11
R12      EQU   12
R13      EQU   13
R14      EQU   14
R15      EQU   15
         SPACE 1
         END   DSQABFA
[ Previous Page | Next Page | Contents | Index ]