0

I made some major changes to how the report is laid out. Previously all the data had to be loaded into a table so that it could be written into two columns. However I decided instead to put it all into one column and show the field names. Now I am getting file status 139 "Record Length or Key Data Inconsistency". Once again I don't know what that means and there is so little resources online that I can't find an answer to this problem.

Here's the reworked code in it's entirety:

ENVIRONMENT DIVISION.                                    
INPUT-OUTPUT SECTION.                                    
FILE-CONTROL.                                            

SELECT VENDOR-FILE-IN                                
    ASSIGN TO 'VENDOR-MASTER.DAT'                    
    ORGANIZATION IS INDEXED                          
    ACCESS MODE IS SEQUENTIAL                        
    RECORD KEY IS VENDOR-NUMBER-IN.                  

SELECT VENDOR-FILE-OUT                               
    ASSIGN TO 'VENDOR-REPORT.RPT'                    
    ORGANIZATION IS LINE SEQUENTIAL.                 

DATA DIVISION.                                           
FILE SECTION.                                            

FD VENDOR-FILE-IN.                                       
01 VENDOR-RECORD-IN.                                     
   05  VENDOR-NUMBER-IN         PIC X(4).                
   05  VENDOR-NAME-IN           PIC X(25).               
   05  VENDOR-ADDRESS-IN        PIC X(25).               
   05  VENDOR-CITY-IN           PIC X(15).               
   05  VENDOR-STATE-IN          PIC XX.                  
   05  VENDOR-ZIP-CODE-IN       PIC X(5).                
   05  VENDOR-CONTACT-NAME-IN   PIC X(20).               
   05  VENDOR-CONTACT-PHONE-IN  PIC X(10).               
   05  VENDOR-DATE-FIELDS       PIC X(18).               

FD VENDOR-FILE-OUT.                                      
01 VENDOR-RECORD-OUT            PIC X(80).               

WORKING-STORAGE SECTION.                                 
01  ARE-THERE-MORE-RECORDS       PIC X(3)  VALUE 'YES'.  
01  PAGE-CTR                     PIC 99    VALUE ZERO.   
01  FIRST-PAGE                   PIC X(3)  VALUE 'YES'.  
01  LINE-CTR                     PIC 99    VALUE ZERO.   

01  WS-DATE.                                             
    05  RUN-YEAR                 PIC XX.                 
    05  RUN-MONTH                PIC XX.                 
    05  RUN-DAY                  PIC XX.                 

01 HEADING-LINE.                                         
    05                           PIC X(26) VALUE SPACES. 
    05                           PIC X(35)               
        VALUE 'VENDOR REPORT'.                           
    05 HL-DATE.                                          
        10  DAY-HL               PIC XX.                 
        10                       PIC X     VALUE '/'.    
        10  MONTH-HL             PIC XX.                 
        10                       PIC X     VALUE '/'.    
        10  YEAR-HL              PIC XX.                 
    05                           PIC X(3)  VALUE SPACES. 
    05                           PIC X(5)  VALUE 'PAGE'. 
    05  PAGE-NUMBER-HL           PIC Z9.                 

01  DETAIL-LINE.                                         
    05                           PIC X(5) VALUE SPACES.  
    05  FIELD-NAME-DL            PIC X(20).              
    05  FIELD-DETAIL-DL          PIC X(40).              

PROCEDURE DIVISION.                                      
100-MAIN.                                                

    ACCEPT WS-DATE FROM DATE.                            
    MOVE RUN-MONTH TO MONTH-HL.                          
    MOVE RUN-DAY   TO DAY-HL.                            
    MOVE RUN-YEAR  TO YEAR-HL.                           

    OPEN INPUT VENDOR-FILE-IN                            
    OPEN OUTPUT VENDOR-FILE-OUT                          

    PERFORM UNTIL ARE-THERE-MORE-RECORDS = 'NO '         
        READ VENDOR-FILE-IN                              
            AT END                                       
                MOVE 'NO ' TO ARE-THERE-MORE-RECORDS     
            NOT AT END                                   
                PERFORM 200-PROCESS-ONE-RECORD           
    CLOSE VENDOR-FILE-IN                                 
    CLOSE VENDOR-FILE-OUT                                
    STOP RUN.                                            

200-PROCESS-ONE-RECORD.                                  

    IF FIRST-PAGE = 'YES'                                
        PERFORM 300-PAGE-BREAK                           
        MOVE 'NO' TO FIRST-PAGE                          
    END-IF.                                              

    IF LINE-CTR >= 54                                    
        PERFORM 300-PAGE-BREAK                           
    END-IF                                               

    MOVE 'Vendor Number:' TO FIELD-NAME-DL           
    MOVE VENDOR-NUMBER-IN TO FIELD-DETAIL-DL         
    WRITE VENDOR-RECORD-OUT FROM DETAIL-LINE         
    MOVE 'Vendor Name:' TO FIELD-NAME-DL             
    MOVE VENDOR-NAME-IN TO FIELD-DETAIL-DL           
    WRITE VENDOR-RECORD-OUT FROM DETAIL-LINE         
    MOVE 'Vendor Address:' TO FIELD-NAME-DL          
    MOVE VENDOR-ADDRESS-IN TO FIELD-DETAIL-DL        
    WRITE VENDOR-RECORD-OUT FROM DETAIL-LINE         
    MOVE 'Vendor City:' TO FIELD-NAME-DL             
    MOVE VENDOR-CITY-IN TO FIELD-DETAIL-DL           
    WRITE VENDOR-RECORD-OUT FROM DETAIL-LINE         
    MOVE 'Vendor State:' TO FIELD-NAME-DL            
    MOVE VENDOR-STATE-IN TO FIELD-DETAIL-DL          
    WRITE VENDOR-RECORD-OUT FROM DETAIL-LINE         
    MOVE 'Vendor Zip Code:' TO FIELD-NAME-DL         
    MOVE VENDOR-ZIP-CODE-IN TO FIELD-DETAIL-DL       
    WRITE VENDOR-RECORD-OUT FROM DETAIL-LINE         
    MOVE 'Contact Name:' TO FIELD-NAME-DL            
    MOVE VENDOR-CONTACT-NAME-IN TO FIELD-DETAIL-DL   
    WRITE VENDOR-RECORD-OUT FROM DETAIL-LINE         
    MOVE 'Contact Phone:' TO FIELD-NAME-DL           
    MOVE VENDOR-CONTACT-PHONE-IN TO FIELD-DETAIL-DL  
    WRITE VENDOR-RECORD-OUT FROM DETAIL-LINE         
    MOVE SPACES TO DETAIL-LINE                       
    WRITE VENDOR-RECORD-OUT FROM DETAIL-LINE         
    ADD 9 TO LINE-CTR.                               

300-PAGE-BREAK.                                          

    ADD 1 TO PAGE-CTR                                    
    MOVE PAGE-CTR TO PAGE-NUMBER-HL                      
    WRITE VENDOR-RECORD-OUT FROM HEADING-LINE            
        AFTER ADVANCING PAGE                             
    MOVE SPACES TO DETAIL-LINE                           
    WRITE VENDOR-RECORD-OUT FROM DETAIL-LINE             
        AFTER ADVANCING 1                                
    MOVE 3 TO LINE-CTR.                                  
4

1 回答 1

1

看起来您正在使用 Micro Focus 工具。您看到的错误似乎已记录在案。正如 NealB 所指出的,文档似乎表明问题可能出在数据文件本身上。

于 2012-06-27T01:08:58.823 回答