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
 
Getting prev date using current date from file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Prasanya

New User


Joined: 04 Jun 2007
Posts: 34
Location: Chennai

PostPosted: Thu Dec 11, 2008 6:28 pm    Post subject: Getting prev date using current date from file
Reply with quote

Hi,

I need to extract records having the date as today's date or yesterday's date. I can't use system date since its a requirement to use the date from a current date file. Presently am only taking records based on current date.
In the current date file, the date will be as yyyymmdd and its packed

Code:

//STEP010  EXEC PGM=ICEMAN                                           
//SYSOUT   DD SYSOUT=*                                               
//SORTIN   DD DSN=CURRENT.DATE.FILE,DISP=SHR           
//SORTOUT  DD DSN=&&TEMP,DISP=(,PASS),                               
//SYSIN    DD *
SORT FIELDS=COPY                                                 
OUTREC BUILD=(C'BUSDAY,C''',1,5,PD,EDIT=(TTTT-TT-TT),C'''',80:X) 
/*
//STEP020  EXEC PGM=ICEMAN                                           
//SYSOUT   DD SYSOUT=*                                               
//SYMNAMES DD DSN=&&TEMP,DISP=(OLD,DELETE)                           
//SORTIN   DD *
aaaa1111ccccdddd2008-12-11eeee
aaaa2222ccccdddd2008-12-10eeee
aaaa3333ccccdddd2008-12-11eeee
aaaa4444ccccdddd2008-12-07eeee
/*
//OUTPUT DD DSN=OUTPUT.FILE.NAME,           
//             DISP=(,CATLG,DELETE),
//             RECFM=FB,LRECL=63                                     
//SYSIN    DD *
SORT FIELDS=COPY                       
INCLUDE COND=(17,10,CH,EQ,BUSDAY)     
OUTFIL FNAMES=OUTPUT,REMOVECC,       
OUTREC=(1:1,63)                       
/*


My output file should contain,
Code:

aaaa1111ccccdddd2008-12-11eeee
aaaa2222ccccdddd2008-12-10eeee
aaaa3333ccccdddd2008-12-11eeee
Back to top
View user's profile Send private message

Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Dec 11, 2008 10:19 pm    Post subject: Reply to: Getting prev date using current date from file
Reply with quote

prasnya wrote:
I need to extract records having the date as today's date or yesterday's date. I can't use system date since its a requirement to use the date from a current date file. Presently am only taking records based on current date. In the current date file, the date will be as yyyymmdd and its packed


I am not clear as to what you are trying to do . In your example you show a current date file. what date does it contain? i.e Does it DEC-11-2008 (which is current date here today) in YYYMMDD comp-3 format? or can it contain any date like 4-march-2007 which is a very old date.

if it contains an old date do you still need to subtract a day from it and extract the contents in second file?
Back to top
View user's profile Send private message
Prasanya

New User


Joined: 04 Jun 2007
Posts: 34
Location: Chennai

PostPosted: Fri Dec 12, 2008 1:55 pm    Post subject: Reply to: Getting prev date using current date from file
Reply with quote

The current date file contains only a date field in the format YYYYMMDD comp-3. eg: 20081212. It will have only today's date and no other older date.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Dec 12, 2008 10:17 pm    Post subject:
Reply with quote

prasanya,

change your step10 to the following. This will validate the date in the file with the current date and pick up yesterday's date.

A brief exaplanation the job.

The first IFTHEN WHEN=INIT will expand the packed decimal date to YYYYMMDD format and also pad the current date in YYYYMMDD and current date-1 and current date-2 dates in YYYYMMDD format.

Now I check the date in the file and see if it is equal to current date then I create the symbol with yesterday's date

if the date in the file is equal to yesterday's date then I create the symbol with current date-2 days.
Code:

//STEP010  EXEC PGM=ICEMAN                                           
//SYSOUT   DD SYSOUT=*                                               
//SORTIN   DD DSN=CURRENT.DATE.FILE,DISP=SHR           
//SORTOUT  DD DSN=&&TEMP,DISP=(,PASS),                               
//SYSIN    DD *                                             
  SORT FIELDS=COPY                                           
  INREC IFTHEN=(WHEN=INIT,                                   
  OVERLAY=(6:1,5,PD,M11,LENGTH=8,DATE1,DATE1-1,DATE1-2)),   
  IFTHEN=(WHEN=(6,8,ZD,EQ,14,8,ZD),                         
  BUILD=(C'BUSDAY,C''',22,4,C'-',26,2,C'-',28,2,C'''',80:X)),
  IFTHEN=(WHEN=(6,8,ZD,EQ,22,8,ZD),                         
  BUILD=(C'BUSDAY,C''',30,4,C'-',34,2,C'-',36,2,C'''',80:X))
//*


Also change your step20 include to have GE instead of EQ

Code:

INCLUDE COND=(17,10,CH,GE,BUSDAY)
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 11 Fri Sep 22, 2017 11:35 pm

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