TSO-ISPF JCL COBOL VSAM DB2 CICS Tools Articles Job Portal Forum Quiz Interview Q&A

Rexx Skeleton Examples


Example: 1

Write an exec which receives name, designation, experience and salary as input user. Pass these inputs to a skeleton which calculates the increment in salary and assigns a new designation if user has more than two years experience.

Skeleton:

)CM SKELETON PROGRAM TO GENERATE JOB NAME BASED ON USER ID.
)SET FLN = &FILE
//&USR.A JOB &USR,,CLASS=&CLS,MSGCLASS=X,MSGLEVEL=(1,1),
//	       NOTIFY=&USR
//PROG EXEC PGM=IKJEFT01,PARM='%ELTSKEL &NAME &DESIG &EXP &SAL'
//SYSEXEC DD DSN=&REXXLIB,DISP=SHR
//SYSTSPRT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSTSIN DD DUMMY

REXX to invoke Skeleton:

/* REXX */
/* REXX PROGRAM TO INVOKE SKELETON */

  ADDRESS ISPEXEC
  "LIBDEF ISPSLIB DATASET ID('IBMMFID.ELT.REXX.CODE') "
  "LIBDEF ISPFILE DATASET ID('IBMMFID.ELT.REXX.CODE') "

    CLS = A
    USR = USERID()

    EXIT 0

SKELBEG:

    SAY 'ENTER YOUR NAME'
    PULL NAME

    SAY 'ENTER YOUR DESIGNATION' PULL DESIG

    SAY 'ENTER THE YEAR OF EXPERIENCE' PULL EXP

    SAY 'ENTER YOUR SALARY' PULL SAL

    REXXLIB = IBMMFID.ELT.REXX.CODE

    "ISPEXEC FTOPEN"
    "ISPEXEC FTINCL ELTSKELM"
    "ISPEXEC FTCLOSE NAME(ELTFIN)"

    ADDRESS TSO
    "SUB '"IBMMFID.ELT.REXX.CODE"("ELTFIN")'"

RETURN

REXX to be called from skeleton to calculate the salary hike and new designation.

/* REXX */
/* REXX TO CALCULATE NEW SALARY BASED ON THE DESIGNATION */

PARSE ARG NAME DESIG EXP SAL

  SELECT
    WHEN DESIG = 'PROGRAMMER ANALYST' THEN
        DO
          IF EXP > 2 THEN
            DO
              NEW_SAL=SAL+(SAL*.3)
              SAY 'YOUR NEW SALARY IS : ' NEW_SAL
              NEW_DESIG='ASSOCIATE'
              SAY 'YOUR NEW DESIGNATION IS:'NEW_DESIG
            END
          ELSE
            SAY 'PLEASE WAIT FOR NEXT APPRAISAL'
        END

  WHEN DESIG = 'ASSOCIATE' THEN
      DO
        IF EXP > 2 THEN
          DO
            NEW_SAL=SAL+(SAL*.2)
            SAY 'YOUR NEW SALARY IS:'NEW_SAL
            NEW_DESIG='SENIOR ASSOCIATE'
            SAY 'YOUR NEW DESIGNATION IS:'NEW_DESIG
          END
        ELSE
            SAY 'PLEASE WAIT FOR NEXT APPRAISAL'
      END

  OTHERWISE
      DO
        SAY "YOUR EVALUATION PROCESS IS IN PROGRESS"
      END
  END
EXIT

Output JCL which has to be submitted:

//IBMMFIDA JOB IBMMFID,,CLASS=A,MSGCLASS=X,MSGLEVEL=(1,1),
//	         NOTIFY=IBMMFID
//PROG EXEC PGM=IKJEFT01,PARM='%ELTSKEL MOHAN ASSOCIATE 3 10000'
//SYSEXEC DD DSN=IBMMFID.ELT.REXX.CODE,DISP=SHR
//SYSTSPRT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSTSIN DD DUMMY

Explanation:

  • The main REXX receives name, designation, experience and salary as input from the user which is to be passed to the skeleton.

  • The skeleton is invoked and tailored to get the output JCL with the name, designation, experience and salary substituted.

  • The generated JCL can be submitted to call a REXX exec which calculates the increment in salary and new designation of the user if the user has got more than 2 years of experience.

  • Proper comments must be used for better understanding.

  • Indentation must be appropriate for better readability.


If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on ibmmainframer Community!

Are you looking for Job Change? Job Portal