Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to use DCLGEN variable as host variable in INSERT stmt

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
iknow

Active User


Joined: 22 Aug 2005
Posts: 413
Location: Colarado, US

PostPosted: Fri Sep 30, 2005 6:29 am    Post subject: How to use DCLGEN variable as host variable in INSERT stmt
Reply with quote

icon_question.gif 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
View user's profile Send private message

ak1972

New User


Joined: 25 Aug 2005
Posts: 7

PostPosted: Sat Oct 01, 2005 6:48 am    Post subject:
Reply with quote

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
View user's profile Send private message
iknow

Active User


Joined: 22 Aug 2005
Posts: 413
Location: Colarado, US

PostPosted: Tue Oct 04, 2005 9:40 am    Post subject: Re: How to use DCLGEN variable as host variable in INSERT st
Reply with quote

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
View user's profile Send private message
krishnaiahc

New User


Joined: 31 Aug 2005
Posts: 21

PostPosted: Fri Oct 28, 2005 5:17 am    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to insert a value on specific pos... Poha Eater DFSORT/ICETOOL 9 Sun Oct 01, 2017 3:04 am
No new posts Insert a Row_number into table useit DB2 2 Tue Sep 19, 2017 1:07 pm
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts Move from Comp3 variable to Edited Va... sreekusr COBOL Programming 8 Thu Aug 10, 2017 4:20 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us