Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Extracting fields from a delimited file and arranging the f

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Extracting fields from a delimited file and arranging the f
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: 8593
Location: Back in jolly old England

PostPosted: Tue Jul 21, 2009 4:26 pm    Post subject:
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    Post subject:
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 Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Jul 21, 2009 9:00 pm    Post subject:
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    Post subject:
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: 1232
Location: Israel

PostPosted: Wed Jul 22, 2009 12:48 pm    Post subject: Reply to: Extracting fields from a delimited file and arrang
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us