MIDRANGE dot COM Mailing List Archive



Home » MIDRANGE-L » June 2014

Re: Attempting to use SQL HEX



fixed

On 11-Jun-2014 11:57 -0500, Alan Shore wrote:

Before I forget, we are on V5r4

In STRSQL I can execute the following SQL statement
select hex('QUESTION')
FROM SYSIBM/SYSDUMMY1
And get the response of:
D8E4C5E2E3C9D6D5

I need to do the same thing on a field in an SQLRPG program
Here is the code snippet

exec sql SET OPTION COMMIT=*NONE, DATFMT=*ISO, CLOSQLCSR=*ENDMOD;
exec sql DISCONNECT ALL;
exec sql CONNECT RESET;
Exec Sql
Select Hex(binaryHMAC) into :SQLHexEquivalent
From SYSIBM/SYSDUMMY1;

And when I compile the program, this is the error
SQL0206 30 250 Position 38 Column BINARYHMAC not in specified tables.

As always - any and all responses gratefully accepted


Probably the desired request is either

SET :SQLHexEquivalent = HEX(:binaryHMAC) ;

or [improbably]

SET :SQLHexEquivalent = HEX('binaryHMAC') ;

P.S. What is with the CONNECTION stuff? Was that coded due to some difficulties [in the past, and so carried into new code], as some precautionary action, or is there some specific purpose served by explicitly effecting what would typically be default behavior of an implicit connection to *LOCAL?






Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2014 by MIDRANGE dot COM and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available here. If you have questions about this, please contact