为什么我的文件定义不起作用?

时间:2014-04-07 21:20:06

标签: cobol

我试图弄清楚为什么我的文件定义不正确。据我所知,这与我们上一个程序中定义的方式相同,所有都是固定的块记录

代码:

FILE-CONTROL.                                    
    SELECT INFILE1      ASSIGN TO UT-S-INPUT1.   
    SELECT INFILE2      ASSIGN TO UT-S-INPUT2.   
    SELECT OUTPUT-FILE1 ASSIGN TO UT-S-OUTPUT1.  
    SELECT OUTPUT-FILE2 ASSIGN TO UT-S-OUTPUT2.  
DATA DIVISION.                                   
FILE SECTION.                                    

FD INFILE1.                                      
       BLOCK CONTAINS 0 RECORDS                  
       RECORDING MODE IS F                       
       LABEL RECORDS ARE STANDARD.               
01 INF-LINE1.                                    
   05 STATE-1  PIC X(02).                        
   05 KEY-1    PIC X(10).                        
   05 TRANSID1 PIC X(10).                        
   05 FILLER   PIC X(58). 

FD INFILE2.                                 
       BLOCK CONTAINS 0 RECORDS             
       RECORDING MODE IS F                  
       LABEL RECORDS ARE STANDARD.          
01 INF-LINE2.                               
   05 KEY-2    PIC X(10).                   
   05 TRANSID2 PIC X(10).                   
   05 FILLER   PIC X(60).                   

FD OUTPUT-FILE1                             
       BLOCK CONTAINS 0 RECORDS             
       RECORDING MODE IS F                  
       LABEL RECORDS ARE STANDARD.          
01 OUTLINE1 PIC X(80).                      

FD OUTPUT-FILE2                             
       BLOCK CONTAINS 0 RECORDS             
       RECORDING MODE IS F                  
       LABEL RECORDS ARE STANDARD.          
01 OUTLINE2 PIC X(80).   

错误代码:其中一些错误代码与文件错误无关,但我复制了所有错误代码并放在此部分中。

 20  IGYGR1216-I   A "RECORDING MODE" of "F" was assumed for file "INFILE1".                                                     

 21  IGYDS1089-S   "BLOCK" was invalid.  Scanning was resumed at the next area "A" item, level-number, or the start of the next  
                   clause.                                                                                                       

                   Same message on line:     31                                                                                  

 30  IGYGR1216-I   A "RECORDING MODE" of "F" was assumed for file "INFILE2".                                                     

283  IGYPA3043-E   Data-item "INF-LINE1 (GROUP)" and record "INF-LINE1 (GROUP)" had overlapping storage.  Movement of data may   
                   not occur at execution time.                                                                                  

293  IGYPA3043-E   Data-item "INF-LINE2 (GROUP)" and record "INF-LINE2 (GROUP)" had overlapping storage.  Movement of data may   
                   not occur at execution time.                                                                                  

304  IGYPS2015-I   The paragraph or section prior to paragraph or section "X-COMP-FILE" did not contain any statements.          

321  IGYPS2121-S   "STUB4" was not defined as a data-name.  The statement was discarded.                                         

1 个答案:

答案 0 :(得分:2)

如果在我们的定义语句中删除文件名之后的句点,它应该可以在没有编译器错误的情况下工作。

代码:

FD INFILE1                                     
       BLOCK CONTAINS 0 RECORDS                  
       RECORDING MODE IS F                       
       LABEL RECORDS ARE STANDARD.               
01 INF-LINE1.                                    
   05 STATE-1  PIC X(02).                        
   05 KEY-1    PIC X(10).                        
   05 TRANSID1 PIC X(10).                        
   05 FILLER   PIC X(58). 

FD INFILE2                                 
       BLOCK CONTAINS 0 RECORDS             
       RECORDING MODE IS F                  
       LABEL RECORDS ARE STANDARD.          
01 INF-LINE2.                               
   05 KEY-2    PIC X(10).                   
   05 TRANSID2 PIC X(10).                   
   05 FILLER   PIC X(60).    

这是一整天都在看绿屏时会发生的常见错误。我会重新编译它,看看其他错误是否会消失。重新编译程序然后重新开始是一个好主意。您是否打印编译列表以便每隔一段时间扫描一次。我想是的。编译列表为您提供了所有内存位置和每条记录的大小。它非常方便。

代码:

    30  IGYGR1216-I   A "RECORDING MODE" of "F" was assumed for file "INFILE2". 

我不确定这个错误,但我打赌你有固定块文件的F a V.我会检查这个,如果是这样的话就修好了。你是从零开始的程序,还是你采取一个工作程序,然后去掉你不需要的东西,然后从这个角度开始工作。如果是这种情况,您需要确保为固定块和可变块文件正确设置了记录模式。

     321  IGYPS2121-S   "STUB4" was not defined as a data-name.  The statement was discarded. 

上述错误很简单,没有工作存储或名为STUB4的变量。

希望这有帮助。