× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hello everyone,


I was setting up an interface to an other system, and had a little RPG issue.


I had an interface passing data based on a datastructure which can contain arrays. For example:

Dcl-Ds tInterfaceDs Template Qualified;

NbElements Zoned(3);

LsElements LikeDs(tElementDs) Dim(10);

SwImportant Ind;

End-Ds;


Now in RPG, even if only 3 elements are filled in the array, the space for the empty elements will be reserved. The value of SwImportant will be positioned after the 10 elements. So the address of the switch is at: address datastructure + size(NbElements) + 10 * size(LsElements)

On the other side of the interface they have dynamic list types. So when only 3 elements are filled they only expect 3 elements. They value of the switch is expected after the 3 elements. So the address of the switch is at: address datastructure + size(NbElements) + 3 * size(LsElements)


This interface is still being used for other systems, and they had a component which mapped each list to a dynamic list (in COBOL). This component could not be added to our architecture.

For most interfaces, we differentiated between the two interfaces (the old system and the new system without the mapping).

When there was only one list, I moved it to the end of the datastructure, since it doesn't trigger issues if the empty elements are at the end of the data being passed.

But if there was more than one list in a certain datastructure, we had to resort to mapping the data to the correct position by manipulating their address pointers. This works great, but lowers readability a lot.


This whole approach seemed a bit forced, and I got the feeling that there should be a better approach. How would you have approached this issue?

Are there any plans for dynamic arrays, allowing variables in the Dim keyword like they do for COBOL in OCCURS ... DEPENDING ON?


Thanks in advance,

Joni



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.