The original contents of this page have become obsolete, go to this page for up-to-date information.
Advice about programming, operations, communications, and anything else I can think of
The original contents of this page have become obsolete, go to this page for up-to-date information.
I have a couple of communications asking about how to "correctly" code a data structure to receive the data from and update a data area in the latest, all free, RPG. One of person even sent me their code, which I will be using for the basis for my examples.
While I am not sure if there is just one "correct" way to do this I will be giving my version of the following three scenarios:
I am not going to describe the basics of how to code Data Structures in free format in this post, as I covered this in Defining variables in RPG all free.
The original contents of this page have become obsolete, go to this page for up-to-date information.
In my earlier post Subroutines versus Subprocedures I described some of the advantages of using subprocedures rather than subroutines. In it showed how you could use, what I call "open" subprocedures. An "open" subprocedure does not have a procedure interface specifications, therefore all of the variables defined in the main line/body are available in the subprocedures, and if you change the contents of one of those variables the changed value is seen in the main line/body.
The other type of subprocedure I call "closed". The subprocedure can be passed parameters and can return a single variable, which can be data structure with multiple subfields. A "closed" subprocedure is should be placed in a separate module, therefore, they are now available for multiple program to use. As the main line/body can only change the variables they pass to the subprocedure and the subprocedure can only return one pre-defined variable there is no accidentally changing to the values of the variables.
Many people commented on that post explaining the advantages of the "closed" subprocedure. I do agree and below I will describe how I code them and their advantages, including one potential gotcha.
I was recently browsing a French IBM i website when I found links to two User Groups in France:
They share at forum at www.volubis.fr/forum/
I have added these links to this site's IBM i user groups page. You will find a link to the user groups page at the top of every page of this website.
Are there other user groups/clubs in France or anywhere else in the world? If you know of any not on the user groups page please use the Contact form to send me their details.