View previous topic :: View next topic
|
Author |
Message |
iknow
Active User
Joined: 22 Aug 2005 Posts: 411 Location: Colarado, US
|
|
|
|
Hi folks,
I am using COBOL program to insert values in to a db2 table. The dclgen variables for varchar data type has a length field along with the data field. How to use that dclgen variable as host variable in an INSERT statement. Please help me.
Quote: |
Knowledge in your hands for your journey ahead |
|
|
Back to top |
|
|
ak1972
New User
Joined: 25 Aug 2005 Posts: 7
|
|
|
|
The length field tells you how many bytes to insert
MOVE DCLGEN-VAR-WITH-LEN (1:DCLGEN-LENGTH-VAR)
TO WS-VARCHAR-DATA
Then write your sql statement using WS-VARCHAR-DATA |
|
Back to top |
|
|
iknow
Active User
Joined: 22 Aug 2005 Posts: 411 Location: Colarado, US
|
|
|
|
Hi ak1972
Thanks for your reply.
I could'nt get the actual use of the Above statements why is it needed can you emphasize on it.
Thanks,
Muralikrishnan S |
|
Back to top |
|
|
krishnaiahc
New User
Joined: 31 Aug 2005 Posts: 21
|
|
|
|
Hai,
DCLGEN variable....
10 VBXSTMT-XACT-DESC.
49 VBXSTMT-XACT-DESC-LEN PIC S9(4) USAGE COMP.
49 VBXSTMT-XACT-DESC-TEXT PIC X(650).
data movement in COBOL::
MOVE LENGTH OF HAASTM-XACT-DESC
TO VBXSTMT-XACT-DESC-LEN
MOVE HAASTM-XACT-DESC-DTL TO VBXSTMT-XACT-DESC-TEXT
Host Variable in SQL statement::
EXEC SQL
INSERT INTO VBXSTMT
VALUES
(...
....
:VBXSTMT-XACT-DESC)
Please let me know if you have concerns...
Regards,
Krishna. |
|
Back to top |
|
|
|