We used the following JCL in a test using multiple inputs for a MERGE in Micro Focus but the job ended with a RC=16. The SYSOUT contained error message 'SORT020U: SORT(EXTSM) failed - sort engine status = 9/222'. The SORTOUT contained only 2 records, 'SAM 11234 ACCOUNTS' and 'ANDY 56734 IT'.
//LORINCE1 JOB 'BATCHMRG',CLASS=A
//MERG01 EXEC PGM=SORT
//SORTIN01 DD *
SAM 11234 ACCOUNTS
JOHN 78916 IT
STEVE 62541 ACCOUNTS
STEVE 22516 SALES
TIM 90013 HR
/*
//SORTIN02 DD *
ANDY 56734 IT
/*
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
MERGE FIELDS=(13,8,CH,A,1,5,CH,A,7,5,CH,A)
/*
This is a user error. When the JCL was run on the mainframe, the job ended with a RC=16 and DFSORT issued error message 'ICE068A 0 OUT OF SEQUENCE SORTIN01'.
IBM defines the error message here: http://www-01.ibm.com/support/knowledgecenter/SSLTBW_2.1.0/com.ibm.zos.v2r1.icem100/kc00066.htm. Here is another reference: http://www-01.ibm.com/support/knowledgecenter/SSLTBW_2.1.0/com.ibm.zos.v2r1.icea100/srtinnb.htm. The ddnames SORTINnn are for a MERGE operation, but the input must be in a sorted order.
The Micro Focus error flagged by the SORT020U error shows a status of 9/222, which equates to a runtime error message of COBRT222. It says, 'Merge files out of sequence (Fatal) An attempt to merge two files has been unsuccessful. One or more of your files might be out of sequence.'
Here is JCL with the input sorted that will work in both environments:
//LORINCE2 JOB 'BATCHMRG',CLASS=A
//MERG02 EXEC PGM=SORT
//SORTIN01 DD *
SAM 11234 ACCOUNTS
STEVE 62541 ACCOUNTS
TIM 90013 HR
JOHN 78916 IT
STEVE 22516 SALES
/*
//SORTIN02 DD *
ANDY 56734 IT
/*
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
MERGE FIELDS=(13,8,CH,A,1,5,CH,A,7,5,CH,A)
/*
#MFDS
#EnterpriseDeveloper
