LAB4.txt
上传用户:hblyhb
上传日期:2017-11-18
资源大小:2074k
文件大小:2k
源码类别:

数据库编程

开发平台:

SQL

  1.        IDENTIFICATION DIVISION.          
  2.        PROGRAM-ID. PSAMPLE1.             
  3.        ENVIRONMENT DIVISION.             
  4.        INPUT-OUTPUT SECTION.             
  5.        FILE-CONTROL.                     
  6.            SELECT INN ASSIGN TO FILEIN.  
  7.            SELECT OUU ASSIGN TO FILEOUT. 
  8.        DATA  DIVISION.                   
  9.        FILE SECTION.                     
  10.        FD INN LABEL RECORD IS STANDARD.  
  11.        01 IN-RECORD.                     
  12.            02 IN-NUMBER PIC X(6).        
  13.            02 IN-NAME   PIC X(10).       
  14.            02 IN-RESULT1 PIC 99V99.                     
  15.            02 IN-RESULT2 PIC 99V99.                     
  16.            02 IN-RESULT3 PIC 99V99.                     
  17.            02 IN-BLANK PIC X(52).                       
  18.        FD OUU LABEL RECORD IS STANDARD.                 
  19.        01 OUT-RECORD.                                   
  20.            02 OUT-NUMBER PIC X(8).                      
  21.            02 OUT-NAME   PIC X(12).                     
  22.            02 OUT-RESULT1 PIC ---9.99BB.                
  23.            02 OUT-RESULT2 PIC ---9.99BB BLANK WHEN ZERO.
  24.            02 OUT-RESULT3 PIC ---9.99BB BLANK WHEN ZERO.
  25.            02 OUT-RESULT PIC ---9.99BB BLANK WHEN ZERO. 
  26.            02 OUT-BLANK  PIC X(24).                     
  27.        WORKING-STORAGE SECTION.                         
  28.        77   A    PIC   9(4)V999.                        
  29.        PROCEDURE DIVISION.                              
  30.            OPEN INPUT INN OUTPUT OUU.                   
  31.        RE. READ INN AT END STOP RUN.                      
  32.            MOVE IN-NUMBER TO OUT-NUMBER                   
  33.            MOVE IN-NAME   TO OUT-NAME                     
  34.            MOVE IN-RESULT1 TO OUT-RESULT1                 
  35.            MOVE IN-RESULT2 TO OUT-RESULT2                 
  36.            MOVE IN-RESULT3 TO OUT-RESULT3                 
  37.            ADD IN-RESULT1, IN-RESULT2, IN-RESULT3 GIVING A
  38.            DIVIDE   3  INTO A                             
  39.            MOVE A TO OUT-RESULT                           
  40.            WRITE OUT-RECORD.                              
  41.            GO TO RE.                                      
  42.            STOP  RUN.                                     
  43.        IDENTIFICATION  DIVISION.
  44.        PROGRAM-ID.  SUB.
  45.        ENVIRONMENT  DIVISION.
  46.        DATA  DIVISION.
  47.        LINKAGE  SECTION.            
  48.        77 X  PIC  99.
  49. 77 Y  PIC  99.
  50. 77 Z  PIC  99.
  51. PROCEDURE  DIVISION  USING  X, Y, Z.
  52. S. COMPUTE  Z=X-Y.
  53. END   PROGRAM  SUB.