Page 1 of 1

Junk values inserted to DB2 table from COBOL program.

PostPosted: Wed Aug 20, 2014 5:58 pm
by jiteshyadav
Hi,

I am trying to insert a row to DB2 table with 2 columns EID (Numeric) & ENAME (Alphanumeric). Below is the DB2 query written in COBOL program:
          INITIALIZE DCLMEMBER                     
          MOVE 'ABCDEF'  TO ENAME OF DCLMEMBER     
          MOVE 11111           TO EID OF DCLMEMBER         
                                                   
          EXEC SQL                                 
              INSERT INTO MEMBER (EID,ENAME)       
                VALUES (:EID,:ENAME)               
          END-EXEC                                 


Below is the DCLGEN declaration:
******************************************************************
     EXEC SQL DECLARE MEMBER TABLE                               
     ( EID                            INTEGER NOT NULL,           
       ENAME                          CHAR(50)                   
     ) END-EXEC.                                                 
******************************************************************
* COBOL DECLARATION FOR TABLE MEMBER                             *
******************************************************************
 01  DCLMEMBER.                                                   
     10 EID                  PIC S9(9) USAGE COMP.               
     10 ENAME                PIC X(50).                           
******************************************************************
* THE NUMBER OF COLUMNS DESCRIBED BY THIS DECLARATION IS 2       *
******************************************************************


The EID field is inserted fine but Ename field seems to have junk values and rest '@' on all blank characters.
Below is a snapshot of the data inserted:
        EID  ENAME                                             
-----------  --------------------------------------------------
      83456  BT|@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@   


I can't figure out why this is happening. Any help will be highly appreciated.
Thanks.

Re: Junk values inserted to DB2 table from COBOL program.

PostPosted: Wed Aug 20, 2014 10:16 pm
by Akatsukami
The data are being interpreted as ASCII or UTC-n.

Re: Junk values inserted to DB2 table from COBOL program.

PostPosted: Thu Aug 21, 2014 9:01 am
by jiteshyadav
Akatsukami wrote:The data are being interpreted as ASCII or UTC-n.

Hi Akatsukami,

Thanks for your reply.
Is there any wayout to handle this ??

Re: Junk values inserted to DB2 table from COBOL program.

PostPosted: Thu Aug 21, 2014 1:28 pm
by jiteshyadav
Hi,

I got it.
I was missing ENCODING 1047 in my bind JCL. By default ENCODING value is UNICODE which is why I was seeing those junk values.

Thanks for your help.