|
Vern,
The discussion of SQL constants found at
http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/db2/rbafzmstch2cons.htm
might
help up some of the general confusion. The existence of a decimal point is a
rather large switch between integer and packed decimal. And the precision of
packed decimal values is determined by the number of leading (and trailing)
zeroes in the provided constant.
Note that this reference is discussing default assumptions made by SQL.
Calls to QCMDEXC do have additional considerations starting around V5R4.
Bruce
On Sun, Nov 7, 2010 at 11:15 PM, Vern Hamberg<vhamberg@xxxxxxxxxxx> wrote:
Dennis
Good point - must have been asleep. 15,5, as others pointed out, is the
default, so it just works.
So this got me thinking - because I've told this technique of filling
out all the numeric positions before - so I tried calling a program with
a packed 9,0 - passed 000000001 - it failed, since what it actually
passed was x'000000000100000F' into the 9,0, which is only 5 bytes long,
hence, data-decimal error. [call vern/testimg01
('AS400DOC-000000000002412', 1)]
This helps - I now can go back to what I always believed - about the
default length, and that we're not tricking it when using QCMDEXC.
Now I did call qcmdexc in SQL at v5r1 and got an error - here's the CALL -
call qcmdexc ('wrksyssts', 9)
This worked, as Birgitta said -
call qcmdexc ('wrksyssts', 0000000009.00000)
So in SQL, there's been some kind of translation or conversion going on,
it seems. Not CL, but SQL - interesting. How to try my test with the
packed 9,0 -
This failed with something about attributes of parameter 2 being invalid -
call vern/testimg01 ('AS400DOC-000000000002412', 1)
So I tried this
call vern/testimg01 ('AS400DOC-000000000002412', 000000001)
and got the same error - hmm, it's 9,0 and I put 8 zeroes and the 1 in
there. So I tried adding a decimal point at the end, as here -
call vern/testimg01 ('AS400DOC-000000000002412', 000000001.)
And that worked!
I don't know how long SQL has done this, and apparently, according to
Birgitta, a more recent change has taken place.
Verrrrry interesting. Learn new things all the time! Love it!
Vern
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.