Hi,
I have a requirement that a FB LRECL 496
has records [in which the values are separated by comma] like
lets say for ex there are 5 records in the file
1) A,B,C,D,E,F,G
2) A,B,C,D,E,F1,G1
3) A,B,C,D,E,F1,G2
4) A,B,C,D,E,F2,G1
5) A,B,C,D,E,F2,G2
6) A,B1,C,D,E,F,G
7) A,B1,C,D,E,F2,G2
After the conversion job it should become
1) A,B,C,D,E,F,G
2) ,,,,,F1,G1
3) ,,,,,,G2
4) ,,,,,F2,G1
5) ,,,,,,G2
6) A,B1,C,D,E,F,G
7) ,B1,C,D,E,F2,G2
Hope I am able to convey what I need. Please let me know is it
possible to do via DFSORT.
Thanks
Nimesh
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
It looks like you want to check each record against the previous record and substitute a comma for the fields up to the field that's different. But for:
5) A,B,C,D,E,F2,G2
6) A,B1,C,D,E,F,G
you have as output:
6) A,B1,C,D,E,F,G
Why wouldn't it be:
6) ,B1,C,D,E,F,G
since the A's match?
What do you want for output if all of the fields match, e.g.
7) A,B1,C,D,E,F2,G2
8) A,B1,C,D,E,F2,G2
What would the output record for 8) be?
Please explain the "rules" you want to use clearly.
Does 1) etc actually appear in the record or does the first field start in position 1?
Also, what is the actual minimum and maximum length of the fields (min=1, max=2 as shown in your example or something else?).
point 1: apologies it should actually read as
1) A,B,C,D,E,F,G
2) ,,,,,F1,G1
3) ,,,,,,G2
4) ,,,,,F2,G1
5) ,,,,,,G2
6) ,B1,C,D,E,F,G
7) ,,,,,F2,G2
point 2: for a duplicate condition
7) A,B1,C,D,E,F2,G2
8) A,B1,C,D,E,F2,G2
the last record should be eliminated I thought about this before
and thought if I sort unique records first this condition would never occur
point 3:
1), 2) are not there in the actual file its just that I put them to sequence the
records for understanding the file would actually be
A,B,C,D,E,F,G
A,B,C,D,E,F1,G1
A,B,C,D,E,F1,G2
A,B,C,D,E,F2,G1
A,B,C,D,E,F2,G2
A,B1,C,D,E,F,G
A,B1,C,D,E,F2,G2
point 4: there is no max or min length of the fields its acutally a .csv file
generated by a program and LRECL is given the maximum length of all fields combined
the fields would be separated by a delimiter ','.
The file format would always be FB both input and output.
point 5: the rules for output file would be a hierarchial formation as I explained in the
example above. The comma separated values can be nullable too
ex
A,B,C,D,E,F,G
A,B,C,D,,F1,G1
A,B,C,D,E,,G2
would become
A,B,C,D,E,F,G
,,,,,F1,G1
,,,,,,G2
Please let me know in case this information is insufficient.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Hmmm ... I think I might know a way to do this with DFSORT/ICETOOL. But I don't want to waste time on a solution you won't be able to use. So before I work on it, I need some more information.
1) The solution will require DFSORT's PARSE function, so you need the April, 2006 DFSORT PTF. Do you have it? If you don't know, run this DFSORT job and look at the ICE201I message you get in //SYSOUT.
If you see:
ICE201I E
then you have the PTF and we can proceed. If you see:
ICE201I 0
then you don't have the PTF. Let me know either way.
2)
Quote:
point 4: there is no max or min length of the fields its acutally a .csv file
generated by a program and LRECL is given the maximum length of all fields combined
the fields would be separated by a delimiter ','.
The file format would always be FB both input and output.
Ok, it's a CSV file with 7 fields (right?), but each field still has to have a maximum length. The largest FB record is 32760 bytes so the total length of all of the fields can't exceed that. So is the maximum length for each field 20 bytes or 100 bytes or 1000 bytes or what? If different fields have different maximums, what are they? If all of the total of all of the maximum lengths is more than about 15000 bytes, my solution probably won't work.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Yes, you have the PTF. But you didn't answer the other questions I asked previously:
Quote:
Ok, it's a CSV file with 7 fields (right?), but each field still has to have a maximum length. The largest FB record is 32760 bytes so the total length of all of the fields can't exceed that. So is the maximum length for each field 20 bytes or 100 bytes or 1000 bytes or what? If different fields have different maximums, what are they? If all of the total of all of the maximum lengths is more than about 15000 bytes, my solution probably won't work.
The total length of the file 496 (=LRECL), and individual fields would not exceed the maximum. Infact the max length of the fields would be
A = 13
B = 35
C = 24
D = 33
E = 34
F = 32
G = 11
Thanks
Nimesh