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

How to generate Past Datecharacter string in format mm/dd/yy


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kanag

New User


Joined: 24 Aug 2006
Posts: 4

PostPosted: Thu Sep 14, 2006 6:21 pm
Reply with quote

How to generate a Past date character string in the format mm/dd/yy relative to the current date in SORT?

Eg: Date1(/)-d will generate a past date of format yyyy/mm/dd.
Requirement is to get it in the format mm/dd/yy
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 Sep 14, 2006 9:09 pm
Reply with quote

Quote:
Date1(/)-d will generate a past date of format yyyy/mm/dd. Requirement is to get it in the format mm/dd/yy


You can use DATE1-d to get C'yyyymmdd' and then reformat that to 'mm/dd/yy'. For example:

Code:

    OPTION COPY                           
    INREC BUILD=(DATE1-12)               
    OUTREC BUILD=(5,2,C'/',7,2,C'/',3,2) 


The exact DFSORT control statements you need depends on exactly what you're trying to do with the date.
Back to top
View user's profile Send private message
kanag

New User


Joined: 24 Aug 2006
Posts: 4

PostPosted: Thu Sep 14, 2006 11:31 pm
Reply with quote

Hi Frank,

Thanks for your reply. I need to OMIT records by comparing the date field (which is of format (mm/dd/yy) in the records with the current date. Since OMIT/ INCLUDE happens before reformating happens, I have to go for two JOB steps.

I step: Reformat the Date field.
II step: OMIT/INCLUDE the records using DATE1-d and again change the date format to original.

Can this be done in a single JOB step?
Can "&Date-d" used for this?
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 Sep 15, 2006 12:45 am
Reply with quote

Yes, you can do it in one pass with DFSORT. For example, let's say your input file is RECFM=FB and LRECL=80 and you want to compare a 'mm/dd/yy' date in positions 1-8 of your input records to the current date - 12. You could use the following DFSORT job. You can change it appropriately for other situations.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(91:DATE1-12)),
        IFTHEN=(WHEN=INIT,OVERLAY=(81:95,2,C'/',97,2,C'/',93,2))
  OUTFIL INCLUDE=(1,8,CH,EQ,81,8,CH),
    BUILD=(1,80)
/*
Back to top
View user's profile Send private message
kanag

New User


Joined: 24 Aug 2006
Posts: 4

PostPosted: Fri Sep 15, 2006 4:22 pm
Reply with quote

Hi Frank,
I am getting syntax error at
INREC IFTHEN=(WHEN=INIT,OVERLAY=(91:DATE1-12)),

Why does this happen?
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 Sep 15, 2006 10:07 pm
Reply with quote

If you're using DFSORT (ICExxxs messages), you need z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) in order to use DATE1-12. If you see 'ICE201I E' in //SYSOUT, you have the PTF. Otherwise, you need to ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTF, see:

Use [URL] BBCode for External Links

If you're using DFSORT with the April, 2006 PTF and you get a syntax error for DATE1-12, show the //SYSOUT messages.
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Binary File format getting change whi... All Other Mainframe Topics 5
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
Search our Forums:

Back to Top