IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Code a particular weekday's date thru ezytrieve


IBM Mainframe Forums -> CA Products
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
surya4ug

New User


Joined: 08 Jul 2008
Posts: 62
Location: chennai

PostPosted: Wed Jul 28, 2010 1:13 am
Reply with quote

Hello,

Not sure if i named the subject properly icon_smile.gif.. but i have a requirement to fetch the 'last sunday's' date and populate it in a field using easytrieve ( or syncsort ).

Ex :

Today is 27th July'10 ... so, if i run my job today, i want 25th July'10 to be written on my output file, irrespective of when i run my job in the current week, before the next sunday comes in..

To fetch the current date, we use SYSDATE-LONG and code the date in which ever format we need. If you could suggest something that fetches the last Sunday's date in a similar way, that would be great.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Jul 28, 2010 2:40 am
Reply with quote

Hello,

Most organizations have callable utility date routines. Suggest you talk with your seniors or technical support and learn what is available on your systems. If a module is callable from COBOL, it should be callable from Easytrieve.
Back to top
View user's profile Send private message
surya4ug

New User


Joined: 08 Jul 2008
Posts: 62
Location: chennai

PostPosted: Sat Jul 31, 2010 1:38 am
Reply with quote

Well, i didn't find anysuch thing that could satisfy my requirement in a step icon_smile.gif...but found this....

We can do it using the below 2 steps:
1. The first step will pull up the day of the week based on the Local LPAR timing
a. If you would like to do it based on the GMT Timing use &WDAY instead of &LWDAY.
b. This step will return the 3 characters day value e.g. ‘MON’, ‘TUE’, etc.

2. The 2nd step will calculate the last Sunday prior to the current date and based on the current day of the week, pick up the date for the last Sunday.
&DATE1 , will fetch the date in ‘YYYYMMDD’ format, if you want to keep it in any other form you can use the available formats for the DATE function.

Here are the JCL steps:
Code:

//STEP001 EXEC PGM=EZACFSM1                                           
//SYSOUT    DD DSN=HIGHLVL.MIDLVL.SAMPLE1.OUT2,DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,SPACE=(CYL,(5000,5000),RLSE),               
//             DATACLAS=DCCOM,VOL=(,,,80),                           
//             DCB=(RECFM=FB,BLKSIZE=0,LRECL=80)                     
//SYSUDUMP  DD SYSOUT=I                                               
//SYSPRINT  DD SYSOUT=*                                               
//SYSIN     DD *                                                     
  &LWDAY                                                             
/*                                                                   
//STEP002 EXEC PGM=SORT                                               
//SORTIN    DD DSN=HIGHLVL.MIDLVL.SAMPLE1.OUT2,DISP=SHR                 
//SORTOUT   DD DSN=HIGHLVL.MIDLVL.SAMPLE1.OUT3,DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,SPACE=(CYL,(5000,5000),RLSE),               
//             DATACLAS=DCCOM,VOL=(,,,80),                           
//             DCB=(RECFM=FB,BLKSIZE=0,LRECL=80)                     
//SYSOUT    DD SYSOUT=*                                               
//SYSIN     DD *                                                     
  SORT FIELDS=COPY                                                   
  OUTFIL IFTHEN=(WHEN=(3,3,CH,EQ,C'SUN'),             
  BUILD=(&DATE1)),                                   
  IFTHEN=(WHEN=(3,3,CH,EQ,C'MON'),                   
  BUILD=(&DATE1-1)),                                 
  IFTHEN=(WHEN=(3,3,CH,EQ,C'TUE'),                   
  BUILD=(&DATE1-2)),                                 
  IFTHEN=(WHEN=(3,3,CH,EQ,C'WED'),                   
  BUILD=(&DATE1-3)),                                 
  IFTHEN=(WHEN=(3,3,CH,EQ,C'THU'),                   
  BUILD=(&DATE1-4)),                                 
  IFTHEN=(WHEN=(3,3,CH,EQ,C'FRI'),                   
  BUILD=(&DATE1-5)),                                 
  IFTHEN=(WHEN=(3,3,CH,EQ,C'SAT'),                   
  BUILD=(&DATE1-6))                                   
/*
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CA Products

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts run rexx code with jcl CLIST & REXX 15
No new posts Compile rexx code with jcl CLIST & REXX 6
No new posts Need to convert date format DFSORT/ICETOOL 20
Search our Forums:

Back to Top