VAR Graphic to character.
Select messages from
# through # FAQ
[/[Print]\]

MVSFORUMS.com -> Database

#1: VAR Graphic to character. Author: Magesh_J PostPosted: Tue May 01, 2018 11:57 am
    —
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

#2: Re: VAR Graphic to character. Author: kolusuLocation: San Jose PostPosted: Tue May 01, 2018 1:14 pm
    —
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

#3:  Author: Magesh_J PostPosted: Tue May 01, 2018 4:27 pm
    —
Hi Kolusu,

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

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

Regards,
Magesh

#4:  Author: kolusuLocation: San Jose PostPosted: Thu May 03, 2018 12:59 pm
    —
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.

#5:  Author: Magesh_J PostPosted: Fri May 04, 2018 9:43 am
    —
Thanks Kolusu.

Regards,
Magesh



MVSFORUMS.com -> Database


output generated using printer-friendly topic mod. All times are GMT - 5 Hours

Page 1 of 1

Powered by phpBB © 2001, 2005 phpBB Group