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 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 IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts display the sign only if the value is... useit DFSORT/ICETOOL 3 Wed Oct 04, 2017 5:53 pm
No new posts Assembler Macro Copybook converted to... Ziquilix PL/I & Assembler 4 Tue Sep 26, 2017 3:07 am
No new posts Binary to display characters Roy Ware SYNCSORT 3 Tue Sep 19, 2017 8:46 pm
No new posts DB2 NULL Values display V S Amarendra Reddy DB2 3 Thu Sep 07, 2017 6:59 pm

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