× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I found the "DB2 Universal Database for iSeries Embedded SQL" manual
useful, it contains info on using SQL embedded in other languages like
RPGLE or C. However, it sort of assumes you know SQL already.

The answer to your problem was in there, "All host variables within an SQL
statement must be preceded by a colon (:)."

Stu



On Fri, Sep 6, 2013 at 1:14 PM, arthur perkins <atrain01us@xxxxxxxxx> wrote:

Thanks for the reply! That did it!

Are there any websites I can check out or books I can buy that would be
good for someone like me who wants to learn SQL without being
overwhelmed?

Thanks again for the info!

Arthur


________________________________
From: Scott Mildenberger <SMildenberger@xxxxxxxxxxxxxxxxxx>
To: RPG programming on the IBM i (AS/400 and iSeries) <
rpg400-l@xxxxxxxxxxxx>
Sent: Friday, September 6, 2013 1:57 PM
Subject: RE: Newbie To Procedures With Problem


Need a colon in front of the field name OrgComp# like

exec sql select * into :ds_dbifgls from dbifgls where DGLSCMPNY =
:OrgComp#;

Not related to being in a procedure at all, just the SQL syntax.

Scott Mildenberger
Programmer/Analyst
Davis Transport Inc.
Missoula, MT
406-728-5510 x128

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of arthur perkins
Sent: Friday, September 06, 2013 10:28 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: Newbie To Procedures With Problem

Hi all,

I'm new to the world of procedures. I am in the process of learning to
develop procedures on the Iseries and have run into the following problem:

I am developing a procedure that takes an alphanumeric field and converts
it to numeric. My problem is that I defined the local variable in the
procedure yet the compile crashes because it says it can't find the object.
The code in question is below:

d GetPostDate pr like(postdate) d
org1 like(emporgun1) value



GetPostDate b GetPostDate pi like(postdate)
Org1 like(emporgun1) value
ReturnValue s like(postdate) OrgComp#
s 4 0
free


// Convert the company# from character to numeric for the SQL exec
command.


OrgComp# =
%dec(Org1:4:0);


// Retrieve the record from DBIFGLS for the company being
processed.


exec sql select * into :ds_dbifgls from dbifgls where DGLSCMPNY =

OrgComp#;

Here is the error message from the compile below:

...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7
...+... 8
exec sql set option commit = *none, naming = *sys;

OrgComp#;

Position 36 Object ORGCOMP# in *LIBL not found.

To me, everything looks ok and is a relativly simple procedure. What am I
doing wrong or missing?

Thanks,

Arthur
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.