Flat file to comma delimited file



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

Flat file to comma delimited file

Postby ctrevino » Thu Mar 29, 2012 7:53 pm

I want to use syncsort to convert a flat file to a comma delimited file.

this is my format
xxxxxx123smith john

First field 6 bytes, second field 3 bytes, last two fields both 20 bytes.

I used this parameter but it overwrote data instead of shifting it.
SORT FIELDS=COPY
INREC FIELDS=(1,6,7:C',',8,3,11:C',',12,20,32:C',',33,20)
OUTREC FIELDS=(1,37)

Help?

Christy
Christy T.


Wherever you go, there you are - Buckaroo Banzai
ctrevino
 
Posts: 62
Joined: Tue Feb 23, 2010 1:23 am
Has thanked: 0 time
Been thanked: 0 time

Re: Flat file to comma delimited file

 

Re: Flat file to comma delimited file

Postby BillyBoyo » Thu Mar 29, 2012 8:06 pm

Your are showing name-looking data, so I guess you have two variable-length fields which you want to put into a fixed format.

You need to look at PARSE. You'll find examples in the forum, or using google, or consulting your manual. Maybe even some of your colleagues have used it.

What do you have as your algorithm for making the split? Names can be curious things.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Flat file to comma delimited file

Postby Alissa Margulies » Thu Mar 29, 2012 9:25 pm

PARSE is used to create fixed-length fields from variable-position and variable-length fields. I'm not convinced that this is the answer.

Christy - please provide sample input records and sample records of your desired output. This will better help us determine exactly what you are attempting to accomplish. Thank you.
Alissa Margulies
Syncsort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Alissa Margulies
Global moderator
 
Posts: 369
Joined: Tue Feb 26, 2008 11:15 pm
Location: USA
Has thanked: 1 time
Been thanked: 1 time

Re: Flat file to comma delimited file

Postby BillyBoyo » Thu Mar 29, 2012 9:56 pm

Sorry Alissa. I just "quoted and coded" and the fields are already fixed (in as much as one example can show that). Sorry for not checking earlier, as you probably did.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Flat file to comma delimited file

Postby ctrevino » Fri Mar 30, 2012 12:49 am

sorry. my example got squished on me.

Here is an example:

XXXXXXAAAFFFFFFFFFFFFFFFFFFFFLLLLLLLLLLLLLLLLLLLL

I need commas in between the fields without loss of data. No comma at end.

My code is overlaying like this:
XXXXX,AA,FFFFFFFFFFFFFFFFFFFFF,LLLLLLLLLLLLLLLLLL
Christy T.


Wherever you go, there you are - Buckaroo Banzai
ctrevino
 
Posts: 62
Joined: Tue Feb 23, 2010 1:23 am
Has thanked: 0 time
Been thanked: 0 time

Re: Flat file to comma delimited file

Postby Alissa Margulies » Fri Mar 30, 2012 1:42 am

Hello Christy.

If you just want to insert commas between fixed-length fields, then try the following:

//STEP1 EXEC PGM=SORT                               
//SYSOUT  DD SYSOUT=*                               
//SORTIN  DD *                                       
XXXXXXAAAFFFFFFFFFFFFFFFFFFFFLLLLLLLLLLLLLLLLLLLL   
//SORTOUT DD SYSOUT=*                               
//SYSIN   DD *                                       
   SORT FIELDS=COPY                                 
   OUTREC BUILD=(1,6,C',',7,3,C',',10,20,C',',30,20)
/*                                                   

Here is the output produced by the above step:
XXXXXX,AAA,FFFFFFFFFFFFFFFFFFFF,LLLLLLLLLLLLLLLLLLLL
Alissa Margulies
Syncsort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Alissa Margulies
Global moderator
 
Posts: 369
Joined: Tue Feb 26, 2008 11:15 pm
Location: USA
Has thanked: 1 time
Been thanked: 1 time

Re: Flat file to comma delimited file

Postby ctrevino » Fri Mar 30, 2012 5:25 pm

worked perfect. Thanks.:)
Christy T.


Wherever you go, there you are - Buckaroo Banzai
ctrevino
 
Posts: 62
Joined: Tue Feb 23, 2010 1:23 am
Has thanked: 0 time
Been thanked: 0 time


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post