I assume you have finite limits for these arrays – that is, for each code entry, there is a fixed (or maximum) number of hours worked entries?
Usually, I would do this as two arrays – the first would be code (say, 50 entries), and the second hours worked.
If there are never more than 10 hours worked entries for any code, then the hours worked array will be 10 * 50 entries.
Entries 1 to 10 will be reserved for the code value in the code array element 1.
Entries 11 to 20 will be reserved for the code value in the code array element 2…
…and so on.
You can see that for any code entry you can use arithmetic to get the start element number for the matching list of elements in the hours worked array.
You can ‘hide’ the code you write to manipulate the arrays, by using procedures to write to and read from the arrays. Then in the body of your code you can use the procedure calls and pass parameters to identify what you want to write and what you want to read.
This is a very simple, even crude, way of looking at your problem, but for most purposes it will work. If your requirements are more sophisticated, please describe them more fully and I’ll come back with some refinements!
The easiest way for your case is probably something like this:<pre>
D aHrs ds dim( 2 ) qualified
d Code 2
d HrsWorked 3p 1 dim( 5 )</pre>