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 RULES(NOEVENPACK) in cobol jackzhang75 COBOL Programming 5 Wed Mar 29, 2017 12:47 am
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts Display FTP Session Count within TSO Yolanda Harvey TSO/ISPF 3 Fri Mar 10, 2017 10:31 pm
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm


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