Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 IBEGENER RETURN CODE 12 anilkumar922 All Other Mainframe Topics 5 Wed Dec 13, 2017 11:41 am
No new posts Finding the plan when code compiled u... Ahemad DB2 1 Fri Dec 01, 2017 6:38 pm
No new posts Strange Code amitc23 COBOL Programming 6 Tue Nov 28, 2017 11:25 am
No new posts Fetching data from JHS as per the cur... arunsoods All Other Mainframe Topics 4 Wed Nov 22, 2017 1:54 pm
No new posts Date in where clause - Windows Karthikeyan Subbarayan DB2 9 Wed Nov 15, 2017 9:07 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us