View previous topic :: View next topic |
Author |
Message |
Magesh_J Intermediate
Joined: 21 Jun 2014 Posts: 259 Topics: 54
|
Posted: Tue May 01, 2018 11:57 am Post subject: VAR Graphic to character. |
|
|
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 |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12369 Topics: 75 Location: San Jose
|
Posted: Tue May 01, 2018 1:14 pm Post subject: Re: VAR Graphic to character. |
|
|
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
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
Magesh_J Intermediate
Joined: 21 Jun 2014 Posts: 259 Topics: 54
|
Posted: Tue May 01, 2018 4:27 pm Post subject: |
|
|
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 |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12369 Topics: 75 Location: San Jose
|
Posted: Thu May 03, 2018 12:59 pm Post subject: |
|
|
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 |
|
|
Magesh_J Intermediate
Joined: 21 Jun 2014 Posts: 259 Topics: 54
|
Posted: Fri May 04, 2018 9:43 am Post subject: |
|
|
Thanks Kolusu.
Regards,
Magesh |
|
Back to top |
|
|
|
|