7

How can I move a record from oracle to a Cobol array? When I move a single field, everything works as expected. When I try to move a record in an Oracle VARRAY I cannot get it to work. The PRO*COBOL precompiler gives the following error message:

Error at line 137, column 12 in file ESF3.ordbso07.PCO
            EXEC SQL EXECUTE      
 ...........1
 PCB-S-00576, PLS-382: expression is of wrong type
 Error at line 137, column 12 in file ESF3.ordbso07.PCO
            EXEC SQL EXECUTE      
 ...........1
 PCB-S-00576, PLS-0: Statement ignored

Oracle types:

TYPE QDELSSRD_arr IS VARRAY(30) OF QDELSSRD_typ;

TYPE SODLSSRD_typ IS RECORD ( -- DBSO07 SOK
    QDELSSRD             QDELSSRD_arr -- 30 x QDELSSRD_typ

OC is SODLSSRD_typ;
TYPE QDELSSRD_typ IS RECORD (
    ENAMN                arbetssokande.efternamn%type, -- VARCHAR2(30 CHAR)
    FNAMN                arbetssokande.fornamn%type, -- VARCHAR2(20 CHAR)
);

Snippet of COBOL ESQL anonymous PL/SQL block:

FOR LV IN 1..:RC-ZHITS
LOOP
    :QDELSSRD(LV) :=  OC.QDELSSRD(LV);
 END LOOP;

COBOL variable declaration:

     15     QSODLSSRD.
            18     QDELSSRD                      OCCURS 30.
                   21     ENAMN                         PIC X(030).
                   21     FNAMN                         PIC X(020).
Jonathan Leffler
  • 666,971
  • 126
  • 813
  • 1,185

1 Answers1

0

I think you need to use VARYING... For example:

18     QDELSSRD                      VARYING OCCURS 20 TIMES. 
 21     ENAMN                         PIC X(030).    
 21     FNAMN                         PIC X(020). 

http://www.pitt.edu/~hoffman/oradoc/server.804/a58232/ch04.htm

Stephen Gennard
  • 1,921
  • 16
  • 21