
%copyDS2array(&dsname:&ArrayElements:&ArrayValues)Otherwise I had to solve it with an external data structure field map...


One array that stores the element names and one array that stores the (to text) converted field values.
...and...
In php or other language you can use assosiative arrays.
Generally, no.
Using PHP as the primary example, many such languages are "interpreted" rather than compiled. (Yes, there now are some "compilers" for PHP, but they are necessarily platform-dependent. Further, there can be major differences between interpreting source to byte-code and actual "compilation".)
Languages intended to be interpreted generally have a much easier time with this kind of thing. Compiled procedural languages often have no such ability, usually because they don't make sense in their optimized environments.
And when it gets turned into a question that appears to be about dynamic references to variable names (i.e., "field data from an RPG-data structure"), it goes in an unlikely direction. The field names themselves aren't even available to the compiled program (except potentially in debug mode when debug data is left in the module).
But the question is about a very specific technical problem that might have no solution. Instead, please see if you can rephrase it into a business problem. What is the activity that you need to perform? I.e., what are you trying to do? Maybe a resolution can be seen from a different angle.
As for the question portion about "(transformed in to characters)", see the EVAL-CORR (Assign corresponding subfields) as a potential starting point. The target DS could, for example, use ZONED subfields to achieve initial character representations of numeric values.
Tom
You can use “OCCUR” directly
Example:
D QLI DS OCCURS(5)
D PRODOT 1 1
D PQLI01 2 12 4
D PQLI02 13 23 4
D PQLI03 24 34 4
D PQLI04 35 45 4
D PQLI05 46 56 4
D PQLI06 57 67 4
D PQLI07 68 78 4
D PQLI08 79 89 4
D PQLI09 90 100 4
D PQLI10 101 111 4
D PQLI11 112 122 4
D PQLI12 123 133 4
D PQLITO 134 144 4
…..
…..
C 1 DO 5 Y
C Y OCCUR QLI
C Z-ADD 0 PQLITO
C Z-ADD 0 PQLI01
C Z-ADD 0 PQLI02
C Z-ADD 0 PQLI03
C Z-ADD 0 PQLI04
C Z-ADD 0 PQLI05
C Z-ADD 0 PQLI06
C Z-ADD 0 PQLI07
C Z-ADD 0 PQLI08
C Z-ADD 0 PQLI09
C Z-ADD 0 PQLI10
C Z-ADD 0 PQLI11
C Z-ADD 0 PQLI12
C ENDDO
otherwise traditional method use “MOVEA” instruction.
Bye


You can overlay an array in a data structure:
Tom, thank you for your answer.
I just thought it were not possible, but I was not sure about it.
I´m looking for an easy way to communicate with a client thru a socket from
a server side RPG-program and push data to the client and back, basing on a associative array, that I would wrap into delimters (XML or anything else).
So it had been much more comfortable, to operate the fields with a less number of statements – and I could avoid coding all fields individually. Especially for data structures with many fields it is better to code lesser.
(XML or anything else)
In that case, the next suggestion is to go to the i 6.1 Information Center, type { rpg AND xml } (minus the braces) into the search box at the top of the left-hand navigation pane and start at the very first search result. After that, pick a few of the remaining results to get a general feel for things.
Tom
I might have done something similar to what you are trying to do and used “Splats” suggestion. Here’s the snippet:
http://www.code400.com/forum/showthread.php/11176-XML-INTO-Question?p=66361#post66361