Posted: Thu Sep 11, 2025 12:27 pm Post subject: Help with INREC Overlapping Columns & SEQNUM for Groupin
I'm working with a 260-byte fixed-length input file and need to identify the least record (based on a group of key fields). The goal is to split the file into two outputs:
One with the least record from each group (OUTLEAST) first 3 fields
Another with the remaining records (OUTOTHER)
I'm trying to use INREC BUILD to append the sort keys and a SEQNUM to the record, and then use RESTART on the composite key to determine group boundaries. However, I'm encountering an error:
"INREC has overlapping columns specified" or sometimes "no keywords found on control statement".
235,26 is the timestamp field, need to the select the least timestamp record to first file for each key of 3,12,CH,A,15,5,CH,A,36,3,CH,A and other records to the second file
Code:
SORT FIELDS=(3,12,CH,A,15,5,CH,A,36,3,CH,A,235,26,CH,A)
INREC BUILD=(
1:1,260, * Original input record (1?260)
261:3,12, * Key 1
273:15,5, * Key 2
278:36,3, * Key 3
281:SEQNUM,8,ZD,START=1,RESTART=(261,20)) * Seq num (restart when full key changes)
OUTFIL FNAMES=OUTLEAST,INCLUDE=(281,8,ZD,EQ,1),BUILD=(1,260),REMOVECC
OUTFIL FNAMES=OUTOTHER,INCLUDE=(281,8,ZD,GT,1),BUILD=(1,260),REMOVECC
Joined: 26 Nov 2002 Posts: 12385 Topics: 75 Location: San Jose
Posted: Sat Sep 13, 2025 11:54 am Post subject:
Suchay,
A few issues.
1. Your first attempt failed because you are using BUILD which cannot see the new fields that you added at the end of the record.
2. You are adding the new key on INREC which is processed before SORT. your sequence number will be reset to 1 as the keys are NOT sorted.
example data as input keys
Code:
ABC
ABC
DEF
ABC
Now the 3rd ABC will also get a Sequence number of 1 because the previous key is DEF.
So you need to add the sequence number AFTER SORT ie on OUTREC
3. Since you are adding the temp fields at the end you are increasing the length of the record and that would also increase the resources needed to sort the records. Your input has LRECL of 260 but with INREC you increased the length 307 which is ~16% increase and that would require more resources to sort the data.
4. You also are NOT removing the temporary fields that you added at the end of the record as you are writing the entire record that you built using INREC.
so ideally your control cards ( untested ) should be
Alternatively you can use ICETOOL select operator to do this without the need of adding the sequence number and then splitting the files into Unique and duplicates
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum