LAB4.txt
上传用户:hblyhb
上传日期:2017-11-18
资源大小:2074k
文件大小:2k
- IDENTIFICATION DIVISION.
- PROGRAM-ID. PSAMPLE1.
- ENVIRONMENT DIVISION.
- INPUT-OUTPUT SECTION.
- FILE-CONTROL.
- SELECT INN ASSIGN TO FILEIN.
- SELECT OUU ASSIGN TO FILEOUT.
- DATA DIVISION.
- FILE SECTION.
- FD INN LABEL RECORD IS STANDARD.
- 01 IN-RECORD.
- 02 IN-NUMBER PIC X(6).
- 02 IN-NAME PIC X(10).
- 02 IN-RESULT1 PIC 99V99.
- 02 IN-RESULT2 PIC 99V99.
- 02 IN-RESULT3 PIC 99V99.
- 02 IN-BLANK PIC X(52).
- FD OUU LABEL RECORD IS STANDARD.
- 01 OUT-RECORD.
- 02 OUT-NUMBER PIC X(8).
- 02 OUT-NAME PIC X(12).
- 02 OUT-RESULT1 PIC ---9.99BB.
- 02 OUT-RESULT2 PIC ---9.99BB BLANK WHEN ZERO.
- 02 OUT-RESULT3 PIC ---9.99BB BLANK WHEN ZERO.
- 02 OUT-RESULT PIC ---9.99BB BLANK WHEN ZERO.
- 02 OUT-BLANK PIC X(24).
- WORKING-STORAGE SECTION.
- 77 A PIC 9(4)V999.
- PROCEDURE DIVISION.
- OPEN INPUT INN OUTPUT OUU.
- RE. READ INN AT END STOP RUN.
- MOVE IN-NUMBER TO OUT-NUMBER
- MOVE IN-NAME TO OUT-NAME
- MOVE IN-RESULT1 TO OUT-RESULT1
- MOVE IN-RESULT2 TO OUT-RESULT2
- MOVE IN-RESULT3 TO OUT-RESULT3
- ADD IN-RESULT1, IN-RESULT2, IN-RESULT3 GIVING A
- DIVIDE 3 INTO A
- MOVE A TO OUT-RESULT
- WRITE OUT-RECORD.
- GO TO RE.
- STOP RUN.
- IDENTIFICATION DIVISION.
- PROGRAM-ID. SUB.
- ENVIRONMENT DIVISION.
- DATA DIVISION.
- LINKAGE SECTION.
- 77 X PIC 99.
- 77 Y PIC 99.
- 77 Z PIC 99.
- PROCEDURE DIVISION USING X, Y, Z.
- S. COMPUTE Z=X-Y.
- END PROGRAM SUB.