
Example: conditional compilation output
The following example shows the listing of a program that contains conditional compilation statements. The note numbers in the listing correspond to numbered explanations that follow the listing.
LineID PL SL ----+-*A-1-B--+----2----+----3----+----4----+----5----+----6----+----7-|--+----8 Map and Cross Reference
000001 identification division.
000002 program-id. prog.
000003 data division.
000004 working-storage section.
000005 01 x pic 9(9) binary.
000006 procedure division.
000007 MainProgram.
000008 >>define var as 12
000009 >>evaluate var
000010 >>when 10
000011 * display 'var is 10' (1)
000012 >>when 11 thru 13
000013 display 'var is 11, 12 or 13' (2)
000014 >>when other
000015 * display 'invalid value' (1)
000016 >>end-evaluate
000017 goback.
000018 end program prog.
- (1)
- Those branches of the
EVALUATE
directive were false at compile time, so the code in those branches was omitted from the resultant program. - (2)
- That
branch of the
EVALUATE
directive evaluated to true at compile time, so the code in that branch was included in the resultant program.
related references
EVALUATE directive (Enterprise COBOL for z/OS® Language Reference)
Conditional compilation (Enterprise COBOL for z/OS Language Reference)
EVALUATE directive (Enterprise COBOL for z/OS® Language Reference)
Conditional compilation (Enterprise COBOL for z/OS Language Reference)
