MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

VAR Graphic to character.

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
Magesh_J
Intermediate


Joined: 21 Jun 2014
Posts: 259
Topics: 54

PostPosted: Tue May 01, 2018 11:57 am    Post subject: VAR Graphic to character. Reply with quote

Hi,

Please advise, How do we convert to VARGRAPHIC to CHARACTER in SQL select ?

I am developing a cobol program to select records from a UDB table which has vargraphics fields.

When searched in google, ibm has provided following solution.
Code:

CALL "IGZCD2A" USING BY REFERENCE dbcs-item alpha-item
    BY CONTENT LENGTH OF dbcs-item LENGTH OF alpha-item


Is it possible to convert vargraphics to char in SQL itself, or we need to use above function ?

Or do we have an alternate method ?

Thanks
Magesh
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12366
Topics: 75
Location: San Jose

PostPosted: Tue May 01, 2018 1:14 pm    Post subject: Re: VAR Graphic to character. Reply with quote

Magesh_J wrote:


Is it possible to convert vargraphics to char in SQL itself, or we need to use above function ?


Magesh_J,

If your database is defined as Unicode database you can use CAST function to convert that into character data. Make sure the output Chat has atleast twice the size of vargraphic column. ( This works on z/OS DB2 but not sure about UDB)

Check this link which explains in detail about the CAST function

https://www.ibm.com/support/knowledgecenter/en/SSEPEK_10.0.0/sqlref/src/tpc/db2z_castspecification.html
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Magesh_J
Intermediate


Joined: 21 Jun 2014
Posts: 259
Topics: 54

PostPosted: Tue May 01, 2018 4:27 pm    Post subject: Reply with quote

Hi Kolusu,

Thanks, Wrote the SQL using CHAR(Variable), worked good.

please advise, how do we convert vargraphics to character in dfsort.

Regards,
Magesh
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12366
Topics: 75
Location: San Jose

PostPosted: Thu May 03, 2018 12:59 pm    Post subject: Reply with quote

Magesh_J wrote:
Hi Kolusu,

Thanks, Wrote the SQL using CHAR(Variable), worked good.

please advise, how do we convert vargraphics to character in dfsort.

Regards,
Magesh


Magesh_J,

Currently DFSORT does not have any built-in functions to convert graphical data. If your data is in plain hex, you can use TRAN function to UNHEX the data.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Magesh_J
Intermediate


Joined: 21 Jun 2014
Posts: 259
Topics: 54

PostPosted: Fri May 04, 2018 9:43 am    Post subject: Reply with quote

Thanks Kolusu.

Regards,
Magesh
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group