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
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 *
******************************************************************
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|@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
----------- --------------------------------------------------
83456 BT|@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
I can't figure out why this is happening. Any help will be highly appreciated.
Thanks.