How to Write Fixed length file as Variable Length file?



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

How to Write Fixed length file as Variable Length file?

Postby pjagathis » Wed May 04, 2011 5:16 pm

I am having fixed length file as follows

AAAAAAAA BBBB AAA
AAAAAAAA BBBBB AAA
AAAAAAAA BBBB A
AAAAAAAA BBBBB AAA
AAAAAAAA BB AA
AAAAAAAA BB AAA
AAAAAAAA BB AA
AAAAAAAA BB AAA
AAAAAAAA BB
AAAAAAAA BB AAA
AAAAAAAA BB

I need as Varialble length file with delimiter as follows..

AAAAAAAA|BBBB|AAA|
AAAAAAAA|BBBBB|AAA|
AAAAAAAA|BBBB|A|
AAAAAAAA|BBBBB|AAA|
AAAAAAAA|BB|AA|
AAAAAAAA|BB|AAA|
AAAAAAAA|BB|AA|
AAAAAAAA|BB|AAA|
AAAAAAAA||AAA|
AAAAAAAA|BB|AAA|
AAAAAAAA|BB||

Regards,
Jagathis P
Thanks and Regards,
Jagathis P
pjagathis
 
Posts: 67
Joined: Wed May 04, 2011 5:04 pm
Location: Chennai
Has thanked: 0 time
Been thanked: 0 time

Re: How to Write Fixed length file as Variable Length file?

Postby Alissa Margulies » Fri May 06, 2011 12:28 am

Your input file appears to be variable as well. Please use code tags so that we can see the actual record layout. If all you want to do is change the delimiter from a blank to a pipe, then you can use FINDREP.
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: 3 times

Re: How to Write Fixed length file as Variable Length file?

Postby pjagathis » Thu May 26, 2011 10:43 am

Alissa, thanks for your reply..

See my input file

Each field has fixed length.
Eg, Field1 starts from position 1 and ends @ 8.
Field2 starts from position 9 and ends @ 17 and so on..

I need a ouput as variable length file
Field-1 Field2 Field3
AAAAAAAA BBBB AAA
AAAAAAAA BBBBB AAA
AAAAAAAA BBBB A
AAAAAAAA BBBBB AAA
AAAAAAAA BB AA
AAAAAAAA BB AAA
AAAAAAAA BB AA
AAAAAAAA BB AAA
AAAAAAAA BB
AAAAAAAA BB AAA
AAAAAAAA BB


need as Varialble length file with delimiter as follows..

AAAAAAAA|BBBB|AAA|
AAAAAAAA|BBBBB|AAA|
AAAAAAAA|BBBB|A|
AAAAAAAA|BBBBB|AAA|
AAAAAAAA|BB|AA|
AAAAAAAA|BB|AAA|
AAAAAAAA|BB|AA|
AAAAAAAA|BB|AAA|
AAAAAAAA||AAA|
AAAAAAAA|BB|AAA|
AAAAAAAA|BB||


Thanks,
Jagathis P
Thanks and Regards,
Jagathis P
pjagathis
 
Posts: 67
Joined: Wed May 04, 2011 5:04 pm
Location: Chennai
Has thanked: 0 time
Been thanked: 0 time

Re: How to Write Fixed length file as Variable Length file?

Postby NicC » Thu May 26, 2011 1:18 pm

See my input file

This shows as varying length - example:
AAAAAAAA BB aaaa
AAAAAAAA BB AAA
so your second field looks as though it is 2 bytes (in this case - other examples show 4 and 5 bytes)

If you posted with multiple spaces then, unless you use code tags (square brackets with code and /code within them at start and end) then spacing i not preserved.
AAAAAAAA BB      aaa
AAAAAAAA BB      AAA

Use the Full Editor button (available after you start a Quick Reply) to make it easier
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: How to Write Fixed length file as Variable Length file?

Postby pjagathis » Thu May 26, 2011 3:30 pm

Hi Nic,

My input file is fixed length FB file but i need output as variable length FB file..

Field-1   Field2        Field3
AAAAAAAA BBBB       AAA
AAAAAAAA BBBBB      AAA
AAAAAAAA BBBB       A
AAAAAAAA BBBBB      AAA
AAAAAAAA BB         AA
AAAAAAAA BBBBBB     AAA
AAAAAAAA BB         AA
AAAAAAAA BB         AAA
AAAAAAAA BBBBB
AAAAAAAA BB         AAA
AAAAAAAA BBBBB      AAAAAAAA


Thanks and Regards,
Jagathis P
pjagathis
 
Posts: 67
Joined: Wed May 04, 2011 5:04 pm
Location: Chennai
Has thanked: 0 time
Been thanked: 0 time

Re: How to Write Fixed length file as Variable Length file?

Postby BillyBoyo » Thu May 26, 2011 7:08 pm

pjagathis wrote:Hi Nic,

My input file is fixed length FB file but i need output as variable length FB file..

[...]


I guess you mean a VB, a blocked dataset with variable length records?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: How to Write Fixed length file as Variable Length file?

Postby NicC » Thu May 26, 2011 9:27 pm

Variable or Fixed - you cannot have them both - they are mutually exclusive.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: How to Write Fixed length file as Variable Length file?

Postby Alissa Margulies » Fri May 27, 2011 1:23 am

Hello PJAGATHIS.

Based on your field descriptions, try this and let me know if it gives you the desired output:
//STEP1 EXEC PGM=SORT                                         
//SYSOUT  DD SYSOUT=*                                         
//SORTOUT DD SYSOUT=*                                         
//SORTIN  DD *                                                 
AAAAAAAABBBB    AAA                                           
AAAAAAAABBBBB   AAA                                           
AAAAAAAABBBB    A                                             
AAAAAAAABBBBB   AAA                                           
AAAAAAAABB      AA                                             
AAAAAAAABB      AAA                                           
AAAAAAAABB      AA                                             
AAAAAAAABB      AAA                                           
AAAAAAAABB                                                     
AAAAAAAABB      AAA                                           
AAAAAAAABB                                                     
//SYSIN   DD *                                                   
  SORT FIELDS=COPY                                               
  OUTFIL IFTHEN=(WHEN=INIT,BUILD=(1,8,C'|',9,8,C'|',17,8,C'|')),
         IFTHEN=(WHEN=INIT,BUILD=(1,27,SQZ=(SHIFT=LEFT))),FTOV                                       
/*

This will convert your fixed length fields in fixed length records to variable length fields in variable length records. If you want variable length fields but wish to maintain fixed length records, then remove the FTOV parameter on the OUTFIL statement.
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: 3 times

Re: How to Write Fixed length file as Variable Length file?

Postby pjagathis » Wed Jun 01, 2011 3:55 pm

Hi Alissa Magulies,

Thanks!! Its working fine. Prevoiusly we do it in SAS.
Thanks and Regards,
Jagathis P
pjagathis
 
Posts: 67
Joined: Wed May 04, 2011 5:04 pm
Location: Chennai
Has thanked: 0 time
Been thanked: 0 time

Re: How to Write Fixed length file as Variable Length file?

Postby pjagathis » Thu Jun 16, 2011 4:47 pm

HI Alissa Maguiles,

One More help.....

Below code removing spaces within the fileds

For example,

4917 WWW BBBBB LN           |AAA  AAAAA  AAAA   |
15575 SSSSS HHYR            |BBB BBBB BBBB      |         
6357 OOOO OOOO OO           |CCC CCC CCC        |
16 COOOOO SSSSSS            |SDSDSD SDSDSD      |         
1523 45TH ST                |GHGHG   GHGG       |


In the above example, after converting to variable length file, I want to kept the space between words to be as.

as below,

4917 WWW BBBBB LN|AAA  AAAAA  AAAA|
15575 SSSSS HHYR |BBB BBBB BBBB|         
6357 OOOO OOOO OO|CCC CCC CCC|
16 COOOOO SSSSSS |SDSDSD SDSDSD|         
1523 45TH ST |GHGHG   GHGG|


I want to keep the space between "4917 WWW BBBBB LN" as it is.. Only I have to remove the spaces between fields.
Please advice...
Thanks and Regards,
Jagathis P
pjagathis
 
Posts: 67
Joined: Wed May 04, 2011 5:04 pm
Location: Chennai
Has thanked: 0 time
Been thanked: 0 time

Next

Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post