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 TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
No new posts Low values Results from VARCHAR FORMAT balaji81_k DB2 10 Thu Oct 20, 2016 1:18 am
No new posts output data in CSV Format janmejay COBOL Programming 8 Sat Oct 15, 2016 2:20 pm


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