As I understand it, you have a DS in /copybook and both your single IO service program and all programs reference that /copybook.
Example:
Dcl-ds myDS qualified template;
Field1 char(20) ;
Field2 char(20);
Field3 packed(7:2);
End-ds;
How do you prevent errors when you change the /copybook and recompile IO service program without changing the programs?
Example:
Dcl-ds myNewDS qualified template;
Field1 char(40) ;
Field2 char(40);
Field3 packed(8:2);
End-ds;
-----Original Message-----
From: dlclark@xxxxxxxxxxxxxxxx [mailto:dlclark@xxxxxxxxxxxxxxxx]
Sent: Thursday, October 27, 2016 9:24 AM
To: RPG programming on the IBM i (AS/400 and iSeries) <rpg400-l@xxxxxxxxxxxx>
Subject: Re: Externalizing I/O
"RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxx> wrote on 10/27/2016 10:02:18
AM:
So the question is how to get the data to/from that PF without tying
every RPG program to a static format.
The way we went was to use an MVC-like architecture
(view-controller-servicelayer-model) and use RPG-generated data structures for our SQL tables. This data structure definitions for tables and views are in copybooks for the MVC service layer and DAO model and is simply included in all referencing programs as needed.
The trick here is that the SQL statements cannot use SELECT * and must list all the columns for retrieval. UPDATE and INSERT statements are in the same category but we use extended indicator arrays to control which columns are UPDATEd or INSERTed at any given time. This way only a single UPDATE or INSERT statement is required but you still get the flexibility of not having to UPDATE or INSERT all columns at once.
Then, the parameter interfaces use OPTIONS(*VARSIZE) for the data structure parameter so that additional columns can be added without having to recompile all referencing programs. That is, of course, until particular referencing programs actually need the new columns. At that point, only those programs that need the new columns need to be recompiled in order to let RPG generate the new data structure layout for those programs based on the copybook previously mentioned.
Sincerely,
Dave Clark
--
int.ext: 91078
direct: (937) 531-6378
home: (937) 751-3300
Winsupply Group Services
3110 Kettering Boulevard
Dayton, Ohio 45439 USA
(937) 294-5331
*********************************************************************************************
This email message and any attachments is for use only by the named
addressee(s) and may contain confidential, privileged and/or proprietary information. If you have received this message in error, please immediately notify the sender and delete and destroy the message and all copies. All unauthorized direct or indirect use or disclosure of this message is strictly prohibited. No right to confidentiality or privilege is waived or lost by any error in transmission.
*********************************************************************************************
As an Amazon Associate we earn from qualifying purchases.