Once again your solution amazes me with its elegance, simplicity and 
efficiency, if only because I could not conceive of it before you proposed it.

Thank you!

Peter

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf Of 
Frank Yaeger
Sent: Friday, March 30, 2012 1:35 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:35:35 AM:
> One further question about this technique -- If possible, I would
> like to have the DATE field in the trailer contain the same business
> processing date as the only selected header record.  Is there any
> way in SORT to "save" the date value from the header record and
> propagate that date to the trailer?  That header date is NOT
> necessarily the current system date (e.g., on weekends and
> holidays), so I cannot just use the "current" date to fill the
> trailer date field.

There are several ways to do that with DFSORT, but the easiest way
is to generate a symbol for the target date from that first record.
Here's the DFSORT job for that:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file 1 (VB)
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
  OPTION COPY,STOPAFT=1
  OUTFIL VTOF,BUILD=(C'TARGDATE,''',22,6,C'''',80:X)
//S2 EXEC PGM=SORT
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SYSOUT DD SYSOUT=*
//SORTIN01 DD DSN=...  input file 1 (VB)
//SORTIN02 DD DSN=...  input file 2 (VB)
//SORTIN03 DD DSN=...  input file 3 (VB)
//SORTOUT DD DSN=...  output file (VB)
//SYSIN DD *
   OPTION VLSCMP,VLSHRT
   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,3,CH,A),EQUALS
   OUTFIL REMOVECC,
    TRAILER1=(C'999FILE TLR CNT=',
      COUNT-1=(TO=ZD,LENGTH=11),
      C',DATE=',TARGDATE)
/*
--


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