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

Inlcude past date in YY/MM/DD format


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
itclark

New User


Joined: 10 Nov 2009
Posts: 3
Location: Edinburgh

PostPosted: Tue Nov 10, 2009 9:19 pm
Reply with quote

I need to include current date minus 7 days in YY/MM/DD format in my output records.

I can use DATE1(/)-7 to get the correct date with 4 char year 2009/11/03

I can use DATE=(YMD/) to get current date with 2 char year 09/11/10, but I can't see a way to get this format for a date in the past.

Thanks, Ian
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Nov 11, 2009 12:32 am
Reply with quote

Quote:
I can use DATE1(/)-7 to get the correct date with 4 char year 2009/11/03


Use DATE1(/)-7 to get 'ccyy/mm/dd' - then rebuild it as 'yy/mm/dd'. For example:

Code:

  OPTION COPY                                           
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,80,81:DATE1(/)-7)), 
    IFTHEN=(WHEN=INIT,BUILD=(1,80,81:83,8))             
Back to top
View user's profile Send private message
itclark

New User


Joined: 10 Nov 2009
Posts: 3
Location: Edinburgh

PostPosted: Wed Nov 11, 2009 6:56 pm
Reply with quote

Thanks for that Frank.
I wasn't specific enough with my original query as I only need to include the date on some of the output records, but I have used your suggestion to get the following which works perfectly.

Code:

   INREC IFTHEN=(WHEN=(5,7,CH,EQ,C'GCMIGDE'),         
                   BUILD=(1,21,DATE1(/)-7,30,6))   
   OUTREC IFTHEN=(WHEN=(5,7,CH,EQ,C'GCMIGDE'),       
                  BUILD=(1,21,22:24,43))


Regards, Ian
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Nov 11, 2009 11:28 pm
Reply with quote

Note that you don't need an INREC and OUTREC statement to do this. You can do it with just one of them. For example:

Code:

  OPTION COPY                                                   
  INREC IFTHEN=(WHEN=(5,7,CH,EQ,C'GCMIGDE'),                   
                   BUILD=(1,21,DATE1(/)-7,30,6),HIT=NEXT),     
     IFTHEN=(WHEN=ANY,BUILD=(1,21,22:24,43))                   
Back to top
View user's profile Send private message
itclark

New User


Joined: 10 Nov 2009
Posts: 3
Location: Edinburgh

PostPosted: Thu Nov 12, 2009 3:03 pm
Reply with quote

Thanks Frank - that's perfect.
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 Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Need help to append a date&tsp at... DFSORT/ICETOOL 9
Search our Forums:

Back to Top