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



On 01-Jul-2014 06:37 -0500, Chris wrote:
On 02-Jul-2014 07:43 -0500, Chris wrote:
Using a third party product, one of the call into their product
supports 200 999a varying *nopass parameters. Other than select/if
constructs does anyone have a suggestion of quickly scanning all
these returned parameters to see if they contain data? The call
into their product does return the number of these that are used,
just not which of them that contains valid data as some can be
blank

Example, there are 200 of these. I get different lengths back from
each parm.

D VendorPgm pr extpgm('VENDORPGM')
D ivUserParam001 999A OPTIONS(*NOPASS)
D VARYING
D ivUserParam002 999A OPTIONS(*NOPASS)
D VARYING
D ...
D ivUserParam200 999A OPTIONS(*NOPASS)
D VARYING


The following code snippet, along with the above prototyped parameters and the PR addendum, do not reflect the implication that an invocation /returns/ the number of arguments either that were specified or that are relevant for the invoker to review afterward for which of those are non-blank results. Though easily modified, to do so: arrayEnd=vendorPgm(...)

D genericParm 999A varying based(genericParm@)
D genericParm@ *
D arrayOfParm like(genericParm) dim(200)
D arrayIdx 10I00
D arrayEnd 10I00
D dataLocated N

vendorPgm(arrayOfParm(001):arrayOfParm(002)
:arrayOfParm(003):arrayOfParm(004)
:arrayOfParm(005) ;
arrayEnd = 005 ; // above invoked with five arguments
arrayIdx = 1 ; // ensure start with first array entry
dataLocated = *OFF ; // inz indicator
// for convenience, the following is inline vs a procedure
dow arrayIdx <= arrayEnd ;
if arrayOfParm(arrayIdx)<>*BLANKS ;
dataLocated = *ON ;
leave ; // any [the 1st] non-blank parm data suffices
endif ;
arrayIdx = arrayIdx + 1 ;
enddo ;
// did prior processing find any non-blank parm return values?
if dataLocated ; // prior processing found a non-blank rtn val
// first non-blank result located in arrayOfParm(arrayIdx)
endif ;

Of course the separately named parameter variables, named in a DS and then the OVERLAY to define the Array, e.g. as Charles suggested in <http://archive.midrange.com/rpg400-l/201407/msg00019.html#>, would enable using the original variable names on the program invocation. That would remove any requirement to change the program invocations in the existing source to use the array elements; only the code spinning the array would need to refer to the storage with the indexed array notation.


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.