Thanks again Frank, that does explain what I saw. However, I'm not sure if I understand you correctly: Are you saying that the IFTHEN's which add the SEQNUM in the INREC would move to the OUTREC, but the BUILD of each IFTHEN in the OUTREC would then strip off? How could I both add SEQNUM and remove it at the same time?
Peter -----Original Message----- From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf Of Frank Yaeger Sent: Thursday, March 29, 2012 8:40 PM To: [email protected] Subject: Re: MERGE question: Does SEQNUM restart for each SORTINxx? Peter, As a postscript to my earlier note, I can explain why you are not getting the sequence numbers the way you expected. DFSORT does NOT restart the SEQNUM at 1 for each SORTINxx. However, ... INREC is processed before MERGE. For a MERGE, DFSORT first reads one record from each SORTINxx file. DFSORT reads SORTIN01 record 1 and INREC sets it's SEQNUM to 1. DFSORT reads SORTIN02 record 1 and INREC sets it's SEQNUM to 2. DFSORT reads SORTIN03 record 1 and INREC sets it's SEQNUM to 3. DFSORT reads SORTIN04 record 1 and INREC sets it's SEQNUM to 4. So your DUMMY trailer record (SORTIN04 record 1) gets 4 as it's SEQNUM. If you want the DUMMY trailer record to get the last SEQNUM, you would have to use OUTREC, which which is processed after MERGE to set the SEQNUM, rather than INREC which is processed before MERGE. -- This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail and delete the message and any attachments from your system. ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN

