Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Overlapping error in COBOL program

Cobol program :

PROGRAM-ID. SCHPROG.            
ENVIRONMENT DIVISION.           
INPUT-OUTPUT SECTION.           
FILE-CONTROL.                   
    SELECT MYFILE ASSIGN TO INDD
    ORGANIZATION IS SEQUENTIAL  
    ACCESS MODE IS SEQUENTIAL.  
DATA DIVISION.                  
FILE SECTION.                   
FD MYFILE.                      
01 FILERECORDS.                 
    05 NAME    PIC A(10).       
    05 CLASS-IN PIC 9(1).       
    05 ROLL    PIC 9(5).        
WORKING-STORAGE SECTION.        
COPY SCHMAPA.                   
COPY SCHMAPB.                   
COPY SCHMAPC.                   
01 END-OF-FILE PIC A(3) VALUE 'NO'.
PROCEDURE DIVISION.                
000-MAIN-PARA.                     
    PERFORM 100-SEND-MAPA.         
    PERFORM 100-RECEIVE-MAPA.      
    IF CHOICEI = '1'               
    PERFORM 200-SEND-MAPB          
    PERFORM 200-RECEIVE-MAPB       
    PERFORM 200-SEND-MAPB          
    PERFORM 100-SEND-MAPA          
    END-IF.                        
    IF CHOICEI = '2'               
    PERFORM 300-SEND-MAPC          
    PERFORM 300-RECEIVE-MAPC       
    PERFORM 500-SRCH-REC           
    PERFORM 300-SEND-MAPC          
        PERFORM 100-SEND-MAPA              
    END-IF.                            
    STOP RUN.                          
100-SEND-MAPA.                         
    EXEC CICS                          
    SEND                               
    MAP('SCHOLA') MAPSET('SCHMAPA')    
    ERASE                              
    END-EXEC.                          
100-RECEIVE-MAPA.                      
    EXEC CICS                          
    RECEIVE                            
    MAP('SCHOLA') MAPSET('SCHMAPA')    
    END-EXEC.                          
200-SEND-MAPB.                         
    EXEC CICS                          
    SEND                               
         MAP('SCHOLB') MAPSET('SCHMAPB')     
     ERASE                               
     END-EXEC.                           
 200-RECEIVE-MAPB.                       
     EXEC CICS                           
     RECEIVE                             
     MAP('SCHOLB') MAPSET('SCHMAPB')     
     END-EXEC.                           
     PERFORM 400-FILE-PROCESS.           
 300-SEND-MAPC.                          
     EXEC CICS                           
     SEND                                
     MAP('SCHOLC') MAPSET('SCHMAPC')     
     ERASE                               
     END-EXEC.                           
 300-RECEIVE-MAPC.                       
     EXEC CICS                           
         RECEIVE                            
    MAP('SCHOLC') MAPSET('SCHMAPC')    
    END-EXEC.                          
400-FILE-PROCESS.                      
    OPEN OUTPUT MYFILE.                
    MOVE NAMEI TO NAME.                
    MOVE CLASSI TO CLASS-IN.           
    MOVE ROLLI TO ROLL.                
    WRITE FILERECORDS.                 
    CLOSE MYFILE.                      
    MOVE 'RECORD INSERTED' TO MSGBO.   
500-SRCH-REC.                          
    OPEN INPUT MYFILE.                 
    PERFORM UNTIL END-OF-FILE = 'YES'  
         READ MYFILE INTO FILERECORDS 
       AT END                     
        MOVE 'YES' TO END-OF-FILE 
       NOT AT END                 
        IF ROLL =  ROLLCI         
        MOVE NAME TO NAMECO       
        MOVE CLASS-IN TO CLASSCO  
        END-IF                    
     END-READ                     
  END-PERFORM.                    
  CLOSE MYFILE.            
    

Getting error.

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

I have provided my cobol program. please check and help me to find the issue.

I am updating file from Cics region and using the same file to get the details and put in cics region.

Not sure why I am getting this error. Earlier I am using same Group data Item to add record to file and it is working fine. Please help !!

like image 830
Rahul Avatar asked Feb 08 '26 00:02

Rahul


2 Answers

While the other answers correctly answer your question, compiling for CICS entails some restrictions documented here and quoted as of 06-Apr-2021 below. You may also want to consult the CICS documentation for your version and release of CICS.

Restriction: You cannot run COBOL programs that have object-oriented syntax for Java™ interoperability in CICS. In addition, if you write programs to run under CICS, do not use the following code:

  • FILE-CONTROL entry in the ENVIRONMENT DIVISION, unless the FILE-CONTROL entry is used for a SORT statement
  • FILE SECTION of the DATA DIVISION, unless the FILE SECTION is used for a SORT statement
  • User-specified parameters to the main program USE declaratives (except USE FOR DEBUGGING)
  • These COBOL language statements:
  • ACCEPT format 1: data transfer (you can use format-2 ACCEPT to retrieve the system date and time)
  • CLOSE
  • DELETE
  • DISPLAY UPON CONSOLE
  • DISPLAY UPON SYSPUNCH
  • MERGE
  • OPEN
  • READ
  • RERUN
  • REWRITE
  • START
  • STOP literal
  • WRITE

[...]

Coding file input and output: You must use CICS commands for most input and output processing. Therefore, do not describe files or code any OPEN, CLOSE, READ, START, REWRITE, WRITE, or DELETE statements. Instead, use CICS commands to retrieve, update, insert, and delete data.

like image 73
cschneid Avatar answered Feb 12 '26 05:02

cschneid


READ MYFILE INTO FILERECORDS is a duplicate because those are already assigned to each other.
To fix that simply use READ MYFILE (the INTO somewhere would only be used if you don't want to place that into FILERECORDS but somewhere else).

like image 42
Simon Sobisch Avatar answered Feb 12 '26 06:02

Simon Sobisch