Peter,

I'm not sure exactly what you're trying to do, but I can think of two ways
to get a count like that.

One would be to use an IFTHEN WHEN=INIT clause in each OUTFIL before the
other
IFTHEN clauses to insert the sequence number (of course, you have to adjust
the positions in
the subsequent IFTHEN clauses).

The other would be to use COUNT-2=(edit) in TRAILER1 for each OUTFIL.

If you want more help with this, feel free to send me more details offline
(yae...@us.ibm.com):

Please show an example of the records in each input file (relevant fields
only) and what you
expect for output.  Explain the "rules" for getting from input to output.
Give the starting position,
length and format of each relevant field.  Give the RECFM and LRECL of the
input files.  If file1
can have duplicates within it, show that in your example.  If file2 can
have duplicates within it,
show that in your example.

Frank Yaeger - DFSORT Development Team (IBM) - yae...@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration

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

Peter Farley on IBM Mainframe Discussion List <IBM-MAIN@bama.ua.edu> wrote
on 09/15/2011 11:09:13 AM:
> From: "Farley, Peter x23353" <peter.far...@broadridge.com>
> To: IBM-MAIN@bama.ua.edu
> Date: 09/15/2011 11:10 AM
> Subject: DFSORT JOINKEYS question: Where to put INREC and OUTREC?
> Sent by: IBM Mainframe Discussion List <IBM-MAIN@bama.ua.edu>
>
> I have developed a JOINKEYS application, but I need to do one more
> function as part of the process, if it is possible.
>
> I am joining two VB files on 2 keys in the fixed part of the VB
> records and using OUTFIL statements to split the result into
> multiple output files.  In each of the output files there is a
> header record (key values = all X'00') and a trailer record (key
> values = all X'FF').
>
> I also want to insert a "true record count" into each trailer record
> in each output file, i.e. a record count that excludes the header
> and trailer records in a particular output file.
>
> Frank Yaeger already helped me in a prior email to construct a way
> to produce this count for a single-file COPY operation using an
> INREC and an OUTREC, which would require a separate pass over each
> output file.  This is that function:
>
>   OPTION COPY
> * ADD SEQNUM BETWEEN RDW AND DATA.
>   INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,5:SEQNUM,11,ZD,16:5)),
> * USE SEQNUM-2 TO PUT COUNT OF DATA RECORDS IN
> * LAST RECORD (IDENTIFIED BY X'FF').
>       IFTHEN=(WHEN=(16,1,BI,EQ,X'FF'),
>          OVERLAY=(160:5,11,ZD,SUB,+2,M11,LENGTH=11))
> * REMOVE SEQNUM.
>   OUTREC BUILD=(1,4,5:16)
>
> Below is a sanitized version of my JOINKEYS application with just
> two of the OUTFIL statements as an example.
>
> My question is, where do I place the INREC above to accomplish the
> insertion of the SEQNUM fields for each record in each OUTFIL such
> that each OUTFIL has the correct record count in the trailer record?
> If I could do that, I could adjust the BUILD parameters in the
> OUTFIL statements to remove the SEQNUM inserted by the INREC.
>
> I did try just adding the INREC/OUTREC following the SORT statement,
> but that results in a trailer count for the entire JOINed file, not
> individually for each OUTFIL file.
>
> Can this be done in one pass?  Or do I need a separate "trailer
> count" pass for each output file?
>
> Sanitized JOINKEYS application:
>
>  OPTION VLSCMP,VLSHRT
> * SPECIFY JOIN RECORD RETENTION
>  JOIN UNPAIRED,F2
> * SPECIFY THE JOIN KEYS FOR FILE 1 AND 2
>  JOINKEYS FILE=F1,FIELDS=(21,3,A,83,25,A)
>  JOINKEYS FILE=F2,FIELDS=(21,3,A,83,25,A)
> * SPECIFY REFORMAT FOR FILE 1 AND 2
> * POSITIONS 1-2 OF ALL INPUT DATA RECORDS (VB POS 5-6) ALWAYS CONTAIN
'D1'
> * POSITION 106 (VB POS 110) OF F1 DATA RECORDS ALWAYS CONTAINS 'J'
> * POSNS 1-2 AND 106 (VB POS 506 AND 110) OF HEADER  RECORDS CONTAIN X'00'
> * POSNS 1-2 AND 106 (VB POS 506 AND 110) OF TRAILER RECORDS CONTAIN X'FF'
>  REFORMAT FIELDS=(F2:1,4,F1:110,1,F2:6)
>  SORT FIELDS=COPY
> * THIS SELECTS ONLY MATCHED RECORDS
> * AND HEADER/TRAILER RECORDS
> * OUTPUT RECORD BUILD CHANGES THE 'J' BACK TO 'D'
>  OUTFIL FNAMES=OUT1,INCLUDE=((5,2,CH,EQ,C'J1'),OR,
>                              (5,2,CH,EQ,X'0000'),OR,
>                              (5,2,CH,EQ,X'FFFF')),
>                     IFTHEN=(WHEN=(5,2,CH,EQ,C'J1'),
>                             BUILD=(1,4,C'D',6:6)),
>                     IFTHEN=(WHEN=((5,2,CH,EQ,X'0000'),OR,
>                                   (5,2,CH,EQ,X'FFFF')),
>                             BUILD=(1,4,5:5))
> * THIS SELECTS ONLY UNMATCHED RECORDS OF ONE TYPE
> * AND HEADER/TRAILER RECORDS
> * OUTPUT RECORD BUILD CHANGES THE ' ' BACK TO 'D'
> OUTFIL FNAMES=OUT2,INCLUDE=(((05,2,CH,EQ,C' 1'),AND,
>                               (15,4,CH,EQ,C'0700')),OR,
>                              (5,2,CH,EQ,X'0000'),OR,
>                              (5,2,CH,EQ,X'FFFF')),
>                     IFTHEN=(WHEN=(5,2,CH,EQ,C' 1'),
>                             BUILD=(1,4,C'D',6:6)),
>                     IFTHEN=(WHEN=((5,2,CH,EQ,X'0000'),OR,
>                                   (5,2,CH,EQ,X'FFFF')),
>                             BUILD=(1,4,5:5))

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to