View previous topic :: View next topic
|
Author |
Message |
debojitpal
New User
Joined: 16 Jul 2009 Posts: 5 Location: Chennai
|
|
|
|
Hi.... I have a space delimited file having four fields of the following format
abcdefgh 139 aa 12
asdgfsd 234 ff 98
asdfasdgasdgas 346 gt 34
I know the max length of each field. Is there a way to sort the file such that all the four fields come as separated. Please have a look at the attachment fot the output since if i type it here, the format is not coming properly.
Code: |
abcdefgh 139 aa 12
asdgfsd 234 ff 98
asdfasdgasdgas 346 gt 34 |
edited to take away attachment an tag the data with the CODE TAGS |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Please DO NOT post attachments as not everyone can open them.
This reduces the number of people available to help you. |
|
Back to top |
|
|
debojitpal
New User
Joined: 16 Jul 2009 Posts: 5 Location: Chennai
|
|
|
|
Sorry...but there was formatting problem when i tried to write the output. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
debojitpal,
You can use a DFSORT job like the following to do what you asked for:
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
abcdefgh 139 aa 12
asdgfsd 234 ff 98
asdfasdgasdgas 346 gt 34
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC PARSE=(%01=(ENDBEFR=C' ',FIXLEN=31),
%02=(ENDBEFR=C' ',FIXLEN=4),
%03=(ENDBEFR=C' ',FIXLEN=3),
%04=(FIXLEN=2)),
BUILD=(%01,%02,%03,%04)
/*
|
|
|
Back to top |
|
|
debojitpal
New User
Joined: 16 Jul 2009 Posts: 5 Location: Chennai
|
|
|
|
Frank,
Thanks a bunch...this code worked fine. |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
Nice!
And it works with SYNCSORT (ver 1.3.0) as well! |
|
Back to top |
|
|
|