Sample Assembler program for CICS
IBM® provides a sample Assembler program for CICS® named DSQABFAC
This sample Assembler program for CICS is in the QMF1210.SDSQSAPn library (where n is a national language identifier).
This sample program for the Assembler callable interface performs the following functions:
- Starts QMF
- Sets three global variables
- Runs a query called Q1
- Prints the resulting report by using form F1
- Ends the QMF session
QMF does not supply query Q1 or form F1, but the sample program uses these objects.
TITLE 'Sample HLASM Query Callable Interface'
***********************************************************************
* *
* Sample Program: DSQABFAC *
* Assembler Version of the QMF Callable Interface for CICS *
* *
***********************************************************************
DSQABFAC DFHEIENT CODEREG=(12),DATAREG=(13),EIBREG=(11)
DSQABFAC AMODE 31
DSQABFAC RMODE ANY
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
ST R4,QMFP1 Address of DSQCOMMA
LA R1,STARTQIL Address of START command length
ST R1,QMFP2
LA R1,STARTQI Address of START command
ST R1,QMFP3
LA R1,1 One Start command parameter
ST R1,NUMPARMS
LA R1,NUMPARMS Address of number of parameters
ST R1,QMFP4
LA R1,STARTKYL Address of keyword lengths
ST R1,QMFP5
LA R1,STARTKY Address of keywords
ST R1,QMFP6
LA R1,STARTVL Address of value lengths
ST R1,QMFP7
LA R1,STARTV Address of values
ST R1,QMFP8
LA R1,DSQ_VARIABLE_CHAR Address of value data type
ST R1,QMFP9
OI QMFP9,X'80' Set end of parameter list
LA R1,QMFPLIST Address of parameter list
CALL DSQCIA
SPACE 1
***********************************************************************
* Set numeric values into query using SET command *
***********************************************************************
SPACE 1
LA R1,20 Set values for SET GLOBAL command
ST R1,VVAL1
LA R1,40
ST R1,VVAL2
LA R1,84
ST R1,VVAL3
LA R1,SETGL Addr of SET GLOBAL command length
ST R1,QMFP2
LA R1,SETG Address of SET GLOBAL command
ST R1,QMFP3
LA R1,3 Three SET GLOBAL variables
ST R1,NUMPARMS
LA R1,NUMPARMS Address of number of parameters
ST R1,QMFP4
LA R1,VNAME1L Address of variable name lengths
ST R1,QMFP5
LA R1,VNAME1 Address of variable names
ST R1,QMFP6
LA R1,VVAL1L Address of value lengths
ST R1,QMFP7
LA R1,VVAL1 Address of values
ST R1,QMFP8
LA R1,DSQ_VARIABLE_FINT Address of value data type
ST R1,QMFP9
OI QMFP9,X'80' Set end of parameter list
LA R1,QMFPLIST Address of parameter list
CALL DSQCIA
SPACE 1
***********************************************************************
* Run a query *
***********************************************************************
LA R1,QUERYL Addr of RUN QUERY command length
ST R1,QMFP2
LA R1,QUERY Address of RUN QUERY command
ST R1,QMFP3
OI QMFP3,X'80' Set end of parameter list
LA R1,QMFPLIST Address of parameter list
CALL DSQCIA
SPACE 1
***********************************************************************
* Print the result of the query *
***********************************************************************
LA R1,REPTL Addr of PRINT Report command lth
ST R1,QMFP2
LA R1,REPT Address of PRINT Report command
ST R1,QMFP3
OI QMFP3,X'80' Set end of parameter list
LA R1,QMFPLIST Address of parameter list
CALL DSQCIA
SPACE 1
***********************************************************************
* End the query interface session *
***********************************************************************
LA R1,ENDQIL Address of EXIT command length
ST R1,QMFP2
LA R1,ENDQI Address of EXIT command
ST R1,QMFP3
OI QMFP3,X'80' Set end of parameter list
LA R1,QMFPLIST Address of parameter list
CALL DSQCIA
SPACE 1
***********************************************************************
* Free Keyboard *
***********************************************************************
EXEC CICS SEND CONTROL FREEKB
SPACE 1
***********************************************************************
* Return *
***********************************************************************
SPACE 1
XR R15,R15 ZERO RETURN CODE
DFHEIRET RCREG=15
***********************************************************************
* 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,QUEUEN=DSQP,QUEUET=TS)'
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
VVAL1L DC AL4(L'VVAL1)
VVAL2L DC AL4(L'VVAL2)
VVAL3L DC AL4(L'VVAL3)
* Callable interface communications definition
DSQCOMMA
* Equates for registers 0-15
R0 EQU 00
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
* Local variables located in CICS working storage
DFHEISTG DSECT
ORG DFHEIUSR
NUMPARMS DS F NUMBER OF KEYWORDS
* QMF SET GLOBAL command values
VVAL1 DS F
VVAL2 DS F
VVAL3 DS F
* QMF Callable interface parameter list
QMFPLIST DS 0D
QMFP1 DS F
QMFP2 DS F
QMFP3 DS F
QMFP4 DS F
QMFP5 DS F
QMFP6 DS F
QMFP7 DS F
QMFP8 DS F
QMFP9 DS F
* Callable interface communications area
CICOMM DS CL(DSQCOMM_LEN)
CSECT
SPACE 1
END DSQABFAC