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
 

 

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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


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