Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to Display Varchar value in DB2 in cobol hostvariable ?

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

New User


Joined: 04 Mar 2007
Posts: 14
Location: Chennai

PostPosted: Thu Apr 10, 2008 12:14 am    Post subject: How to Display Varchar value in DB2 in cobol hostvariable ?
Reply with quote

Hi,

I have a DCLGEN declaration like this

DB2 declaration
empname VARCHAR(20)
---------------------------------------------------
cobol host variable declaration
01 emp.
05 hv-empname.
49 hv-emp-len PIC S9(4) COMP-2.
49 hv-emp-txt PIC X(20).
----------------------------------------------------
EXEC SQL DECLARE <cursorname> CURSOR FOR
SELECT empname from emp
END-EXEC.

then fetching the data

EXEC SQL FETCH <cursorname> INTO :hv-empname

My pbm is when i try displaying this hv-empname , i am getting <.<data in empname> (dot followed by data in empname)

Kindly update me how to display a VARCHAR db2 data in to host variable in cobol ?
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Apr 10, 2008 12:17 am    Post subject:
Reply with quote

Hello,

You cannot "display" the group variable - the first field will nearly always contain one or more undisplayable values.

To see the name and not the "unprintable" data, try displaying hv-emp-txt.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Thu Apr 10, 2008 3:43 am    Post subject:
Reply with quote

Something like
DISPLAY hv-emp-len '*' hv-emp-txt(1:hv-emp-len) '*'
should get you what you want.....
Back to top
View user's profile Send private message
diwakar_rao

New User


Joined: 04 Mar 2007
Posts: 14
Location: Chennai

PostPosted: Thu Apr 10, 2008 9:25 am    Post subject:
Reply with quote

Thanks it is working now
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 XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts Display upon console bipinpeter COBOL Programming 1 Thu Jun 22, 2017 12:35 am
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm
No new posts Search utility(3.14) using JCl and Cobol RKS3 COBOL Programming 12 Sat Jun 10, 2017 10:24 pm
No new posts COBOL DB2 program - zIIP eligible vasanthz COBOL Programming 7 Wed May 31, 2017 5:12 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us