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

Extracting fields from a delimited file and arranging the f


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

New User


Joined: 16 Jul 2009
Posts: 5
Location: Chennai

PostPosted: Tue Jul 21, 2009 3:13 pm
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue Jul 21, 2009 4:26 pm
Reply with quote

Please DO NOT post attachments as not everyone can open them.

This reduces the number of people available to help you.
Back to top
View user's profile Send private message
debojitpal

New User


Joined: 16 Jul 2009
Posts: 5
Location: Chennai

PostPosted: Tue Jul 21, 2009 5:04 pm
Reply with quote

Sorry...but there was formatting problem when i tried to write the output. icon_sad.gif
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: Tue Jul 21, 2009 9:00 pm
Reply with quote

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
View user's profile Send private message
debojitpal

New User


Joined: 16 Jul 2009
Posts: 5
Location: Chennai

PostPosted: Wed Jul 22, 2009 9:25 am
Reply with quote

Frank,

Thanks a bunch...this code worked fine.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Wed Jul 22, 2009 12:48 pm
Reply with quote

Nice!
And it works with SYNCSORT (ver 1.3.0) as well!
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top