The size of the DSNINDEX work files DSNIIN and DSNIOUT in MERGE need to be adjusted according to the number of DSNINDEX records.
The primary and secondary space allocation of the DSNINDEX work files DSNIIN and DSNIOUT are defined by the variables &DA, &DAP, or &DAS in the MERGE procedure.
In the sample case, the MERGE proc shows -
// DA='K', U OR K OR M # OF RECS
// DAP='550', PRIM # OF DSNINDEX RECS
// DAS='13', SEC # OF DSNINDEX RECS
this generates for DSNIIN (and similar for DSNIOUT) in the MERGE procedure:
//DSNIIN DD DCB=(LRECL=316,BLKSIZE=5900,DSORG=PS,RECFM=VB),
// UNIT=SYSDA,AVGREC=K,
// SPACE=(316,(550,13),RLSE)
That means, the Primary space amount would be calculated for 550 * 1024 = 563,200 records (AVGREC=K means 1024)
and the Secondary space amount would be for 13 * 1024 = 13,312 records.
So, 1 Primary + 15 Secondary extents would provide space for about 762,880 records on one volume.
But in the sample case, as per message -
ADSDM178*0057 865217 RECORDS UNLOADED FROM FILE DSNINDEX
there are 865,217 DSNINDEX records.
Therefore, with the above extent sizes, the file tries to go multi-volume and the Merge abends with U0200 and message 4185.
Increasing the DAP and DAS values in the MERGE procedure to create a Primary space for 1,200,000 DSNINDEX records will solve the problem:
// DA='K', U OR K OR M # OF RECS
// DAP='1200', PRIM # OF DSNINDEX RECS
// DAS='120', SEC # OF DSNINDEX RECS