10.07.2015 Views

Enterprise COBOL for z/OS V4.2 Programming Guide

Enterprise COBOL for z/OS V4.2 Programming Guide

Enterprise COBOL for z/OS V4.2 Programming Guide

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

particular exception does not occur, such as NOT ON SIZE ERROR. The NOT phrasecannot be used with the ON OVERFLOW phrase of the CALL statement, but it can beused with the ON EXCEPTION phrase.Do not nest conditional statements. Nested statements must be imperativestatements (or delimited scope statements) and must follow the rules <strong>for</strong>imperative statements.The following statements are examples of conditional statements if they are codedwithout scope terminators:v Arithmetic statement with ON SIZE ERRORv Data-manipulation statements with ON OVERFLOWv CALL statements with ON OVERFLOWv I/O statements with INVALID KEY, AT END, orAT END-OF-PAGEv RETURN with AT ENDRELATED CONCEPTS“Imperative statements” on page 21“Scope terminators”RELATED TASKS“Selecting program actions” on page 89RELATED REFERENCESConditional statements (<strong>Enterprise</strong> <strong>COBOL</strong> Language Reference)Compiler-directing statementsA compiler-directing statement causes the compiler to take specific action about theprogram structure, COPY processing, listing control, or control flow.A compiler-directing statement is not part of the program logic.RELATED REFERENCESChapter 18, “Compiler-directing statements,” on page 363Compiler-directing statements (<strong>Enterprise</strong> <strong>COBOL</strong> Language Reference)Scope terminatorsA scope terminator ends a verb or statement. Scope terminators can be explicit orimplicit.Explicit scope terminators end a verb without ending a sentence. They consist ofEND followed by a hyphen and the name of the verb being terminated, such asEND-IF. An implicit scope terminator is a period (.) that ends the scope of allprevious statements not yet ended.Each of the two periods in the following program fragment ends an IF statement,making the code equivalent to the code after it that instead uses explicit scopeterminators:IF ITEM = "A"DISPLAY "THE VALUE OF ITEM IS " ITEMADD 1 TO TOTALMOVE "C" TO ITEMDISPLAY "THE VALUE OF ITEM IS NOW " ITEM.IF ITEM = "B"ADD 2 TO TOTAL.22 <strong>Enterprise</strong> <strong>COBOL</strong> <strong>for</strong> z/<strong>OS</strong> <strong>V4.2</strong> <strong>Programming</strong> <strong>Guide</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!