Re: Writing an Open Access handle that will either read/write to the Db2 file or make a REST call
Subject: Re: Writing an Open Access handle that will either read/write to the Db2 file or make a REST call
From: "D*B" <dieter.bender@xxxxxxxxxxxx>
Date: Wed, 16 Jan 2019 20:25:42 +0100
Arc-authentication-results: i=1; mx.google.com; spf=neutral (google.com: 126.96.36.199 is neither permitted nor denied by best guess record for domain of dieter.bender@xxxxxxxxxxxx) smtp.mailfrom=dieter.bender@xxxxxxxxxxxx
Because an API call cannot take advantage of RPG's automatic data
marshalling features. I often think that this was a major factor in the slow
adoption by RPGers in general of web programming. Having to call an API for
each and every field that is to be sent to the browser is a very different
thing from simply doing (say) EXFMT.
You and I embraced the API approach - to many others it just looked like it
was going to be worse than coding assembler or COBOL. Way too much typing.
Your example is frankly a little silly. The handler has to be named on the
File definition so the purpose and limitations are somewhat obvious. If the
handler is called ReadIFS then the programmer is hardly likely to expect it
to eat with CHAIN. Just as they would not expect to use CHAIN with the
target file that resulted from CPYTOIMPF that the handler is avoiding the
The major reason for defending against unsupported op-codes is that OA does
not provide a means by which the handler can identify to the compiler which
operations are supported. As a result a maintenance programmer seeing that a
file is keyed might be tempted to try to use SETLL if they are not thinking
about which handler they are using. The compiler cannot defend against that
so the handler must. Or the handler be modified to deal with such
requirements if thy make sense in terms of the underlying technology.
@API or not: There is no need to call an API for every field, that is nearly
as silly as the internal API interfaces of OA (I don't have so much
experience with) or the ARDPGM interface (I do have some experience with).
We could provide interfaces very similar to the external interface of OA,
something like call someProc(recordType record) bringing back a well defined
record - all needed conversion stuff and interpreting the record is done
encapsulated in someProc.
@myExample: did you really read it? I was talking about chain and somebody
trying setll/read, two ways done with a keyed file, both reading methods -
how should one name the file? chainOnlyDoNotSetxxKeyedFile perhaps? BTW: the
compiler can't defend against using unsupported OpCodes, as OA
implementation is very limited, a little bit like the free format compiler
at times it needed nonsens statements like /free /end-free. Minimum would be
to me some mechanism like Procedure interface definition to ensure that OA
implementation and usage do fit with each other.
The real difrence between your recommendations and mine are:
I do strongly recoomend: Don't use RLA in newly created programms, it's
riding a death horse.
This thread ...
Re: Writing an Open Access handle that will either read/write to the Db2 file or make a REST call, (continued)
This mailing list archive is Copyright 1997-2019 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