Avatar of erwingosepa
erwingosepa asked on

Get variable name in RPG

I have the the following variables in RPG
D @52            S             80  
D @53            S             80  
D @54            S             80

Those variables can be filled with anything with max of 80 character
Now, I want is the following. In the RPG Program I need the value @52, @53, @54 which are the variable names.
How can I get the variable name @52 in another variable. It should be extracted from the variable itself.
This example is not what I want.
C                   MOVEL     '@53 '       @53
This is the kind of solution I was looking for
C                   MOVEL     %Name(@53)   @Target

So the @Target should have '@53' when ready.
Please advise me, an example is highly appreciated.
IBM System i

Avatar of undefined
Last Comment
Member_2_276102

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Member_2_276102

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
SOLUTION
LewisPower

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Member_2_276102

erwingosepa:

Your examples explicitly show variables that are _defined_ within the RPG program. I don't know if that's the case that you have or if you showed it just for illustration purposes.

Can you clarify if these actually are RPG program-defined variables rather than, say, variables that are externally-defined through a database format or display format?

Tom
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy