OK, untested.
For your first file, in JNF1CNTL, append a "1". This is just to ensure that a key with a constant value is available for the whole file. It is not "relevant" because no matches will occur. You tell the JOINKEYS that this is SORTED.
For your second file, which you will allow JOINKEYS to sort for you, INCLUDE the TOTAL-1 and TOTAL-2 records. Use SUM with a set-up value of '1' to tell the range of the ID for the TOTAL-2 records later (which is why we include TOTAL-1 in the SUM). The "key" is set-up with a value of '0', to arrive before all the '1's of the data.
In the JOIN, ONLY have unmatched records (no matches will be possible, but cleaner to be specific).
In the main-task have an additional GROUP for the unmatched record from file 2, which is our SUMmed total. PUSH this so that it is available on all the records.
The first OUTFIL remains as was shown earlier.
The second OUTFIL has an AND added, so that the full range of IDs can be included for the variable number of TOTAL-2 groups.
The third OUTFIL specifies SAVE, so that anything not written to the first or second OUTFIL will end up here.
JOINKEYS F1=INA,FIELDS=(134,1,A),SORTED,NOSEQCK
JOINKEYS F2=INB,FIELDS=(1,1,A)
JOIN UNPAIRED,F1,F2,ONLY
REFORMAT FIELDS=(F1:1,133,F2:2,2,?)
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(136,1,CH,EQ,C'2'),
PUSH=(136:134,2)),
IFTHEN=(WHEN=GROUP,END=(5,5,CH,EQ,C'TOTAL'),PUSH=(134:ID=2))
OUTFIL FNAMES=OUT01,BUILD=(1,133),
INCLUDE=(134,2,ZD,EQ,01)
OUTFIL FNAMES=OUT02,BUILD=(1,133),
INCLUDE=(134,2,ZD,GT,01,
AND,134,2,ZD,LE,136,2,ZD)
OUTFIL FNAMES=OUT03,BUILD=(1,133),SAVE
//JNF1CNTL DD *
INREC OVERLAY=(134:C'1')
//JNF2CNTL DD *
INCLUDE COND=(5,7,SS,EQ,C'TOTAL-1,TOTAL-2)
INREC BUILD=(C'0',C'01')
SUM FIELDS=(2,2,ZD)