evaluate语句用于控制多分支选择结构流程。
IDENTIFICATION DIVISION.
PROGRAM-ID. EVA.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 DSA PIC 9.
PROCEDURE DIVISION.
ACCEPT DSA.
DISPLAY 'NUM IS :' DSA.
EVALUATE TRUE
WHEN DSA = 1
DISPLAY 'IDENTIFICATION'
WHEN DSA = 2
DISPLAY 'ENVIRONMENT'
WHEN DSA = 3
DISPLAY 'DATA'
WHEN DSA = 4
DISPLAY 'PROCEDURE'
END-EVALUATE.
STOP RUN.
从终端接收值,在显示相应的结果。