View previous topic :: View next topic
|
Author |
Message |
kanag
New User
Joined: 24 Aug 2006 Posts: 4
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
kanag
New User
Joined: 24 Aug 2006 Posts: 4
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
kanag
New User
Joined: 24 Aug 2006 Posts: 4
|
|
|
|
Hi Frank,
I am getting syntax error at
INREC IFTHEN=(WHEN=INIT,OVERLAY=(91:DATE1-12)),
Why does this happen? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
|