View previous topic :: View next topic
|
Author |
Message |
Nitin Bhargava
New User
Joined: 22 May 2012 Posts: 32 Location: india
|
|
|
|
Hi,
I am having an input file in which date is in format mm/dd/yyyy. I need to change it in mmddyyyy format using sort or icetool.
Input file looks like
Code: |
1/1/1965
11/11/1965
12/1/1970
10/21/2001 |
The output i am expecting is
Code: |
01011965
11111965
12011970
10212001 |
File is a FB with lenght 80
I am thinking to use change command in it, but it seems to be more lenghty. Do we have any direct approach for it in sort. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
the PARSE clause will provide the way
You have already received at least one reply with a PARSE example |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
What do you have after YYYY?
Is it space or anything else? |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Nitin Bhargava,
Use the following DFSORT JCL which will give you the desired results
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
1/1/1965
11/11/1965
12/1/1970
10/21/2001
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC PARSE=(%01=(ENDBEFR=C'/',FIXLEN=2),
%02=(ENDBEFR=C'/',FIXLEN=2),
%03=(FIXLEN=4)),
BUILD=(%01,UFF,EDIT=(TT),%02,UFF,EDIT=(TT),%03,2X,11,70)
//* |
|
|
Back to top |
|
|
Nitin Bhargava
New User
Joined: 22 May 2012 Posts: 32 Location: india
|
|
|
|
Thanks Skolusu,
Just needed one more suggestion.
Orignally as per my requirement the date starts from 70th position. From 1 to 69 there are some other fields and after date field some other fields are present. Total file size is 1000.
Example
Code: |
001 ROHIT SINGHAI 1/1/1962 NEWYORK
002 NITESH JHA 21/1/2003 INDIA |
I modified the sort card suggested by you as follows:
Quote: |
INREC PARSE=(%01=(ENDBEFR=C'/',FIXLEN=2),
%02=(ENDBEFR=C'/',FIXLEN=2),
%03=(FIXLEN=4)),
BUILD=(1,69,70,%01,UFF,EDIT=(TT),%02,UFF,EDIT=(TT),
%03,79,800) |
The problem here is that i am getting output date record
Quote: |
001 ROHIT SINGHAI 00011962 NEWYORK
002 NITESH JHA 00012003 INDIA |
How to remove this zero from output.
[/quote] |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
Nitin Bhargava wrote: |
Example
Code: |
001 ROHIT SINGHAI 1/1/1962 NEWYORK
002 NITESH JHA 21/1/2003 INDIA |
|
So when you said
Quote: |
I am having an input file in which date is in format mm/dd/yyyy. |
you were lying |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Nitin Bhargava,
You are provided with a solution that specifically caters to what you described in your first post, and now you show a completely different input and you hope that it works? Please outline your complete requirement instead of giving me bits and pieces of information. I can't keep on working on your problems every time you change the input/rules.
And for the record with your new input it is reading the first 2 bytes of the sequence number in your input for the month. Search for ABSPOS in the DFSORT application programming guide and see how you can implement it into your control cards. |
|
Back to top |
|
|
|