REXX Training Services

SYS-ED Experience

Submit REXX Questions

Home

Submit REXX Questions

Technology Driven IT Training

Knowledge Base


Submit REXX Questions to SYS-ED Advanced search
     

Interrelated Information Technology

Mainframe Questions Programming Language Questions

The SYS-ED knowledge base is a service for answering questions, inclusive of the research and validation of the accuracy of information in the public domain. Citation of source documentation and examples are used to provide answers to the questions. Utilization and reliance on the answers, information, or other materials received through this website is done at your own risk.

Q

Can a REXX subroutine return a value? Can it be invoked as a function?

A

When coding a procedure, the routine can be invoked as a subroutine or a function. The difference is the invocation. The CALL keyword invokes a subroutine. A function is invoked within an expression. The function returns and is replaced with a value. The subroutine return result is stored in the keyword variable RESULT.

 

This REXX routine adds two passed values and returns the total:

MYRTN: PROCEDURE 
   ARG NUMB1,NUMB2
   TOTAL = NUMB1 + NUMB2
   RETURN TOTAL    

This code invokes the routine using a function:

SUMVALUES = MYRTN(5,3)
SAY SUMVALUES

  This routine invokes the function using a subroutine:

CALL MYRTN 5,3
SUMVALUES = RESULT
SAY SUMVALUES              

Q

Can a FIFO stored data queue and LIFO data stack be stored in a single REXX stack?
A Yes, the QUEUE and PUSH command works. However, data retrieval can be confusing.
 

Example:

/****************REXX***************/
QUEUE 'A1'
QUEUE 'A2'
QUEUE 'A3'
PUSH  'B1'
PUSH  'B2' 
PUSH  'B3'

DO 6 
       PULL VALUE
       SAY VALUE
END
  The output of the REXX program is:

B3
B2

B1

A1

A2

A3
  This sequencing retrieves the stack information first in LIFO order and then the queue in FIFO order.

Q Can the EXECIO command be used for reading a dataset starting at a specific record based on its relative position in the dataset?
A There is an option on the EXECIO to start at a record other than the first record.  This code will read all records starting at record 50.  All the retrieved records are stored in a compound variable.  

   "EXECIO  *  DISKR  mydd 50  (STEM compondVar."

Q

The MAKEBUF statement creates a new buffer and the DROPBUF statement drops the most recently created buffer.  When multiple buffers are created, is it possible to specify which buffer to drop?
A Yes. The MAKEBUF returns the number of the buffer created in the variable RC.

The DROPBUF can specify the buffer number using this format:  

   DROPBUF n

Q When running a REXX exec in TSO/E, exec processing can be interrupted by invoking the attention interrupt key.  Where is the attention interrupt key on the keyboard?
A Typically, the attention interrupt key is the PA1 on the keyboard. Most keyboards do not have a key marked PA1.  On a 3270 emulators, the default PA1 is the Alt+Insert key combination; it also can be the Page Up key or ALT F1.

Q

We could use some help with this REXX exec code. There is a condition which prevents a job from starting when it is Monday - Friday, 6AM - 6PM.  Is there a better way for coding the condition? Can an if date(“w”) >= “Monday” & date(“w”) <= “Friday” be used in the weekday check?

  IF (((DATE("W") = "Monday"),                  

     | DATE("W") = "Tuesday"),                 

    | DATE("W") = "Wednesday"),               

     | DATE("W") = "Thursday"),                 

     | DATE("W") = "Friday"))) THEN DO

      IF ((TIME("N") >= ""06:00",

      & (TIME("N")18:00)) THEN RETURN

     END

Address Oper

"*X DR, M=WasServer”

A

The code looks fine; however, there is another method which may be worthwhile to evaluate. A search can be performed for a string of days and if not found, it is a weekday.

The REXX POS function can be used.

Example:

IF POS(DATE("W"),"SATURDAYSUNDAY") = 0 THEN DO /* THIS WILL CHECK FOR A WEEKDAY */


Q

I am converting from CLIST to REXX code. Do you have any recommendation regarding this code? This REXX code was submitted for review.

/*REXX                           */
/*******************************************************************
/* NAME OF THIS DATASET -- 'CPY.ET995.DEECLIB(VAPREP)' *
/* IS A COMMAND CLIST FOR EARNINGS MODERNIZED/PRE-POSTING *
/* IS CALLED BY 'CPY.ET995.DEEPLIB(VSEARN13)' *
/* MAINTAINER --- PHONE ---      *
/******************************************************************/
/* COMMAND DISPLAY JCL           */
/* REXX PANELS SKELETON MECPYGES */
/* -------- -------- -------- -------- */
/* VAPREP VAPREP VAPREP VALID000 */
/* V2STEPLB VALID001             */
/* V2VALIDZ VALID002             */
/* VALID003                      */
/* */
/*________________________________________________________________*/

ADDRESS TSO
DO
TRACE R
CALL MS('OFF')
END

REGVAR
ADDRESS ISPEXEC "VGET (VAL CV TY TAXY DAILYOUT PRIOROUT PRIORDTE ",
CFMRDATE CFMNAME CMONTH CDAY CCENTURY ",
CYEAR SHARED "

INIT
REENTER = 'N'
NUMSTEPS = 1
ADDRESS ISPEXEC "VPUT REENTER NUMSTEPS" SHARED
PRF = SYSVAR(SYSPREF)
PRFNUM = SUBSTR(PRF,2,5)
MSG = 1
CLASS = 'T'
OUTQUAL = DAILYOUT
MM = CMONTH
DD = CDAY
CCYY = CENTURY||YEAR
VERS = 'V'
TOTAL = 1

VABED1 = 'CPY.ET996..EBVABED'
VABED2 = 'CPY.ET996..EBVABED'
VABED3 = 'CPY.ET996..EBVABED'
AMUEI = 'CPY.ET996..AMUEI'
SRPOUT = 'CPY.ET996..SRPOUT'
RUN = ''

PGM1 = 'VAPREP'
LOOPCTR = NUMSTEPS + 1
DO = YPRGM + CTR
ADDRESS ISPEXEC VPUT YPRGM SHARED
CTR = CTR + 1
IF CTR > LOOPCTR THEN RETURN
END

START
N = 0
ADDRESS ISPEXEC VPUT DISPLAY REFRESH
ADDRESS ISPEXEC VPUT DISPLAY PGM
DO
ADDRESS ISPEXEC MSG
SIGNAL FINI
END
IF VMCC = 8 THEN DO SIGNAL

A

The DO loop is sophisticated in REXX.

Example:

DO B = 1 FOR 4
SAY " B= " B
END

Counters and checks are not needed in the code.

There also is an alternative to the SIGNAL command. In the snippet of code, the SIGNAL command was used as an alternative to a GOTO. It will make the code harder to read.

/*REXX____________________________________________________________*/

/* Code snippet */.
.
.
LOOPCTR = NUMSTEPS + 1
DO = YPRGM + CTR
ADDRESS ISPEXEC VPUT YPRGM SHARED
CTR = CTR + 1
IF CTR > LOOPCTR THEN RETURN
END


Q

We are in the process converting CLISTs to REXX. Is there anyway to shorten the way to share a variable in the address using VGET? I have enclosed some sample code.

/*REXX                                    */
COMMAND DISPLAY JCL
CLISTS PANELS SKELETON MESSAGES
-------- -------- -------- --------
VAPREP VAPREP VAPREP VALID000
V2STEPLB VALID001
V2VALIDZ VALID002
VALID003

/*                                        */
MAIN CONTROL

/*                                        */
ARG PRSR
CALL 1000_INIT  /* INIT OR SET VARIABLES  */
CALL 2000_LOGIC /* SET LOGIC              */
END

EXIT_VAPREP
CALL 4000_FINAL /*CLEANUP AND EXIT        */
EXIT

1000_INIT

ADDRESS ISPEXEC "VGET (VAL CV TY TAXY DAILYOUT PRIOROUT PRIORDTE ",
CFMRDATE CFMNAME CMONTH CDAY CCENTURY ",
CYEAR" SHARED
PRF = SYSVAR(SYSPREF)
PRFNUM = SUBSTR(PRF,2,5)
MSG = 1
CLASS = 'T'
OUTQUAL = DAILYOUT
MM = CMONTH
DD = CDAY
CCYY = CENTURY||YEAR
VERS = 'V'
RETURN

000_LOGIC

A

The technique being used for the VGET is the proper way of getting a variable from the SHARED pool. You may be able to use the ADDRESS ISPEXEC standalone command and then issue the VGET without the ISPEXEC prefix. This is useful when running many ISPEXEC statements. VGET is taught and demonstrated in the Dialog Manager course.

Q

What does REXX stand for and is it still used?

A

REXX stands for the REstructured eXtended eXecutor language. It was intended to be used for text processing tasks. REXX was part of IBM’s SAA standard and was included as a standard component in its operating systems - mainframes, midrange, and PC. Most of the REXX programming currently is for maintenance and retrofitting of the existing code. There have been some enhancements to REXX for utilization with client/server and web access applications.

Q

Does SYS-ED still offer REXX courses?

A REXX courses are offered the SYS-ED schedule and on a private basis at the client’s site. Our library and workshops consist of 1000’s extensive cross platform (It was called the SAA standard in the 1980’s) sample programs and workshops. Our staff of systems consultant trainers have coded, debugged and taught REXX in multiple environments - OS/390, z/OS, z/VM, OS/2, and Windows - from the introduction of REXX through today.

Q

Does SYS-ED offer a REXX training program?

A

Yes, we offer tailored REXX training programs; but only on a private basis. The program consists of an integrated series of courses - REXX Programming, REXX Programming - Advanced, CLIST Programming, and Dialog Manager. Optional courses which can be included are JCL Utilities: Dialog Manager Advanced. Quite frankly, there is not a great demand for REXX training programs. In most cases, these courses are conducted for government municipalities and Fortune 1000 companies which will be called upon to do maintenance and retrofitting of code.

Q

I have been told that REXX is an interpretive language; is there a more powerful compilation version of REXX?

A

The answer is yes to both questions. Yes, REXX is an interpretive language and yes there is a true programming language with IBM Compiler for REXX. We have the resources to offer our client organizations a choice of the REXX platform to be trained on.

Q I have been assigned to do REXX maintenance coding. It quickly has become apparent that I need to learn more than simply REXX in order to successfully perform my job. What other IBM systems software would itbe helpful to be proficient with?

A

The IBM systems software which typically has been utilized in conjunction with REXX includes: Xedit commands, CLISTs, and Dialog Manager.

Schedule