|
|
| Author |
Message |
Vineet
New User
Joined: 14 Sep 2005 Posts: 16
|
|
|
|
Hi,
I am having a Problem. I am reading a file & from File getting Date & one more field.Problem is:
1.Let say Date is 8/Sep/2008 then it is coming as 9/8/2008 & if Date is say 10/Sep/2008 then coming as 9/10/2008 & If Date is 12/Oct/2008
then date is appearing as 10/12/2008.
My Requirement:
I want to reformat the Date as MM/DD/YYYY i.e. If Month is Sept then it should appear as 09, if date is 8 should appear as 08. If Date is coming as 12/10/2008 then this should not be disturbed. My Constraint is I don't have to write COBOL Pgm. I am Using SORT not able to get the desired result.
2. Having one field, if it is having value as single digit then say '2' need to Reformat this to '02'. If value is 10 then this should not be disturbed. Field Length is 2 & I am getting said Record from File.
For the above stated problems I am writing the Record to Other File & before writing i want to Format the File.
Thanks
Kind Rgds
Vineet Anand |
|
| Back to top |
|
 |
References
|
|
 |
dick scherrer
Global Moderator
Joined: 23 Nov 2006 Posts: 8730 Location: 221 B Baker St
|
|
|
|
Hello,
Which sort product is used on your system?
If you are not sure, run any sort and the product information will be at/near the top of the informational output.
If your system uses DFSORT, this topic will be moved to the DFSORT part of the forum. If some other sort (i.e. Syncsort), it will remain in this part of the forum. |
|
| Back to top |
|
 |
Moved: Wed Sep 10, 2008 11:14 pm by superk From JCL to DFSORT/ICETOOL |
Sambhaji Warnings : 1 Active User
Joined: 16 Feb 2007 Posts: 267 Location: Pune, India
|
|
|
|
I think your input file needs lil reformatting.
Can you paste sample input and desired output in code window that will help to answer better. |
|
| Back to top |
|
 |
dick scherrer
Global Moderator
Joined: 23 Nov 2006 Posts: 8730 Location: 221 B Baker St
|
|
|
|
Hello,
| Quote: |
| I think your input file needs lil reformatting. |
Yes, that is what was requested. . .
Please re-read the original post.
One-digit month or day values need to be made two-digit so that all of the dates (m/dd/yyyy, mm/d/yyyy, m/d/yyyy) are 10 bytes long mm/dd/yyyy in the output. |
|
| Back to top |
|
 |
Sambhaji Warnings : 1 Active User
Joined: 16 Feb 2007 Posts: 267 Location: Pune, India
|
|
|
|
Check if below JCL helps you
Corrections are welcome..
| Code: |
//SORTIN DD *
3/13/2008
3/03/2008
30/4/2008
30/4/2008
1/4/2008
03/04/2008
03/04/2008
/*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(2,1,CH,EQ,C'/'),
BUILD=(1:C'0',2:1,9)),
IFTHEN=(WHEN=(5,1,CH,EQ,C'/'),
BUILD=(1,3,4:C'0',5:4,6))
OUTREC IFTHEN=(WHEN=(5,1,CH,EQ,C'/'),
BUILD=(1,3,4:C'0',5:4,6))
/*
|
Output will be
| Code: |
03/13/2008
03/03/2008
30/04/2008
30/04/2008
01/04/2008
03/04/2008
03/04/2008
|
|
|
| Back to top |
|
 |
dick scherrer
Global Moderator
Joined: 23 Nov 2006 Posts: 8730 Location: 221 B Baker St
|
|
|
|
Hello,
Looks good - thanks for posting
Maybe Vineet will send an update confirming your code works for their requirement. . . |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4613 Location: San Jose, CA
|
|
|
|
Vineet,
You can use a DFSORT job like this to do what you asked for:
| Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
OPTION COPY
INREC PARSE=(%01=(ENDBEFR=C'/',FIXLEN=2),
%02=(ENDBEFR=C'/',FIXLEN=2),
%03=(FIXLEN=4)),
BUILD=(%01,UFF,EDIT=(TT),C'/',
%02,UFF,EDIT=(TT),C'/',
%03)
/*
|
|
|
| Back to top |
|
 |
|
|
|