MIDRANGE dot COM Mailing List Archive



Home » MIDRANGE-L » June 2014

RE: Attempting to use SQL HEX



fixed

Thanks Chuck
In answer to your P.S. question - just precautionary

I changed the code to

Exec Sql
Set :SQLHexEquivalent = Hex(:binaryHMAC);
And got the same error

SQL0171 30 250 Position 17 Argument 1 of function HEX not valid.

And the IBM knowledge center not being available doesnt help

I then changed the code to
Exec Sql
Set :SQLHexEquivalent = Hex('binaryHMAC');
THIS did compile - but all I will be getting the the hex of the word binaryHMAC and not the value in the field binaryHMAC



Alan Shore
E-mail : ASHORE@xxxxxxxx
Phone [O] : (631) 200-5019
Phone [C] : (631) 880-8640
'If you're going through hell, keep going.'
Winston Churchill

-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of CRPence
Sent: Wednesday, June 11, 2014 1:34 PM
To: midrange-l@xxxxxxxxxxxx
Subject: Re: Attempting to use SQL HEX

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