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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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