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

Getting prev date using current date from file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top