Re: What is wrong?
- From: Jonathan Ball <jonball@xxxxxxxxxxxxxx>
- Date: Fri, 25 Jan 2008 12:04:18 -0800
qgenesist@xxxxxxxxxxx wrote:
On Jan 24, 3:33 pm, CRPence <crpe...@xxxxxxxxxxxx> wrote:Understood. However the quoted snippet of my most recent response,
snipped too much of that response; look again ;-) The quoted snippet to
which I responded, should have made it clear that I was responding first
to the comment that the "crtrpgmod does not understand sql." And second
about how to setup to call the procedure to test and debug -- using SQL.
Anyhow, although obviously CRTRPGMOD is not going to like /EXEC SQL,
if the OP did not have a problem with CRTRPGMOD, then one has to wonder
why the quoted comment was even written? Perhaps my post was for
naught, with regard to progressing toward resolution of the issue, but
it did address the quoted comment with respect to the given source.
Besides, my not-so-ulterior motive was to get the OP to consider that
there was possibly little reason to make an effectively pure SQL
procedure from RPG when it could be done simply instead, as a purely SQL
routine; as coded, an SQL function. :-)
Regards, Chuck
--
All comments provided "as is" with no warranties of any kind
whatsoever and may not represent positions, strategies, nor views of my
employer
Jonathan Ball wrote:On Jan 24, 12:43 pm, CRPence <crpe...@xxxxxxxxxxxx> wrote:- Show quoted text -The /EXEC SQL and /END-EXEC are not RPG, they are tags to denote whatThe original poster isn't having trouble with the embedded SQL. His
a pre-compiler is supposed to convert into RPG. They are directives to
the SQL precompiler, that the upcoming and prior source is to be
interpreted as embedded SQL source, rather than as RPG source. Use
CRTSQLRPGI OBJTYPE(*MODULE) to create an SQLRPG module.
problem is ILE and RPGLE concepts: he has a subprocedure in his code,
and no way of calling it. Look again.
[...]- Hide quoted text -
And indeed, you have given me some thought. All of you have been
helpful and I now have my little guy working. As I have stated, this
a trivial example...
Now, Mr Pence ------
so I type all your code into a source member and create it how?
then you are saying in some sundry RPG pgm I can do
eval input = rtvctl#(wo#)
as if it were a procedure of any sort?
I don't care how I get there, but I do want to have more expressive
ability available to me.
Unfortunately, after many years in the RPG world, I had to do COBOL,
and the way the interfaces were done and written were clunky and quite
a bit different than this, so now I am catching up.
I guess it's hard to know how to suggest you proceed without knowing more about what it is you're trying to achieve. If you have just a one-off requirement to get the controlling work order number for some (subordinate?) work order, then I wouldn't bother with a separate program or service program at all; just put the code in the one program that needs to do this.
But if you're trying to develop a routine that could be used at multiple points in your overall application to bring back the controlling work order number, then there are a couple of avenues open. One is to put the SQL statement - a simple SELECT INTO..., without the cursor fol-de-rol - into a module that exports an ILE procedure. You then could bind this module with your other programs, or perhaps put it in a service program that is bound with the other programs, and invoke the procedure as you indicate above:
eval input = rtvctl#(wo#)
Note that this is an ILE procedure, /not/ a SQL procedure (or function).
Another would be to create an SQL function, either using the SQLP language or SQLRPGLE. Then, in your application programs (assumed to be SQLRPGLE), you could code
c/exec sql
c+ set :input :ni = mylib.sqlrtvctl#(:wo#)
c/end-exec
Notes:
1. This is an SQL function, not an RPGLE procedure
2. The host variable :ni is a null indicator; you
don't always need them, but it's a good idea,
as it prevents costly error messages from being thrown.
.
- References:
- What is wrong?
- From: qgenesist
- Re: What is wrong?
- From: Saml
- Re: What is wrong?
- From: Hauser@xxxxxxxxxxxxxxx
- Re: What is wrong?
- From: qgenesist
- Re: What is wrong?
- From: CRPence
- Re: What is wrong?
- From: qgenesist
- Re: What is wrong?
- From: CRPence
- Re: What is wrong?
- From: Jonathan Ball
- Re: What is wrong?
- From: CRPence
- Re: What is wrong?
- From: qgenesist
- What is wrong?
- Prev by Date: Re: Check from iSeries if PC app is installed
- Next by Date: Condition fields in subfile when SFLPAG <> SFLSIZ
- Previous by thread: Re: What is wrong?
- Next by thread: Re: What is wrong?
- Index(es):
Relevant Pages
|