z/OS TSO/E Guide to SRPI
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Sample Access Method Driver

z/OS TSO/E Guide to SRPI
SA32-0980-00

The following sample is provided to illustrate use of the AMD interface. The sample does not represent a functional access method driver.

IBMAMD   CSECT
IBMAMD   AMODE 31
IBMAMD   RMODE ANY
         STM   14,12,12(13)          Save the caller's registers.
         LR    12,15                 Establish addressability within
         USING IBMAMD,12             this CSECT.
         LA    0,DYNSIZE             Obtain the dynamic storage size.
         GETMAIN RU,LV=(0)           Obtain the dynamic storage.
         LR    11,1                  Place the storage address in the
*                                    dynamic area register.
         USING DYNAREA,11            Establish addressability to the
*                                    dynamic area.
         ST    13,SAVEAREA+4         Save the caller's savearea address.
         ST    11,8(,13)             Chain our savearea to the callers.
         LM    15,1,16(13)           Restore registers 15,0, and 1.
         LA    13,SAVEAREA           Point register 13 to our savearea.
         L     2,0(,1)               Obtain the CED address.
         USING CHSCED,2              Establish addressability to it.
         EJECT
***********************************************************************
* TITLE: IBMAMD MAINLINE
*
* LOGIC: Receive the PC request and route it to the appropriate
*        server.
***********************************************************************
         SPACE 2
*
* An Access Method Driver receives and sends communications and is
* responsible for initiating service requests on the host.
*
* The format of the communication depends on the protocol
* that is used to communicate between the requester and the host
* AMD.
*
* The AMD can use the CHSTRACE macro to issue messages to the
* terminal and/or the trace data set.  Messages can indicate
* that a communication was received and the type of communication
* (such as a valid server request, invalid server request, termination
* request, and so on).
*
* If a valid request for a server was received and all of the
* parameters were received, the AMD can issue the SENDREQ macro to
* invoke the server.
*
* Upon return from the SENDREQ macro, the AMD should send the reply
* to the requester.
*
* The AMD should then await another request or reply communication
* until a predetermined termination indicator is received.  When the
* AMD terminates, it returns control to MVSSERV.

         EJECT
**********************************************************************
* Leave the AMD.
**********************************************************************
         SPACE
EXIT     DS    0H
         L     13,SAVEAREA+4         Restore the caller's savearea
*                                    address.
         LR    2,15                  Save the return code.
         LR    1,11                  Obtain dynamic area address.
         LA    0,DYNSIZE             Obtain the dynamic storage size.
         FREEMAIN RU,LV=(0),A=(1)    Release the dynamic area.
         LR    15,2                  Restore the return code.
         L     14,12(,13)            Restore the caller's registers
         LM    0,12,20(13)           except for 15 (return code).
         BR    14                    Return to caller with return code.
         EJECT
**********************************************************************
* Dynamic Area.
**********************************************************************
         SPACE
DYNAREA  DSECT                       DYNAMIC area common mapping
         SPACE
SAVEAREA DS    18F                   Save area.
         SPACE
**********************************************************************
* Issue the CHSTRACE macro list form to supply a parameter list.
**********************************************************************
         SPACE
         CHSTRACE MF=(L,CHSLIST)
         SPACE
**********************************************************************
* Issue the SENDREQ macro list form to supply a parameter list.
**********************************************************************
         SPACE
         SENDREQ MF=(L,SENDLIST)
         EJECT
***********************************************************************
* CPRB
***********************************************************************
         SPACE
         CHSDCPRB DSECT=NO
DYNSIZE  EQU   *-DYNAREA
         EJECT
**********************************************************************
* CED mapping.
**********************************************************************
         SPACE
         CHSCED  DSECT=YES
         END   IBMAMD

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014