I guess this pseudo code shud help you. Try to get the actualy JCL code for it. Please post it if you find the same.
==============================
//Job1step1
//Job1step2
//Job1step3
//Job1step4
//Job1step5
IF Job1step5.RC=0 THEN
Job1term /*This will be the termination step*/
ENDIF
//Job1step6
//Job1step7
.
.
.
//Job1term