|
Length specification had been specified on the original DS.
Thanks so much for the clarifications Chuck (and Barbara).<ed> *if* the DS referenced in the LIKE had coded the length :-(
In trying to incorporate those into my code, I'm getting the SQL0312
when defining NMS_DS "like(NMS_OrderDetails)".
With just that change to my test program "TESTSTUFF" previously
posted...
* Global variables, constants, arrays
d Command s 1024a varying
d ParmInHex s 512a varying
old d**** NMS_DS s 115a based(NMS_DS@)
new d* NMS_DS gets Length established from a LIKE()
new d NMS_DS s like(NMS_OrderDetails)
new d based(NMS_DS@)
d NMS_DS@ s * inz(%addr(NMS_OrderDetails))
... the compiler pitches a fit:
exec sql
set :ParmInHex = 'X''' CONCAT HEX(trim(T FROM(:NMS_DS)))
CONCAT '''';
SQL0312: Position 55 Variable NMS_DS not defined or not usable.
Same issue if I use your set statement:
// Convert the data structuer to hex before passing to sbmjob command
exec sql
set :ParmInHex = 'X''' CONCAT HEX(:NMS_DS) CONCAT '''';
SQL0312: Position 43 Variable NMS_DS not defined or not usable.
Was this a capability corrected by a recent PTF? I thought we were
pretty current... I redefine NMS_DS with an explicitly defined length,
and it works fine.
<<SNIP>>
CRPence on Thursday, May 31, 2012 2:16 AM wrote:
On 30 May 2012 08:08, Koester, Michael wrote:
<<SNIP>>
Chuck, I agree setting up a hard-coded length of the data structure
is not optimal, but I'm at a loss as to how to avoid that. In my
testing, I initially set NMS_DS at 256a, and saw trailing junk
passed in the parm, but since the receiving program does not define
that area of the incoming string, there is no impact. Just needs to
be "big enough".
FWiW, I had determined that the length need not be coded if NMS_DS
is declared as shown here:
--
d* NMS_DS gets Length established from a LIKE()
d NMS_DS s like(NMS_OrderDetails)
d based(NMS_DS@)
And that although no explicit length was specified, the SQL allows
the usage of that standalone variable as a Host Variable; i.e. no
error SQL0312, as with naming a DS as a :HV in an expression.
Having the correct length, and no non-blank pad, the ParmInHex value
can be set to Hex(:NMS_DS) inside of the "X'" and "'"
*without* any TRIM activity. Thus simplified to what I originally
suggested:
// Convert the data structuer to hex before passing to sbmjob command
exec sql
set :ParmInHex = 'X''' CONCAT HEX(:NMS_DS) CONCAT '''';
<<SNIP>>
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.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 on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.