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

Retrieve system date by use of sort tool


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

New User


Joined: 16 Aug 2005
Posts: 54

PostPosted: Thu Feb 01, 2007 6:24 am
Reply with quote

Could someone point me to an example or manual explaining how to retrieve the last and the first day of current month by use of sort tool ?
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: Thu Feb 01, 2007 9:36 pm
Reply with quote

Do you mean "day" as in Monday, Tuesday, etc, or do you mean date as in 'yyyymmdd' or some other form? Please be more specific about what you want to do exactly.
Back to top
View user's profile Send private message
knobi

New User


Joined: 16 Aug 2005
Posts: 54

PostPosted: Fri Feb 02, 2007 9:38 pm
Reply with quote

sorry Frank, the date format would be something like mmddyy :

output:
first 010107 last 013107


thank you !
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: Fri Feb 02, 2007 10:08 pm
Reply with quote

You could use a DFSORT job like this. It will handle everything except setting the last day of Feb to '29' for a leap year. That would take a bit more work, but could be done.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
RECORD
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC IFOUTLEN=30,
   IFTHEN=(WHEN=INIT,BUILD=(31:DATE2)),
   IFTHEN=(WHEN=INIT,
     OVERLAY=(C'First ',35,2,C'01',33,2,
       C' last ',35,2,21:C'xx',33,2)),
   IFTHEN=(WHEN=INIT,
     OVERLAY=(21:35,2,CHANGE=(2,
      C'01',C'31',C'02',C'28',C'03',C'31',C'04',C'30',
      C'05',C'31',C'06',C'30',C'07',C'31',C'08',C'31',
      C'09',C'30',C'10',C'31',C'11',C'30',C'12',C'31')))
/*


I ran this job today and the output was:

Code:

First 020107 last 022807
Back to top
View user's profile Send private message
knobi

New User


Joined: 16 Aug 2005
Posts: 54

PostPosted: Sun Feb 04, 2007 12:21 am
Reply with quote

Thank you very much Frank !
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 Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Sysplex System won't IPL at DR site I... All Other Mainframe Topics 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
Search our Forums:

Back to Top