I see now what you meant.

I agree that the TRAILER1 solution is much simpler, so I intend to use that 
combined with the generated symbol solution you previously described.

Thanks once again for all of your excellent help.

Peter

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf Of 
Frank Yaeger
Sent: Friday, March 30, 2012 1:54 PM
To: [email protected]
Subject: Re: MERGE question: Does SEQNUM restart for each SORTINxx?

Peter Farley at IBM Mainframe Discussion List <[email protected]> wrote
on 03/30/2012 06:41:17 AM:
> 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?

Like this:

  OPTION VLSHRT,VLSCMP
  OMIT COND=(((5,3,CH,EQ,C'000'),AND,     OMIT(HEADER RECORD AND
             (34,5,CH,NE,C'FILE1')),OR,        NOT FILE1) OR
             (5,3,CH,EQ,C'999'))              TRAILER RECORD)
  MERGE  FIELDS=(5,03,CH,A),
        EQUALS,FILES=4                       SORTIN01 TO 04
* ADD SEQNUM BETWEEN RDW AND DATA.
 OUTREC IFTHEN=(WHEN=INIT,BUILD=(1,4,5:SEQNUM,11,ZD,16:5)),
* USE SEQNUM-2 TO PUT COUNT OF DATA RECORDS INTO
* DUMMY TRAILER RECORD (IDENTIFIED BY X'FAFAFA').
        IFTHEN=(WHEN=(16,3,CH,EQ,X'FAFAFA'),
             BUILD=(1,4,19,13,5,11,ZD,SUB,+2,M11,LENGTH=11,43)),
        IFTHEN=(WHEN=NONE,BUILD=(1,4,5:16))

Alternatively, you could use OUTREC to build the records with
the SEQNUM, and OUTFIL to remove the SEQNUM like this:

  OPTION VLSHRT,VLSCMP
  OMIT COND=(((5,3,CH,EQ,C'000'),AND,     OMIT(HEADER RECORD AND
             (34,5,CH,NE,C'FILE1')),OR,        NOT FILE1) OR
             (5,3,CH,EQ,C'999'))              TRAILER RECORD)
  MERGE  FIELDS=(5,03,CH,A),
        EQUALS,FILES=4                       SORTIN01 TO 04
* ADD SEQNUM BETWEEN RDW AND DATA.
 OUTREC IFTHEN=(WHEN=INIT,BUILD=(1,4,5:SEQNUM,11,ZD,16:5)),
* USE SEQNUM-2 TO PUT COUNT OF DATA RECORDS INTO
* DUMMY TRAILER RECORD (IDENTIFIED BY X'FAFAFA').
      IFTHEN=(WHEN=(16,3,CH,EQ,X'FAFAFA'),
                OVERLAY=(32:5,11,ZD,SUB,+2,M11,LENGTH=11))
  OUTFIL BUILD=(1,4,5:16)

However, I would suggest using my TRAILER1 job as it's simpler.

Frank Yaeger - DFSORT Development Team (IBM) - [email protected]
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration

 => DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

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

Reply via email to