Junk values inserted to DB2 table from COBOL program.



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Junk values inserted to DB2 table from COBOL program.

Postby jiteshyadav » Wed Aug 20, 2014 5:58 pm

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.
jiteshyadav
 
Posts: 22
Joined: Tue Apr 15, 2014 3:36 pm
Has thanked: 0 time
Been thanked: 0 time

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

Postby Akatsukami » Wed Aug 20, 2014 10:16 pm

The data are being interpreted as ASCII or UTC-n.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

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

Postby jiteshyadav » Thu Aug 21, 2014 9:01 am

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 ??
jiteshyadav
 
Posts: 22
Joined: Tue Apr 15, 2014 3:36 pm
Has thanked: 0 time
Been thanked: 0 time

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

Postby jiteshyadav » Thu Aug 21, 2014 1:28 pm

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.
jiteshyadav
 
Posts: 22
Joined: Tue Apr 15, 2014 3:36 pm
Has thanked: 0 time
Been thanked: 0 time


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post