1. Sort Based on the last 4 characters of the Sequence Number
2. Group the H records of a specific category
Ex. First 3 H records are belongs the one category (1 st byte is H and
5 bytes starting from 4 th position is 00001)
in this case we have to get one H record (Seq. No 0003) and 2nd
and 3rd records are added to the first.
H records with the sequence number 0006 and 0007 are of one
H record with the sequence number 0009 is another category
So, in the final output there will be 3 H records.
We have one solution,
1. Split H records into one file (File 1) and other records into the second file (File 2)
2. Sort and Sum H records from File 1 into File 3 as required
3. Merge File 3 and File 2 and SORT based on the Sequence Number
Above will take 3 job steps,
Can we achieve the above in 1 step or 2 steps ?
Thanks in advance for your time and Effort..
Code'd and unpickling of sequence number attempted
You are right. Sorry for the inconvenience caused. Will use code tags going forward.
What I mean to say is,
1. Will separate the input file into two files based on H records and other records.
2. Sort the H records (one H record per category and field values from duplicate records will be added).
3. Sort the above H record's sorted file and other records file based on the Sequence number to produce a single output file.
(As we are merging two files and applying the SORT on sequence number i used the word Merge and SORT...)
As, above takes 3 steps, Is it possible to implement all the above one step or may be in two steps...!
Here F record is not out of the sequence. Its sequence number is 0000 and this makes where ever F records present in the input file, in the final output
F record will be written at the beginning (i.e. first record).
Below is the ICE201I message displayed on the spool..
ICE201I 0 RECORD TYPE IS F - DATA STARTS IN POSITION 1
I am not at the moment trying to provide you with a solution. I am trying to find out what functions you have available with your out-of-date and out-of-support version of DFSORT.
I am not going to attempt/suggest anything for you to turn around and say "nope, that gives me a syntax error", as that is just a waste of time for everyone.
Knowing that you don't have JOINKEYS, my earlier question is moot, but, on your INPUT the F is out of sequence as far as the sequence number is concerned. I fully understand that if you SORT on that sequence number, the position of the record will change. What I wanted to know was, are there any examples of you H records, on the INPUT, not being in ascending order given that there was already an example, the F, of your input not being in sequence number order?
Thanks for your timely responses.
also the other machine, I am using has the below ICE201I message
ICE201I H RECORD TYPE IS F - DATA STARTS IN POSITION 1
Seems, this had the latest patch installed.
So we may use all the possible functions.
Most of the times H records are in sequence and also while grouping we will consider the H record with the least sequence number as base and all the duplicate record's field values are added to that.
For the above 3 H records, H record with the sequence number 0001 taken as base and the final output will be