Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
Every time you use SEQNUM it is a different one.
So, if you have SEQNUM on WHEN=INIT, inserted at the beginning of your records (because your records are variable) (unless there is an "unused" portion of the fixed part of the record you could re-use temporarily) and then with the WHEN=(condition) copy the added field to where you want it for that particular record-type.
After each record is processed, you have to "clean up" the now surplus SEQNUM, with BUILD,
Try the following steps.
Step-1: Number all records
Step-2: using overlay as u have tried, write the output record based on conditions.
Example:
input :
1234561240
1234561644
expected output :
add seq number in 7th position( before 1240) for 1240, 11th position(after 1644) for 1644 condition
123456000000011240
123456164400000002
Step1 o/p : (added seq number at starting 1-8 position)
000000011234561240
000000021234561644
Step2 o/p: based on condition
123456000000011240
123456164400000002