Example 1: Assembler Application Using the CSL Extract/Replace Routine
The following assembler program, called CSLASSEM ASSEMBLE, calls DMSERP, the CSL routine in VMLIB that accesses the extract/replace function. This particular call is extracting the access mode of the first read/only CMS disk.
Assembler Application Using Extract/Replace
* =================================================================== *
* This program issues a call to the EXTRACT/REPLACE CSL routine, *
* DMSERP, to extract the accessmode of the first READ/ONLY CMS disk. *
* =================================================================== *
*
CSLASSEM CSECT , Program identifier
MAINENT DS 0H
USING *,R15
B PROLOG
DC AL1(16)
DC C'CSLASSEM 90.058'
DROP R15
PROLOG STM R14,R12,12(R13) Standard linkage
LR R12,R15
PSTART EQU CSLASSEM
USING PSTART,R12
ST R13,SAVE01+4
LA R14,SAVE01
ST R14,8(,R13)
LR R13,R14
*
* CALL EXTRACT/REPLACE VIA CSL
*
* =================================================================== *
*
* An EXTRN statement is need to identify to the ASSEMBLER that DMSCSL
* is an EXTeRNal reference.
*
EXTRN DMSCSL
*
* The parameters on the call to DMSCSL are described in the DATA
* section of this program.
*
* The call to EXTRACT/REPLACE is issued to determine what the
* access mode (INFONAME) of the first READ/ONLY disk (SARGNAM).
* BUFFER contains the access mode of the first READ/ONLY disk.
*
CALL DMSCSL,(EXTREP,RTNCODE,DOEXTRAT,NUMARGS, *
INFONAME,BUFFER,DATATYP,BUFLEN, *
FLAGS,SRCHTYP,TOKEN, *
SARGNAM,SARGVAL,SVALTYP,SVALLEN,SARGTYP),VL
*
* Display results using the APPLMSG macro
*
* ==================================================================== *
*
APPLMSG APPLID=TCP,HEADER=NO,TEXT='RTNCODE= &&1', *
SUB=(DECA,(RTNCODE,4))
APPLMSG APPLID=TCP,HEADER=NO,TEXT='BUFFER= &&1', *
SUB=(HEXA,(BUFFER,20))
APPLMSG APPLID=TCP,HEADER=NO,TEXT='BUFFER= &&1', *
SUB=(CHARA,(BUFFER,8))
APPLMSG APPLID=TCP,HEADER=NO,TEXT='DATATYP = &&1', *
SUB=(DECA,(DATATYP,4))
APPLMSG APPLID=TCP,HEADER=NO,TEXT='BUFLEN = &&1', *
SUB=(DECA,(BUFLEN,4))
*RETURN CODE(RC);
L R15,RC
L R13,4(,R13)
L R14,12(,R13)
LM R00,R12,20(R13)
BR R14
*END SAMPERXP
* =================================================================== *
* ============ DATA Section ============== *
* =================================================================== *
*
DATA DS 0H
DS 0F
SAVE01 DS 18F Save area used for linkage
DS 0F
WORDONE DC F'1' Define a value of one
DS 0D
EXTREP DC CL8'DMSERP ' The CSL routine to be invoked
RTNCODE DC F'99' Setup bad return code
* when function is complete it
* should be zero (0).
DOEXTRAT DC CL8'EXTRACT ' Identify function - EXTRACT
NUMARGS DC F'1' Number of arguments in call
* There is only one in
* this case
*
* Infoname identifies the information that is to be extracted.
INFONAME DC CL20'ACCESS_MODE '
*
* Buffer contains the value of the extracted data.
*
BUFFER DC CL1'0'
*
* Data type identifies the type of data being extracted.
* The value of DATATYP changes after the call to DMSCSL.
* 32 -character string
* 4 -numeric
* 9 -indicator
* 13 -address
*
DATATYP DC F'0'
*
* Buflen contains the length of the buffer on input to the CSL call.
* On output the BUFLEN contains the actual length of the data being
* extracted.
BUFLEN DC F'4'
*
* FLAGS are used to control the search process
FLAGS DC CL8'00000000'
*
* SRCHTYP is a keyword either AND or OR indicating the way multiple
* search arguments will be combined.
SRCHTYP DC CL4'OR '
* Token is used for storing input and output information when
* multiple occurrences of the designated INFONAME exist.
*
TOKEN DS F
*
* The next 5 parameters comprise the SEARCH ARGUMENT.
* SARGNAM contains an information name that is used to qualify the
* search for INFONAME
* SARGVAL is the value which the SARGNAM value will be compared against
* SVALTYP contains the data type of the value contained in SARGVAL
* SVALLEN is the length, in bytes, of the value contained in SARGVAL.
* SARGTYP is the type of comparison to be preformed. Valid values:
* EQ -equal
* GT -greater than
* LT -less than
* GE -greater or equal
* LE -less or equal
* NE -not equal
SARGNAM DC CL20'CMS_READ_ONLY_DISK '
SARGVAL DC CL1'1'
SVALTYP DC F'9'
SVALLEN DC F'1'
SARGTYP DC CL2'EQ'
*
RC DC F'0'
R00 EQU 0
R01 EQU 1
R02 EQU 2
R03 EQU 3
R04 EQU 4
R05 EQU 5
R06 EQU 6
R07 EQU 7
R08 EQU 8
R09 EQU 9
R10 EQU 10
R11 EQU 11
R12 EQU 12
R13 EQU 13
R14 EQU 14
R15 EQU 15
DS 0D
@ENDDATA EQU *
@MODLEN EQU @ENDDATA-CSLASSEM
END CSLASSEM
After executing the above program, here is what would be displayed
on your terminal (assuming that the B disk is the first minidisk accessed
as read/write):
RTNCODE= 0
BUFFER= C2000000
BUFFER= B
DATATYP = 32
BUFLEN = 1
Remember when writing an assembler program with a call to a CSL
routine:
- Use the following statement to identify to the assembler that
DMSCSL is an external reference:
EXTRN DMSCSL