I am confused with regards WHEN=ANY clause execution.
My understanding is
All IFTHEN=WHEN=INIT / GROUP clause in the order mentioned followed by
All IFTHEN=WHEN=(logical condition) followed by WHEN=ANY (assuming one of the WHEN=logical condition is satisfied)
All IFTHEN=WHEN=NONE clauses (assuming at least one of the WHEN=logical condition is not satisfied)
But looking at the results of following code, it doesn't seem so.
//RFPASTEU EXEC PGM=SYNCTOOL,COND=(0,NE)
//INPUTFIL DD *
1
2
3
4
/*
//OUTPUTFI DD SYSOUT=*
//TOOLIN DD *
COPY FROM(INPUTFIL) USING(EXTR)
/*
//EXTRCNTL DD *
INREC IFTHEN=(WHEN=INIT,
BUILD=(1,1,
C'|',
C'PASS1')),
IFTHEN=(WHEN=INIT,
BUILD=(1,7,
C'|',
C'PASS2')),
IFTHEN=(WHEN=(1,1,CH,EQ,C'1'),
BUILD=(1,13,
C'|',
C'PASS3')),
IFTHEN=(WHEN=(1,1,CH,EQ,C'2'),
BUILD=(1,19,
C'|',
C'PASS4')),
IFTHEN=(WHEN=ANY,
BUILD=(1,25,
C'|',
C'PASS5')),
IFTHEN=(WHEN=NONE,
BUILD=(1,31,
C'|',
C'PASS6'))
OUTFIL FNAMES=OUTPUTFI
/*
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//INPUTFIL DD *
1
2
3
4
/*
//OUTPUTFI DD SYSOUT=*
//TOOLIN DD *
COPY FROM(INPUTFIL) USING(EXTR)
/*
//EXTRCNTL DD *
INREC IFTHEN=(WHEN=INIT,
BUILD=(1,1,
C'|',
C'PASS1')),
IFTHEN=(WHEN=INIT,
BUILD=(1,7,
C'|',
C'PASS2')),
IFTHEN=(WHEN=(1,1,CH,EQ,C'1'),
BUILD=(1,13,
C'|',
C'PASS3')),
IFTHEN=(WHEN=(1,1,CH,EQ,C'2'),
BUILD=(1,19,
C'|',
C'PASS4')),
IFTHEN=(WHEN=ANY,
BUILD=(1,25,
C'|',
C'PASS5')),
IFTHEN=(WHEN=NONE,
BUILD=(1,31,
C'|',
C'PASS6'))
OUTFIL FNAMES=OUTPUTFI
/*
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
Results -
----+----1----+----2----+----3----+----4----+
1|PASS1|PASS2|PASS3
2|PASS1|PASS2 |PASS4
3|PASS1|PASS2 |PASS6
4|PASS1|PASS2 |PASS6
1|PASS1|PASS2|PASS3
2|PASS1|PASS2 |PASS4
3|PASS1|PASS2 |PASS6
4|PASS1|PASS2 |PASS6
I was expecting 'PASS5' string to appear for 1st 2 records, but it didn't. Does it mean that I must use HIT=NEXT to have the WHEN=ANY clauses executed.
Thanks.