× 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.



Named constants can't be used as host variables in imbedded SQL. This
technique can be used as a work-around:

d is_active c '1'
exec sql select * from atable where rcd_status = :is_active

! Host variable not defined


d is_active c '1'
d active_code s 1a inz( is_active )
exec sql select * from atable where rcd_status = :active_code

! Success

On 5/3/07, Kent Hohlen <khohlen@xxxxxxxxxxxxxxx> wrote:

Thanks for all the input. Let me add this to the mix.

Let's talk about fields initialized with a value. Like below.

D Print s Like( @Button )
Inz( 'Print' )

/Free
If @Button = Print;
Do_something;
EndIf;
/End-Free

Compared to this.

/Free
If @Button = 'Print';
Do_something;
EndIf;
/End-Free

What I like about the first example over the second is validation. If I
compare 10 different fields to Print, I'm guaranteed that each field will
be
comparing for the value of (Print). But if I use the second example to
compare 10 different fields to the value of ('Print'), then the only
guarantee that I have is that the field will only be compared to the value
that I typed in 10 times. In the first example, if I type If @Button =
Prnt, the compiler will kick it out as an error. In the second example,
if
I type it like this If @Button = 'Prnt' or like this If @Button = 'print',
the only indication I'll get that there is a problem is when the program
doesn't work as expected and I'll have to debug it.

Kent Hohlen
Eagle Window And Door
--
This is the RPG programming on the AS400 / 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 ...

Follow-Ups:
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.