上QQ阅读APP看本书,新人免费读10天
设备和账号都新为新人
6.3 DISPLAY和ACCEPT语句的程序例子
下面是一个完整的使用DISPLAY和ACCEPT语句的例子,运行作业流(JCL)和运行结果(SYSOUT)供读者参考。由于程序简单明了,相信读者能够很好地理解它,所以不做进一步的讲解了。
6.3.1 使用ACCEPT和DISPLAY的完整程序
000001 IDENTIFICATION DIVISION. 000002 * 000003 PROGRAM-ID. ACPDIS. 000004 AUTHOR. NEWMAN LV. 000005 * 000006 ENVIRONMENT DIVISION. 000007 * 000008 INPUT-OUTPUT SECTION. 000009 * 000010 DATA DIVISION. 000011 * 000012 000013 FILE SECTION. 000014 * 000015 WORKING-STORAGE SECTION. 000016 * 000017 77 WS-TOTAL PIC 9(10). 000018 77 WS-DAY PIC X(5). 000019 77 WS-DATE PIC X(6). 000020 01 WS-TIME. 000021 02 CURRENTHOUR PIC 99. 000022 02 CURRENTMINUTE PIC 99. 000023 02 FILLER PIC 9(4). 000024 000025 01 WS-IN. 000026 05 WS-UNIT-PRICE-X PIC X(7). 000027 05 WS-UNIT-PRICE REDEFINES WS-UNIT-PRICE-X PIC 9(5)V99. 000028 05 WS-QTY-X PIC X(5). 000029 05 WS-QTY REDEFINES WS-QTY-X PIC 9(5). 000030 05 FILLER PIC X(68). 000031 * 000032 PROCEDURE DIVISION. 000033 * 000034 ACCEPT WS-DATE FROM DATE. 000035 DISPLAY 'TODAY IS: ' WS-DATE. 000036 ACCEPT WS-DAY FROM DAY. 000037 DISPLAY 'TODAY IS THE DAY OF THIS YEAR: ' WS-DAY. 000038 ACCEPT WS-TIME FROM TIME. 000039 DISPLAY 'CURRENT TIME IS: ' CURRENTHOUR ':' CURRENTMINUTE 000040 * 000041 ACCEPT WS-IN. 000042 DISPLAY 'WS-UNIT-PRICE = ' WS-UNIT-PRICE 000043 DISPLAY 'WS-QTY = ' WS-QTY 000044 COMPUTE WS-TOTAL = WS-UNIT-PRICE * WS-QTY 000045 DISPLAY 'WS-TOTAL = ' WS-TOTAL 000046 STOP RUN.
6.3.2 运行ACCEPT和DISPLAY的程序的作业流
000001 //IBMUSERG JOB ACCT#, 000002 // IBMUSER, 000003 // NOTIFY=IBMUSER, 000004 // MSGLEVEL=(1,1) 000005 //STEP1 EXEC PGM=ACPDIS 000006 //STEPLIB DD DSN=IBMUSER.TEST.LOAD,DISP=SHR 000007 //SYSPRINT DD SYSOUT=(*) 000008 //SYSIN DD * 000009123456712345 000010 //
6.3.3 使用ACCEPT和DISPLAY的程序的输出结果
TODAY IS: 100625 TODAY IS THE DAY OF THIS YEAR: 10176 CURRENT TIME IS: 09:29 WS-UNIT-PRICE = 1234567 WS-QTY = 12345 WS-TOTAL = 0152407296