After each time that the PL/I input- and output-handling routines communicate the return-code information to the Sort program, the return-code field is reset to zero; therefore, it is not used as a regular return code other than its specific use for the Sort program.
For details on handling conditions, especially those that occur during the input- and output-handling routines, see z/OS Language Environment Programming Guide.
//OPT14#7 JOB ...
//STEP1 EXEC IBMZCBG
//PLI.SYSIN DD *
EX106: PROC OPTIONS(MAIN);
DCL RETURN_CODE FIXED BIN(31,0);
CALL PLISRTA (' SORT FIELDS=(7,74,CH,A) ',
' RECORD TYPE=F,LENGTH=(80) ',
1048576
RETURN_CODE);
SELECT (RETURN_CODE);
WHEN(0) PUT SKIP EDIT
('SORT COMPLETE RETURN_CODE 0') (A);
WHEN(16) PUT SKIP EDIT
('SORT FAILED, RETURN_CODE 16') (A);
WHEN(20) PUT SKIP EDIT
('SORT MESSAGE DATASET MISSING ') (A);
OTHER PUT SKIP EDIT (
'INVALID SORT RETURN_CODE = ', RETURN_CODE) (A,F(2));
END /* select */;
CALL PLIRETC(RETURN_CODE);
/*set PL/I return code to reflect success of sort*/
END EX106;
//GO.SORTIN DD *
003329HOOKER S.W. RIVERDALE, SATCHWELL LANE, BACONSFIELD
002886BOOKER R.R. ROTORUA, LINKEDGE LANE, TOBLEY
003077ROOKER & SON, LITTLETON NURSERIES, SHOLTSPAR
059334HOOK E.H. 109 ELMTREE ROAD, GANNET PARK, NORTHAMPTON
073872HOME TAVERN, WESTLEIGH
000931FOREST, IVER, BUCKS
/*
//GO.SYSPRINT DD SYSOUT=A
//GO.SORTOUT DD SYSOUT=A
//GO.SYSOUT DD SYSOUT=A
//GO.SORTWK01 DD UNIT=SYSDA,SPACE=(CYL,2)
/*