View previous topic :: View next topic
|
Author |
Message |
Rajesh Haridoss
New User
Joined: 22 Feb 2014 Posts: 16 Location: India
|
|
|
|
Hi, Greetings to all. This is my first post.
I have a file with LRECL 7508 and the records in below format.
Field1 : 8 bytes, alphanumeric
Field2 : 7500 bytes , alphanumeric
Input will be like this
ab123456zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
bcd12345aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
My output file should be in length of 258 bytes, where field1 will be 8 bytes and field 2 should be split in multiples of 250 bytes like below. The records should be split like first line will have 258 bytes and the second line should have first 8 bytes as dots (.) and 250 bytes of field2. Instead of dots(.), spaces are also fine.
Output should be like this:
ab123456zzzzzzzzzzzzz
........zzzzzzzzzzzzz
........zzzzzzzzzzzzz
........zzzzzzzzzzzzz
cd123456aaaaaaaaaaaaa
........aaaaaaaaaaaaa
........aaaaaaaaaaaaa
........aaaaaaaaaaaaa
........aaaaaaaaaaaaa
In syncsort, we do not have RESIZE option like in DFSORT. So we need to do this split without resize option. I can use newline operator '/' to achieve this but I need to use this for 30 times for 7500 length record.
Your suggestions are welcome and thanks in advance.
Regards,
Rajesh |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
Your suggestions are welcome and thanks in advance. |
if You had started typing instead of posting You would have finished by now
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Without RESIZE what you've already suggested is what I'd do. So take enrico's accurate advice.
Code: |
BUILD=(1,8,0009,250,
/,
8C'.',0259,250,
/,
8C'.',0259,250,
..... |
Really easy to R(epeat) in the editor and then type - you can even generate the statements with rexx/SORT/whatever. Edit macro. Once you have one, useful for other tasks.
You can also improve things using symbols/SYMNAMEs. |
|
Back to top |
|
|
Rajesh Haridoss
New User
Joined: 22 Feb 2014 Posts: 16 Location: India
|
|
|
|
Hi Enrico and bill,
Thanks for the quick reply. The idea behind why I am not using the '/' operator is we are thinking of increasing the size of field2 to 32000 bytes. So I need some other method which can be used to split the records. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Well, there's always a programming language instead of SORT.
Do you mean 32,0008? Or will the last split record be short?
You are going to have this dataset on tape, or waste a lot of space with it?
Seriously, generate the cards, use symbols/SYMNAMES so you have a generic solution. Where's the problem? |
|
Back to top |
|
|
Rajesh Haridoss
New User
Joined: 22 Feb 2014 Posts: 16 Location: India
|
|
|
|
Input file LRECL will be 32008. Could you please give me an example to use symbols/SYMNAMES in this case?. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Code: |
//SYMNAMES DD *
KEY-VALUE,*,8,CH
DATA-001,*,250,CH
DATA-002,*,250,CH
DATA-003,*,250,CH
...
KEY-MASKS,8C' '
//SYMNOUNT DD SYSOUT=*
OUTFIL BUILD=(KEY-VALUE,DATA-001,
/,
KEY-MASKS,DATA-002,
/,
KEY-MASKS,DATA-003,
..... |
Do the necessary, either by hand or auotmation, then you have something which you can quickly change the sizes on, the content of the mask, whatever, without having to calculate a single position yourself. |
|
Back to top |
|
|
Rajesh Haridoss
New User
Joined: 22 Feb 2014 Posts: 16 Location: India
|
|
|
|
Thanks bill!!..This helps me. |
|
Back to top |
|
|
Rajesh Haridoss
New User
Joined: 22 Feb 2014 Posts: 16 Location: India
|
|
|
|
In the same input with 32000 byte LRECL, There is possibility that lot of bytes will be spaces. when I get no data/spaces for the 250 bytes while splitting the record or after splitting the records, I will get lot of empty lines. I need to remove those empty lines in the output file.I need to remove those empty lines in the same step/sort card. Any suggestions are welcome. |
|
Back to top |
|
|
|