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



Just curious. Once you return the array how does that get converted into
XM?. IBM's wrapper does that or do you generate some code to read the
arrays and write the XML?

On Tue, Dec 30, 2014 at 2:41 PM, Koester, Michael <mkoester@xxxxxxxxxxxxx>
wrote:

Scott, I was initially trying to use a service program function that, by
defitnition, must return only one "value" -- Since I needed more than one
array, I had to return a single data structure that had multiple array data
structures nested within it. To IWS, my return was a structure which
expanded to multiple array structures, and there was no support for
displaying the Count for the nested structures.

When I used the parameters approach, IWS saw those parameters that did not
specify CONST as input/output, and for those that were dimensioned it
allowed me to replace the default Counts with my integer variables.

In that initial success I was using a *PGM object with the parameters. I
have been trying to set up a *srvpgm function that returns a data structure
comprised of a small collection of fields (no arrays there), as well as
in/out parms for returning the arrays. Not having any success there yet.
Don't know what I'm missing. The PCML appears to be error-free, but IWS
does not recognize the operation as one that can be selected in the "Select
Export Procedures to Externalize as a Web Service - Step 4 of 9".

I might be pushing my luck there, and may have to go back to the *PGM
approach (because it works.)
--Michael

-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of
Scott Klement
Sent: Tuesday, December 30, 2014 2:11 PM
To: Midrange Systems Technical Discussion
Subject: Re: IWS needs web service to return only the array rows used

Sorry, I don't understand what you are saying here... as far as I can
tell, you are saying that if you define your structures as parameters (vs
return values) that somehow solves your problem.

but, I can't see why it solves the problem of not being able to specify
the number of array elements needed in nested arrays within the
structure.


On 12/30/2014 11:42 AM, Koester, Michael wrote:
Thanks Scott.
I must say that your solution appears to be well beyond my level of
expertise, but...
I have it on good authority that IWS does not currently support what I
am trying to do.

That said, I'm finding that instead of using a return value from the
function, I can define what would ideally considered inputs as the data
structures that get loaded in the function. Since those aren't CONST
parameters, IWS sees them as multiple outputs, which allows me to set the
count property of the arrays to the variables, and I get the XML
structure
I need. There might be a better way to get there, but until I find it,
this will do.
-- Michael

-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf
Of
Scott Klement
Sent: Monday, December 29, 2014 4:49 PM
To: Midrange Systems Technical Discussion
Subject: Re: IWS needs web service to return only the array rows used

Michael,

I don't have an easy answer for this... I think you've hit upon one
of
the limits of the IWS.

Personally (when I need something complex like this) is to just use
Apache to call my RPG program instead of IWS. Then, I need to do all
of the XML work myself -- which I don't find too difficult if I
already
know what the XML should look like (and I can use the IWS to tell me
that).

But, if you code the XML yourself, you can make it only return the
array
elements you need very easily.

Plus, running raw RPG code will outperform the IWS.

-SK



On 12/29/2014 9:06 AM, Koester, Michael wrote:
Running iOS 7.1 (TR8, I think).

I'll be using the Integrated Web Services wizard to generate a web
service that provides data to a business partner. I need to send data
in
the form of multiple arrays. I am able to do this by having the
service
program function return data structures shown in D-specs similar to
below
(simplified a bit here), but the actual number of array rows used will
vary, up to the dim limits.

D GetEBPPdata3...
D PR Extproc('EBPPTEST3')
D likeDS(rtnDS) RTNPARM
D Account 7a const
D Phone 13a const
D EmailIn 64a const

D rtnDS ds qualified
D Account likeDS(Set1)
D PhonesCount 10i 0
D Phone likeDS(Set2) dim(32)
D PaymentsCount 10i 0
D Payment likeDS(Set3) dim(16)

* fields that pertain to Account
d Set1 ds qualified inz
d Success n inz
d MsgText 128a
d DateDue 10a
d NextAutoPayDate...
d 10a

* fields that pertain to each phone on account
d Set2 ds qualified inz
d PhoneNumber 10 0 inz
d AmtDue 8 2 inz
d BankRouting 9 0 inz
d BankAccount 16a

* fields that pertain to each prior payment
d Set3 ds qualified inz
d PhoneNumber 10 0 inz
d Amount 8 2 inz
d PaidDate 10a
d Status 16a

When I test the web service, the resulting XML is pretty close to
perfect, except that I need to find a way to restrict the output from
including all the "empty" array rows. For the "Set2" stuff, I get XML
for
all 32 rows, when only 2 rows are used:

...<PHONESCOUNT>2</PHONESCOUNT>
<PHONE>
<PHONENUMBER>5290001</PHONENUMBER>
<AMTDUE>25.11</AMTDUE>
<BANKROUTING>987654321</BANKROUTING>
<BANKACCOUNT>1234567890</BANKACCOUNT>
</PHONE>
<PHONE>
<PHONENUMBER>5290002</PHONENUMBER>
<AMTDUE>50.05</AMTDUE>
<BANKROUTING>456987123</BANKROUTING>
<BANKACCOUNT>98745612</BANKACCOUNT>
</PHONE>
<PHONE>
<PHONENUMBER>0</PHONENUMBER>
<AMTDUE>0.00</AMTDUE>
<BANKROUTING>0</BANKROUTING>
<BANKACCOUNT></BANKACCOUNT>
</PHONE>
<PHONE>
<PHONENUMBER>0</PHONENUMBER>
<AMTDUE>0.00</AMTDUE>
<BANKROUTING>0</BANKROUTING>
<BANKACCOUNT></BANKACCOUNT>
</PHONE>
<PHONE>
<PHONENUMBER>0</PHONENUMBER>
<AMTDUE>0.00</AMTDUE>
<BANKROUTING>0</BANKROUTING>
<BANKACCOUNT></BANKACCOUNT>
</PHONE>
<PHONE>
<PHONENUMBER>0</PHONENUMBER>
<AMTDUE>0.00</AMTDUE>
<BANKROUTING>0</BANKROUTING>
<BANKACCOUNT></BANKACCOUNT>
</PHONE>
<PHONE>
<PHONENUMBER>0</PHONENUMBER>
... [for all 32 rows. Same issue with the <Payment> array for
16 rows.]

If my output was a single array, my understanding is that I might
have
an opportunity in the wizard to define the output structure count to
be
a
run-time variable instead of the dim default. My output, as a
"structure
of structures" does not appear to allow me any chance at fixing the
counts.

Is there a way to specify PhonesCount and PaymentsCount someplace as
the
runtime values of array rows to return?

Many thanks.

Michael Koester
Programmer/Analyst


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.