× 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.



Scott,

When IBM changes an API, which use data structures/formats, do you have to
recompile all of your applications?

Using data structures correctly and appropratly is easier to maintain than a
huge list of data elements. The opperative word here is appropratly...

We build many of our procedures using the IBM API interface as a base.
 
As an example we have a getCustomerInfo procedure, currently it has 18
structures/formats it returns and 6 structures/formats it accepts as keys.

We never change an existing structure once it is set, so if we need to add,
remove, or modify any subfields we create a new structure/format and
alter/add the approprate procedure to process the requirements.


Duane Christen
  

-----Original Message-----
From: Scott Klement [mailto:rpg400-l@xxxxxxxxxxxxxxxx]
Sent: Thursday, October 27, 2005 5:00 PM
To: RPG programming on the AS400 / iSeries
Subject: Re: Passing Parms



> Question - whether you change the number of parameters or the component of
> a single parameter, surely ALL programs that call the single/multiple
> parameter program MAY need to be retrofitted for the change - depending
> upon what that change is? In other words, some analysis will need to be
> done either way.

You're right, though I'd like to draw attention to the words "depending on 
the change" in your paragraph.

If you're careful to not change the attributes of existing parameters, and 
you're careful to always add the new parameters to the end of the list, 
and you're careful to make all new parameters optional, then you can avoid 
needing to recompile the callers (unless, of course, they require teh 
added functionality.)

Granted, you can do the same thing with a data structure as well, but you 
need meta information (either in the DS, or passed separately) that 
describes how long teh data structure is, so that the program that 
receives the parameter knows which version of the DS it needs to work 
with.  That is, in fact, how IBM's APIs work.

However, my point (made in a previous message, but perhaps without due 
emphasis) is that it's EASIER to do that with single parameters rather 
than all parms together in one data structure, because you don't have to 
pass the extra meta-info, you can use the %parms BIF instead.

The other advantage to the single parm solution comes when you need to 
change an existing parm instead of adding a new one to the end.  With the 
single parm solution, you can lessen the impact because only callers that 
actually use that parm are affected -- whereas with the DS solution, if 
you make a field longer or shorter, it changes the whole DS, and therefore 
impacts all callers.

The goal is to eliminate the need for retrofitting in as many 
circumstances as possible -- and that's why I don't like data structures 
as much as parameter lists.  At least, as a rule of thumb.

There are exceptions to every rule, of course.

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.