I can deal with no available function, just wanted to make sure I wasn't missing an easy conversion.
Kevin Bucknum <Kevin@xxxxxxxxxxxxxxxxxxx> 6/7/2019 10:24 AM >>>
I think you are looking for something like PHP's variable variables. There is no simple comparable feature in RPGLE.
https://www.php.net/manual/en/language.variables.variable.php
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of Buddy McClean
Sent: Friday, June 07, 2019 10:11 AM
To: RPG programming on IBM i
Subject: RE: Field Names
I was trying to avoid the compare/selects, hoping I was just missing something in a simple statement or 2.
Duane Scott <dscott@xxxxxxxxxxx> 6/7/2019 9:57 AM >>>
Would something like this work:
Select;
When Field1 = 'FIELD2';
<do something with FIELD2>
When Field2 = 'FIELD3';
<do something with FIELD3>;
Other;
<do entirely something else >;
Endsl;
Duane
-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Buddy McClean
Sent: Friday, June 7, 2019 10:46 AM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: Field Names
Thanks, unfortunately I know zilch about SQL.
B Stone <bvstone@xxxxxxxxx> 6/7/2019 9:36 AM >>>
Dynamic SQL would probably be the best way. Build the select statement using the name of the field to select data from.
Bradley V. Stone
).
On Fri, Jun 7, 2019 at 9:33 AM Buddy McClean wrote:
Good Day,
Perhaps a silly question and an obvious answer, but I seem to have a
bit of fog about it.
What is the best way to translate a field that contains the name of
another field to be able to reference the second field. Other than do
a bunch of compares.
DCL-S Field1 char(8) INZ('FIELD2')
To be able to use FIELD2 in calculations. FIELD2 is an actual field in
a record, but I only have the literal name of the field.
CONFIDENTIALITY NOTICE: This electronic message transmission is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. If you have received this transmission, but are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of the contents of this information is strictly prohibited. If you have received this e-mail in error, please contact NALC Health Benefit Plan at 703-729-4677 and delete and destroy the original message and all copies.
--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
https://amazon.midrange.com
--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
https://amazon.midrange.com
[
https://www.medtronsoftware.com/img/MedtronMinilogo.bmp] Kevin Bucknum
Senior Programmer Analyst
MEDDATA / MEDTRON
120 Innwood Drive
Covington LA 70433
Local: 985-893-2550
Toll Free: 877-893-2550
https://www.medtronsoftware.com
CONFIDENTIALITY NOTICE
This document and any accompanying this email transmission contain confidential information, belonging to the sender that is legally privileged. This information is intended only for the use of the individual or entity named above. The authorized recipient of this information is prohibited from disclosing this information to any other party and is required to destroy the information after its stated need has been fulfilled. If you are not the intended recipient, or the employee of agent responsible to deliver it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or action taken in reliance on the contents of these documents is STRICTLY PROHIBITED. If you have received this email in error, please notify the sender immediately to arrange for return or destruction of these documents.
As an Amazon Associate we earn from qualifying purchases.