Hi,
Yes its connected to my previous post "comment out procs".
My initial requirement was to comment out ProcXYZ.
I have done this by using When=group.
Input:-
//******************************************************************
//STEP05 EXEC PROCXYZ,
// MEMA=ABCD123,
// MEMBER=XYZ123,
//STEP10 EXEC PROCABC,
// DSN='TEST.FILE',
//STEP40 EXEC PROC123
// DSN1=INPUT.FILE1,
// DSN2=OUTPUT.FILE.BKP(+1),
// LRECL=800,
//*********************************************************
JCL used for this:-
//STEP01 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=input.file,DISP=SHR
//SORTOUT DD DSN=output.file,
// DISP=(NEW,CATLG,DELETE),
// RECFM=FB,
// UNIT=SYSDA
//SYSIN DD *
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(17,4,CH,EQ,C'PROC',)
PUSH=(81:17,7))
OUTFIL REMOVECC,
IFTHEN=(WHEN=(81,7,CH,EQ,C'PROCXYZ'),
BUILD=(1,2,C'*',3,77,81:1,3,C'CMT')),
IFTHEN=(WHEN=NONE,
BUILD=(1,90))
OPTION COPY
/*
Output:-
//******************************************************************
1-----------------------------------------------------------------------------------------80-81-82-83
//*STEP05 EXEC PROCXYZ, CMT
// * MEMA=ABCD123, CMT
// * MEMBER=XYZ123, CMT
//STEP10 EXEC PROCABC, PROCABC
// DSN='TEST.FILE', PROCABC
//STEP40 EXEC PROC123 PROC123
// DSN1=INPUT.FILE1, PROC123
// DSN2=OUTPUT.FILE.BKP(+1), PROC123
// LRECL=800, PROC123
//*********************************************************
Now I have some additional requirements for this:-
If ProcABC is the PROC occurring after PROCXYZ, then even this needs to be comment out.
NOTE- Proc ABC occurs a lot many times , and so we have the condition that it should be the one occurring after ProcXYZ.
So, now I require a logic which can handle multiple begin and end records.
Expected Output:-
//******************************************************************
1-----------------------------------------------------------------------------------------80-81-82-83
//*STEP05 EXEC PROCXYZ, CMT
// * MEMA=ABCD123, CMT
// * MEMBER=XYZ123, CMT
//*STEP10 EXEC PROCABC, PROCABC
//* DSN='TEST.FILE', PROCABC
//STEP40 EXEC PROC123 PROC123
// DSN1=INPUT.FILE1, PROC123
// DSN2=OUTPUT.FILE.BKP(+1), PROC123
// LRECL=800, PROC123
//*********************************************************
Can you please help me out with this.
RE CODE' d