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)
/*

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

Reply via email to