Skip to main content

Problem:

We are seeing an compiler error on some EXEC SQL statements. It is 'COBCH1113E Imperative statement missing - CONTINUE assumed.' Why does our code get these errors?

011300 OPEN-CURSOR.                                                      

011400     IF CD52-REQUESTED-ALL                                         

011500         EXEC SQL                                                  

011600             DECLARE TXNS_CSR_ALL CURSOR FOR                       

011700             SELECT BTX_PID,                                       

011800                    BTX_ACCNO,                                    

011900                    BTX_TIMESTAMP,                                 

012000                    BTX_AMOUNT,                                    

012100                    BTX_DATA_OLD                                   

012200             FROM BNKTXN                                           

012300             WHERE BTX_TYPE = :WS-TXN-TYPE                        

012400             FOR FETCH ONLY                                        

012500        END-EXEC                                                   

012600     ELSE                                                          

012700         EXEC SQL                                                  

012800             DECLARE TXNS_CSR_SEL CURSOR FOR                       

012900             SELECT BTX_PID,                                       

013000                    BTX_ACCNO,                                    

013100                    BTX_TIMESTAMP,                                 

013200                    BTX_AMOUNT,                                    

013300                    BTX_DATA_OLD                                   

013400             FROM BNKTXN                                           

013500             WHERE (BTX_TYPE = :WS-TXN-TYPE AND                    

013600                    BTX_PID = :CD52I-PID)                          

013700             FOR FETCH ONLY                                        

013800        END-EXEC                                                   

013900     END-IF                                                        

014000     IF SQLCODE IS EQUAL TO ZERO                                   

014100        IF CD52-REQUESTED-ALL                                      

014200           EXEC SQL                                                

COBCH1113E Imperative statement missing - CONTINUE assumed.  : C:\\MFE\\Projects\\Source\\SQL\\ .CBL(126,15)

COBCH1113E Imperative statement missing - CONTINUE assumed.  : C:\\MFE\\Projects\\Source\\SQL\\ .CBL(139,17)

Resolution:

What the Mainframe Express compiler is trying to say is that there is no code between the IF and the ELSE and the ELSE and the END-IF because a EXEC SQL DECLARE is not really generating any executable code. There are two possible answers:

- Code the EXEC SQL DECLAREs in Working Storage or just above an OPEN CURSOR

- Change the IF/ELSE to use it current form and right after the END-EXEC for the DECLAREs

   (after lines 012500 and 013800), code an OPEN CURSOR for each cursor.

Old KB# 2560

#EnterpriseDeveloper
#MFDS