使用顺序文件编译 COBOL 程序时出错

问题描述 投票:0回答:1

我的主机中有这个 COBOL 程序:

       IDENTIFICATION DIVISION.                                          
       PROGRAM-ID. TEST2.                                                
       ENVIRONMENT DIVISION.                                             
       INPUT-OUTPUT SECTION.                                             
       FILE-CONTROL.                                                     
           SELECT DATOS ASSIGN TO INPUTFL.                               
       DATA DIVISION.                                                    
       FILE SECTION.                                                     
       FD DATOS.                                                         
          01  REG-DAT.                                                   
              05  ID-LB           PIC 9(10).                             
              05  TITULO          PIC X(16).                             
              05  GEN-1           PIC X(8).                              
              05  GEN-2           PIC X(11).                             
              05  STOCK           PIC 99.                                
              05  FILLER          PIC X(33).                             
       WORKING-STORAGE SECTION.                                          
           01  FIN      PIC X VALUE 'N'.                                 
       PROCEDURE DIVISION.                                               
       1000-ABRIR.                                                       
           OPEN INPUT DATOS                                             
                PERFORM 2000-LEER UNTIL FIN = 'S'                       
           CLOSE DATOS                                                  
           STOP RUN.                                                    
       2000-LEER.                                                       
           READ DATOS                                                   
                AT END MOVE 'S' TO FIN                                  
                NOT AT END PERFORM 2100-MOSTRAR.                                                    
       2100-MOSTRAR.                                                    
           DISPLAY 'ID LIBRO: ' ID-LB.                                  
           DISPLAY 'TITULO: ' TITULO.                                   
           DISPLAY 'GENERO PRINCIPAL: ' GEN-1.                          
           DISPLAY 'GENERO SECUNDARIO: ' GEN-2.                         
           DISPLAY 'STOCK: ' STOCK.                                     
           DISPLAY '--------------------------------'.                             

在测试它之前,我必须编译它,但是当我运行 JCL 时,它会弹出 0012 错误。 这是JCL:

//HERC0101 JOB (COBOL),                                              
//             'COBOL COMPILATION',                                  
//             CLASS=A,                                              
//             MSGCLASS=H,                                           
//             REGION=8M,TIME=1440,                                  
//             NOTIFY=HERC01,                                        
//             MSGLEVEL=(1,1)                                        
//****************************************************************** 
//*                                                                  
//* THIS JOB HAS AS PURPOSE COMPILE THE COBOL CODE                   
//* PROCEDURE LOCATED @ SYS2.PROCLIB(COBOL)                          
//*                                                                  
//****************************************************************** 
//COMPILE  EXEC COBOL,                                               
//         PROG='TEST2',                                             
//         PDSF='MBVT.APPLICBC.SRC',                                 
//         PDSL='MBVT.APPLICBC.LOAD'                                 
/*                                                                   
//                                                                   

我尝试过使用另一种更简单的代码,比如这个:

       IDENTIFICATION DIVISION.     
       PROGRAM-ID. TEST2.            
       ENVIRONMENT DIVISION.        
       DATA DIVISION.               
       PROCEDURE DIVISION.          
           DISPLAY 'HOLA MUNDO!!'.  
           STOP RUN.                

JCL 正确编译了它,但使用另一个它向我显示了这个错误:

IEF202I HERC0101 LKED COMPILE - STEP WAS NOT RUN BECAUSE OF CONDITION CODES
日志显示了所有过程,在显示代码后,它显示了以下内容:

                                                                                
 6      IKF1155I-W     DEVICE CLASS INVALID IN SYSTEM-NAME. SKIPPING TO NEXT FIE
6      IKF1141I-W     FILE ORGANIZATION FIELD INVALID IN SYSTEM-NAME.  SEQUENTI
6      IKF1157I-E     EXTERNAL-NAME NOT PRESENT IN SYSTEM-NAME.                
6      IKF2133I-W     LABEL RECORDS CLAUSE MISSING. DD CARD OPTION WILL BE TAKE
27     IKF4052I-E     NOT    MAY NOT BE TARGET FIELD FOR ALPHANUMERIC LITERAL  
                      AND IS DISCARDED.                                        
27     IKF4052I-E     AT    MAY NOT BE TARGET FIELD FOR ALPHANUMERIC LITERAL  (
                      AND IS DISCARDED.                                        
27     IKF4052I-E     END    MAY NOT BE TARGET FIELD FOR ALPHANUMERIC LITERAL  
                      AND IS DISCARDED.                                        
28     IKF4072I-W     EXIT FROM PERFORMED PROCEDURE ASSUMED BEFORE PROCEDURE-NA
                                                                                
cobol mainframe jcl
1个回答
0
投票

胡安,

正如您在之前的帖子中提到的,您使用的是旧模拟器,因此会出现所有奇怪的消息。 仅供记录,如果您只需将 01 定义移动到位置 8,程序就可以在 z/OS 上正常编译,如下所示

----+----1----+----2----+----3----+----4----+----5----+-
       FD DATOS.                                        
       01 REG-DAT.                                      
           05  ID-LB           PIC 9(10).               
           05  TITULO          PIC X(16).               
           05  GEN-1           PIC X(8).                
           05  GEN-2           PIC X(11).               
           05  STOCK           PIC 99.                  
           05  FILLER          PIC X(33).               
       WORKING-STORAGE SECTION.                         
       01  FIN                 PIC X VALUE 'N'.         

   FD DATOS.                                                         
      01  REG-DAT.                                                   
          05  ID-LB           PIC 9(10).                             
          05  TITULO          PIC X(16).                             
          05  GEN-1           PIC X(8).                              
          05  GEN-2           PIC X(11).                             
          05  STOCK           PIC 99.                                
          05  FILLER          PIC X(33).                             
   WORKING-STORAGE SECTION.                                          
       01  FIN      PIC X VALUE 'N'.     
© www.soinside.com 2019 - 2024. All rights reserved.