MIDRANGE dot COM Mailing List Archive



Home » MIDRANGE-L » September 2014

RE: Problem with EVAL of SQL proc



fixed

Scott,
RPG has lib_nam as 10A Varying

I did not get an error in RPG: SQLCODE was zero,
but lib_nam was returned 'blank'

From my very limited understanding, having div_lib
as declared as VARCHAR in SQL proc GETLIB was 'the issue'

I changed GETLIB SQL proc to be:
CREATE PROCEDURE SWIRETEST/GETLIB
(IN out_loc CHARACTER (4),
OUT div_lib CHARACTER(10)
)

GETLIB now returns div_nam with the expected library name for
the value supplied for out_loc.

This RPG is a 'wrapper' I'm using for testing, so I'm now focused
on the SQL proc which calls GETLIB.

Note the calling proc uses a variable named: 'lib_nam'

I'm working now to use lib_nam to build/prepare SQL to return
doc_num: the real 'business object' this project is about.

I intend SQL proc GETLIB to be a standard utility for us.

I hope to have something running tomorrow - thanks to this list
and the great support.



-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Mildenberger
Sent: Wednesday, September 03, 2014 1:35 PM
To: Midrange Systems Technical Discussion
Subject: RE: Problem with EVAL of SQL proc

How do you have the OUT variable defined in the RPG, is it varying? Where in the RPG do you get the error. We need to see how you are calling the procedure in the RPG and how the variables are defined.

Scott


-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Gary Thompson
Sent: Wednesday, September 03, 2014 1:27 PM
To: Midrange Systems Technical Discussion
Subject: Problem with EVAL of SQL proc

CREATE PROCEDURE TEST/GETLIB
(IN out_loc CHARACTER (4),
OUT div_lib VARCHAR(10)
)

LANGUAGE SQL
DETERMINISTIC
READS SQL DATA

P1: BEGIN
SELECT MAX(lclib) INTO div_lib
FROM test/locf
WHERE lcwhse = out_loc
AND lcbas IN ('S','V');
END P1

I have GETLIB in debug break on END P1
This works as I expect: EVAL *GETLIB.OUT_LOC:S
Returning: *GETLIB.OUT_LOC:S = "82 "

This fails: EVAL *GETLIB.DIV_LIB:S
As does this: EVAL *GETLIB.DIV_LIB:C
And this: EVAL *GETLIB.DIV_LIB:x 10
All return: Pointer type error occurred.

This does 'work' (kinda): EVAL %localvars
Returning:
EVAL %localvars
argc = 4
argv = SPP:FDF64C5B78009BE0
GETLIB.OUT_LOC = SPP:FDF64C5B78009CE0
GETLIB.SQLP_I1 = 0
GETLIB.DIV_LIB.LEN = 10
GETLIB.DIV_LIB.DAT = SPP:FDF64C5B78009CE8

Thanks to Chuck for the hint about typing HELP on the debug cmd line, but I did not see anything like VARCHAR - but apparently DIV_LIB is NOT a 'string' type ? and GETLIB.DIV_LIB.DAT, using my System/370 Reference Summary, does not decode into anything meaningful to me.

After about 10 presses of F10 I return to my SQLRPGLE where, surprisingly SQLCOD = 0, but, not surprisingly, the library name returned is blank.

Additional Message Information
Message ID . . . . . . : CPF7E18 Severity . . . . . . . : 40
Message type . . . . . : Diagnostic
Date sent . . . . . . : 09/03/14 Time sent . . . . . . : 13:00:13

Message . . . . : Pointer type error occurred.
Cause . . . . . : The identifier in position 21 of the input buffer is not a
pointer.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l.






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