With Frank Yaeger's help I was able to resolve this problem compatibly for both 
DFSORT and SYNCSORT.  For the archives, the sanitized solution is copied below.

When SYNCSORT supports the IFTRAIL enhancement introduced by DFSORT PTF UK90026 
that will provide a much simpler solution.

Thanks once again to Frank for his excellent help.

Peter


Sanitized solution for JOIN with trailer count adjustment to multiple OUTFIL 
outputs:

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, COPY 'J' OF 'REJ' TO BYTE 1 OF REC
 REFORMAT FIELDS=(F2:1,4,F1:110,1,F2:6)
*
* NOW WE SPECIFY HOW TO PROCESS THE JOINED + UNPAIRED RECORDS
*
 SORT FIELDS=COPY
*
* THIS SELECTS ONLY MATCHED DATA RECORDS
* AND HEADER/TRAILER RECORDS
* OUTPUT RECORD BUILD CHANGES THE 'J' BACK TO 'D'
*
 OUTFIL FNAMES=OUT1,INCLUDE=((05,2,CH,EQ,C'J1'),OR,
                             (05,2,CH,EQ,X'0000'),OR,
                             (05,2,CH,EQ,X'FFFF')),
                    IFTHEN=(WHEN=INIT,
                            BUILD=(1,4,5:SEQNUM,11,ZD,16:5)),
                    IFTHEN=(WHEN=(16,2,CH,EQ,C'J1'),
                            BUILD=(1,4,C'D',6:17)),
                    IFTHEN=(WHEN=(16,2,CH,EQ,X'0000'),
                            BUILD=(1,4,5:16)),
                    IFTHEN=(WHEN=(16,2,CH,EQ,X'FFFF'),
                            BUILD=(1,4,5:16,144,
                                   149:5,11,ZD,SUB,+2,M11,LENGTH=11,
                                   160:171))
*
* THIS SELECTS ONLY UNMATCHED DATA RECORDS
* WHERE THE SELECTION KEY = '000'
* AND HEADER/TRAILER RECORDS
*
 OUTFIL FNAMES=OUT2,INCLUDE=(((05,2,CH,EQ,C' 1'),AND,
                              (15,3,CH,EQ,C'000')),OR,
                             (05,2,CH,EQ,X'0000'),OR,
                             (05,2,CH,EQ,X'FFFF')),
                    IFTHEN=(WHEN=INIT,
                            BUILD=(1,4,5:SEQNUM,11,ZD,16:5)),
                    IFTHEN=(WHEN=(16,2,CH,EQ,C' 1'),
                            BUILD=(1,4,C'D',6:17)),
                    IFTHEN=(WHEN=(16,2,CH,EQ,X'0000'),
                            BUILD=(1,4,5:16)),
                    IFTHEN=(WHEN=(16,2,CH,EQ,X'FFFF'),
                            BUILD=(1,4,5:16,144,
                                   149:5,11,ZD,SUB,+2,M11,LENGTH=11,
                                   160:171))

--


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 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