EXTOL RPG Program: RTVJOBR

EXTOL RPG - External Call RTVJOBR - Retrieve: Job Name/Profile/Number

     H/TITLE Retrieve job name, etc. selected by qualifier
     H            Y
     Z* CRTRPGPGM
     Z* OPTION(*NOXREF) GENOPT(*OPTIMIZE)
      *
     W* Warning: This program does not set on the LR indicator
      *
     H* SYNOPSIS :
     H*  Example of external call code translation using the "short"
     H*  parameter list.
      *
     H*  Returns various results depending on the qualifier input.
     H*
     H*  JOB xxxxxxx    Job name
     H*  USERxxxxxxx    Job user profile name
     H*  JOBNxxxxxxx    Job number (000000-999999)
     H*  JOB#xxxxxxx    Job number (000000-999999)
     H*
     H*  The output input is "local" for incoming, "standard" for
     H*  outgoing.
      *
      * Parameter declarations
     I            DS
      * I :  Code trans directions    1
     I                                        1   1 P1CDTT
      * I :  Code table reference    10
     I                                        2  11 P2TABL
      * B :  Code in standard form   80
     I                                       12  91 P3CDST
      * B :  Code qualifier data     80
     I                                       92 171 P4CDQD
     I                                       92  95 P4CDQ4
      * B :  Code in local form      80
     I                                      172 251 P5CDLC
      *
      * Data structures:
     IPGMDS     ESDSEXPGSDS
      * Program data structure
      /EJECT
      *****************************************************************
      * Entry parameters
     C           *ENTRY    PLIST
     C                     PARM           P0RTN   7
     C           P1CDTT    PARM           WP0001  1        Code trans dire
     C           P2TABL    PARM           WP0002 10        Code table refe
     C           P3CDST    PARM P3CDST    WP0003 80        Code in standar
     C           P4CDQD    PARM P4CDQD    WP0004 80        Code qualifier
     C           P5CDLC    PARM P5CDLC    WP0005 80        Code in local f
      *****************************************************************
      *
     C                     MOVEL*BLANK    OUT80  80
      *
     C           P4CDQ4    IFEQ 'JOB '                     *IF
     C                     MOVEL##JOB     OUT80            Element data bu
     C                     ELSE
     C           P4CDQ4    IFEQ 'USER'                     *IF
     C                     MOVEL##USR     OUT80            Element data bu
     C                     ELSE
     C           P4CDQ4    IFEQ 'JOBN'                     *IF
     C           P4CDQ4    OREQ 'JOB#'                     *IF
     C                     MOVEL##JNO     OUT80            Element data bu
     C                     END                             *FI
     C                     END                             *FI
     C                     END                             *FI
      *
      * CASE: PAR.Code trans directions is Inward translation
     C           P1CDTT    IFEQ 'I'                        *IF
      * Incoming function:
     C                     MOVELOUT80     P5CDLC
     C                     ELSE
      * CASE: PAR.Code trans directions is Outward translation
     C           P1CDTT    IFEQ 'O'                        *IF
      * Outgoing function:
     C                     MOVELOUT80     P3CDST
     C                     END                             *FI
     C                     END                             *FI
      *
      * A "Return code" of non-blank will be logged as a translation error:
     C                     MOVEL*BLANK    P0RTN            *Return code
      * Exit program
     C                     RETRN



By: on