Tags

,

REXX – GET LAST 4 DAYS FROM GIVEN DATE

     I have written a REXX routine to the last 4 days from a given INPUT date. The input date is of the format MMDDYYYY (Ex: 05242013). And the output dates that you would get out of REXX routine is

2013-05-23          2013-05-22          2013-05-21          2013-05-20

REXX routine for the above requirement is provided below.

/*****REXX****/

ADDRESS TSO

CLEAR

TSOID = USERID()

INDATE1 = ‘05242013’

INDATE = SUBSTR(INDATE1,5,4) || SUBSTR(INDATE1,1,2)

INDATE = INDATE || SUBSTR(INDATE1,3,2)

TODAY = DATE(“B”)

INPUT = DATE(,INDATE,’S’)

DATE5 = DATE(‘B’,INPUT)

DATE4 = DATE5 – 1

DATE4 = DATE(‘S’,DATE4,’B’)

DATE4A = SUBSTR(DATE4,1,4) || ‘-‘ || SUBSTR(DATE4,5,2) || ‘-‘

DATE4A = DATE4A || SUBSTR(DATE4,7,2)

DATE3 = DATE5 – 2

DATE3 = DATE(‘S’,DATE3,’B’)

DATE3A = SUBSTR(DATE3,1,4) || ‘-‘ || SUBSTR(DATE3,5,2) || ‘-‘

DATE3A = DATE3A || SUBSTR(DATE3,7,2)

DATE2 = DATE5 – 3

DATE2 = DATE(‘S’,DATE2,’B’)

DATE2A = SUBSTR(DATE2,1,4) || ‘-‘ || SUBSTR(DATE2,5,2) || ‘-‘

DATE2A = DATE2A || SUBSTR(DATE2,7,2)

DATE1 = DATE5 – 4

DATE1 = DATE(‘S’,DATE1,’B’)

DATE1A = SUBSTR(DATE1,1,4) || ‘-‘ || SUBSTR(DATE1,5,2) || ‘-‘

DATE1A = DATE1A || SUBSTR(DATE1,7,2)

SAY “INDATE ” INDATE1

SAY DATE4A

SAY DATE3A

SAY DATE2A

SAY DATE1A

——————————————————————————————————–

In United States, If you would like to Earn Free Stocks, Credit card Points and Bank account Bonuses, Please visit My Finance Blog

——————————————————————————————————–

You may also like to look at:

Working on Mainframes – Is Change to a different technology necessary
Important SQL CODES and ABEND CODES
SORT JOIN – TO JOIN TWO FILES BASED ON A KEY
KNOW YOUR MAINFRAME
REXX – INITIAL SETUP
EASYTRIEVE – A023 ABEND
EASYTRIEVE – SORT and FILE COMPARISION
EASYTRIEVE – Special-name Report Procedures
EASYTRIEVE – REPORT STAEMENT
EASYTRIEVE – Sample Program – Table And Search
EASYTRIEVE – Sample Program – Display Totals and Summary
EASYTRIEVE – Sample Program – Display Employee Data
CA-Easytrieve/Plus – Basics
REXX TOOL # 02 – FSAVE – Save member opened in VIEW mode
REXX TOOL # 01 – O – Open Any Mainframe Element from any ISPF Screen
REXX – INDEX, POS, SUBSTR, COMPARE
REXX – READ THE DSN PROVIDED AS DD IN JCL
REXX – SEND MULTIPLE ARGUMENTS THROUGH JCL
REXX – HOW TO COMPILE YOUR REXX EXEC
REXX – CHANGE UPPER TO LOWER CASE
REXX – GET LAST 4 DAYS FROM GIVEN DATE
REXX – PANEL Definition
REXX – READ, CREATE AND WRITE DATA TO A DATASET
REXX TOOL TO SUBSTITUTE SYMBOLICS IN A PROC