I am not sure what I am doing wrong. It must be something silly that I am missing. Please see the examples below.
So imagine that ID1..ID5 are fields in a file(such as below). Here I am trying to put them in an array when the record is read. If I use the first definition this works perfectly. However when I use the second and third definitions I get the error message "RNF4138: Externally-Described Field used as array name. Definition specification is ignored.", and the programs doesn't compile. Once in a while I have a need to do it this way...
Code:
d ds dmyids 10 0 dim(5) d id1 1 10 0 d id2 11 20 0 d id3 21 30 0 d id4 31 40 0 d id5 41 50 0 d ds d myids 10 0 dim(5) d id1 10 0 overlay(myids) d id2 10 0 overlay(myids:*next) d id3 10 0 overlay(myids:*next) d id4 10 0 overlay(myids:*next) d id5 10 0 overlay(myids:*next) dcl-ds *n; myids zoned(10:0) dim(5); id1 zoned(10:0) overlay(myids); id2 zoned(10:0) overlay(myids); id3 zoned(10:0) overlay(myids); id4 zoned(10:0) overlay(myids); id5 zoned(10:0) overlay(myids); End-Ds;
Code:
A R RTEST41P A ID1 10 0 A NAME1 20 A ID2 10 0 A NAME2 20 A ID3 10 0 A NAME3 20 A ID4 10 0 A NAME4 20 A ID5 10 0 A NAME5 20
Comment