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
 

 

Inlcude past date in YY/MM/DD format

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Inlcude past date in YY/MM/DD format
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 Moderator


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

PostPosted: Wed Nov 11, 2009 12:32 am    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Wed Nov 11, 2009 11:28 pm    Post subject:
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    Post subject:
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    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 How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts Need to write record of PS File in ex... Chandan1993 JCL & VSAM 1 Wed Jun 07, 2017 1:35 am
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts LISTIDR compiled date/time jerryte IBM Tools 3 Thu Apr 20, 2017 7:37 pm
No new posts SUBSTR for Date functions Shaheen Shaik DB2 4 Thu Apr 06, 2017 2:14 pm


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