Comma delimited to fixed width space delimited



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Comma delimited to fixed width space delimited

Postby cbrio » Mon Aug 09, 2010 3:08 am

Hi,

Can DFSORT reformat a comma delimited file to fixed width space delimited file (where each occurrence of a variable starts in the same position, e.g. ID begins in position 1, last name begins in position 11, first name begins in position 22 and so on?

Input:

231454689,Smith,Mary,02261958
365478965,Harrison,Henry,04191978
365987410,Albertson,Maribel,01232001

Desired result:

231454689bSmithbbbbMarybbb02261958
365478965bHarrisonbbHenrybb12191978
365987410bAlbertsonbMaribelb01232001

(where b=blank)

Thanks.
Cindy
cbrio
 
Posts: 15
Joined: Thu Apr 17, 2008 11:34 am
Has thanked: 0 time
Been thanked: 0 time

Re: Comma delimited to fixed width space delimited

 

Re: Comma delimited to fixed width space delimited

Postby skolusu » Mon Aug 09, 2010 9:06 pm

cbrio,

Your input does not match output, especially for the second record. How did the 04191978 transform into 12191978 ? for the last field? Assuming that it is a typo, the following DFSORT JCL will give you the desired results.

//STEP0100 EXEC PGM=SORT                         
//SYSOUT   DD SYSOUT=*                           
//SORTIN   DD *                                 
231454689,SMITH,MARY,02261958                   
365478965,HARRISON,HENRY,04191978               
365987410,ALBERTSON,MARIBEL,01232001             
//SORTOUT  DD SYSOUT=*                           
//SYSIN    DD *                                 
  SORT FIELDS=COPY                               
  INREC PARSE=(%00=(ENDBEFR=C',',FIXLEN=10),     
               %01=(ENDBEFR=C',',FIXLEN=10),     
               %02=(ENDBEFR=C',',FIXLEN=10),     
               %03=(FIXLEN=10)),                 
        BUILD=(%00,%01,%02,%03)                 
//*


The output from this is

231454689 SMITH     MARY      02261958
365478965 HARRISON  HENRY     04191978
365987410 ALBERTSON MARIBEL   01232001
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: Comma delimited to fixed width space delimited

Postby cbrio » Tue Aug 24, 2010 12:41 am

Thank you very much for your help. This is exactly what I was looking for.
Do I correctly assume that the fixlen parameter can be any number I want and does not have to be the same for each field?
cbrio
 
Posts: 15
Joined: Thu Apr 17, 2008 11:34 am
Has thanked: 0 time
Been thanked: 0 time

Re: Comma delimited to fixed width space delimited

Postby Frank Yaeger » Tue Aug 24, 2010 1:16 am

Do I correctly assume that the fixlen parameter can be any number I want and does not have to be the same for each field?


Any number you want from 1 to 32752. FIXLEN should be the maximum possible length for each field and can be different for each field.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post