DSPARM subroutine example

*COMPILATION UNIT:  LEASMPRM
* ====================================================================
*
*        Shows an assembler subroutine that displays inbound
*        parameters and returns.
*
* ====================================================================
DISPARM  CEEENTRY PPA=PARMPPA,AUTO=WORKSIZE,MAIN=NO
         USING WORKAREA,R13
*
* --------------------------------------------------------------------
*
* Invoke CEE3PRM to retrieve the command parameters for us
*
         CALL  CEE3PRM,(CHARPARM,FBCODE),VL,MF=(E,CALL3PRM)
*
* Check the feedback code from CEE3PRM to see if everything worked.
*
         CLC   FBCODE(8),CEE000
         BE    GOT_PARM
*
* Invoke CEEMOUT to issue the error message for us
*
         CALL  CEEMOUT,(BADFBC,DEST,FBCODE),VL,MF=(E,CALLMOUT)
         B     GO_HOME                 Time to go....
*
GOT_PARM DS    0H
*
* See if the parm string is blank.
*
         CLC   CHARPARM(80),=CL80' '   Is the parm empty?
         BNE   DISPLAY_PARM            No. Print it out.
*
* Invoke CEEMOUT to issue the error message for us
*
         CALL  CEEMOUT,(NOPARM,DEST,FBCODE),VL,MF=(E,CALLMOUT)
         B     GO_HOME                 Time to go....
*
DISPLAY_PARM   DS  0H
*
* Set up the plist to CEEMOUT to display the parm.
*
         LA    R02,80        Get the size of the string
         STH   R02,BUFFSIZE  Save it for the len-prefixed string
*
* Invoke CEEMOUT to display the parm string for us
*
         CALL  CEEMOUT,(BUFFSIZE,DEST,FBCODE),VL,MF=(E,CALLMOUT)
*
* Return to the caller
*
GO_HOME  DS    0H
         CEETERM  RC=0

* ====================================================================
*              CONSTANTS
* ====================================================================
*
DEST     DC    F'2'               Destination is the LE message file
CEE000   DS    3F'0'              Success feedback code
*
BADFBC   DC    Y(BADFBEND-BADFBSTR)
BADFBSTR DC    C'Feedback code from CEE3PRM was nonzero.'
BADFBEND EQU   *
*
NOPARM   DC    Y(NOPRMEND-NOPRMSTR)
NOPRMSTR DC    C'No user parm was passed to the application.'
NOPRMEND EQU   *
*
*
PARMPPA  CEEPPA ,                 Constants describing the code block
* ====================================================================
*        The Workarea and DSA
* ====================================================================
WORKAREA DSECT
         ORG   *+CEEDSASZ         Leave space for the DSA fixed part
*
CALL3PRM CALL  ,(,),VL,MF=L       2-argument parameter list
CALLMOUT CALL  ,(,,),VL,MF=L      3-argument parameter list
FBCODE   DS    3F                 Space for a 12-byte feedback code
*
BUFFSIZE DS    H                  Halfword prefix for following string
CHARPARM DS    CL255              80-byte buffer
*
*
         DS    0D
WORKSIZE EQU   *-WORKAREA
         CEEDSA  ,                Mapping of the dynamic save area
         CEECAA  ,                Mapping of the common anchor area
*
R02      EQU   2
R13      EQU   13
         END