Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Code a particular weekday's date thru ezytrieve

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CA Products
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    Post subject: Code a particular weekday's date thru ezytrieve
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

Site Director


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

PostPosted: Wed Jul 28, 2010 2:40 am    Post subject:
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    Post subject: Reply to: Code a particular weekday's date thru ezytrieve
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    IBMMAINFRAMES.com Support Forums -> CA Products All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Job failing with USER = 4093 REASON C... Pradeepa S ABENDS & Debugging 1 Wed May 17, 2017 3:35 pm
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am
No new posts Cobol upgrade - source code missing f... gthmrj IBM Tools 1 Wed Apr 26, 2017 6:04 pm
No new posts LISTIDR compiled date/time jerryte IBM Tools 3 Thu Apr 20, 2017 7:37 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us