|
I'm going to say no - what is being tested, then, is a numeric or alpha
constant, not an expression in the usual sense.
So let's say my_field = 15 - your CASE becomes
CASE 15 WHEN .... END
Even if this WOULD run, the only time it is true is when one of your test
values is 15.
It does appear that it COULD run - I just tried this in STRSQL -
select case 15 when 12 then 12 when 15 then 2 else 0 end from
sysibm/sysdummy1
It displays the number 2.
You probably want something like
CASE SOMEFIELD WHEN :my_field THEN some_value ELSE DEFAULT_VALUE END
HTH
Vern
On 2/24/2015 1:57 PM, Jeff Young wrote:
All,
Is there a way to use a host variable in a CASE statement as the field to
be tested?
ie: CASE :my_field WHEN .... END
Would that work?
Jeff Young
Sr. Programmer Analyst
--
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 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.