Moved this reply from WDSC to RPG400 - Per David's request:
You create a MDS in your SQLRPGLE program and you load your record set into
that.
Your parameter list that you return to your web service has in it the MDS as
well as a 10i 0 field that you use in two ways.
First, when calling the rpg program from the Web service, you pass into that
field the number of elements you want to return in the MDS. If that value
is unknown (as it would be for the very first time you called it from the
web service (assuming you will ultimately have more records to pull than is
possible to store in the MDS at a single time) then on the first call to the
program, you pass in the maximum # of elements in the MDS.
Second, when the rpg program returns the data back to the web service, you
pass the number of actual elements in the MDS, in that 10i 0 field.
In your web service, you have to specify that the counter field for the data
structure in the web service is the 10i 0 field.
Obviously it's a bit more complex than that, but that's the general flow.
We use this method all the time to return any number of records to our web
services from SQLRPGLE programs.
Your SQLRPG code would look something like this in the D-specs:
D OUTCASRECORD DS Qualified
D 1000
D XCNAME 40a
D XCDIVISION 40a
D etc...
D IoDSCount S 10i 0
C *ENTRY PLIST
C PARM Input1
C PARM Input2
C PARM COUNTER
C PARM OUTCASRECORD
Your Web Service PCML would look something like this:
(the name of the sqlrpgle program in this example is WSGETCC)
<pcml version="4.0">
<struct count="WSGETCC.IODSCOUNT" name="OUTCASRECORD" usage="inherit">
<data length="40" name="XCNAME" type="char" usage="inherit"/>
<data length="40" name="XCDIVISION" type="char" usage="inherit"/>
Etc...
-----Original Message-----
From: wdsci-l-bounces@xxxxxxxxxxxx [mailto:wdsci-l-bounces@xxxxxxxxxxxx] On
Behalf Of Rick.Chevalier@xxxxxxxxxxxxxxx
Sent: Thursday, January 24, 2008 2:06 PM
To: wdsci-l@xxxxxxxxxxxx
Subject: Re: [WDSCI-L] Return record set from a web service
How would you handle telling the caller the number of records returned?
How does the caller know how large to make the receiving variable?
Would you create a structure and give it a maximum size?
-----Original Message-----
From: wdsci-l-bounces@xxxxxxxxxxxx [mailto:wdsci-l-bounces@xxxxxxxxxxxx]
On Behalf Of Shannon ODonnell
Sent: Thursday, January 24, 2008 1:51 PM
To: 'Websphere Development Studio Client for iSeries'
Subject: Re: [WDSCI-L] Return record set from a web service
You can return a record set in a data structure in your SQLRPGLE program
to the web service.
-----Original Message-----
From: wdsci-l-bounces@xxxxxxxxxxxx [mailto:wdsci-l-bounces@xxxxxxxxxxxx]
On Behalf Of Chanh_Le@xxxxxxxxxxxxxxx
Sent: Thursday, January 24, 2008 1:47 PM
To: Websphere Development Studio Client for iSeries
Subject: [WDSCI-L] Return record set from a web service
Can we return a record set from a web service from "EXEC SQL Set Result
Sets" in a SQLRPGLE?
Or we have place record set into a long OUTPUT parameter?
Thanks,
CL
======================================================================
Confidentiality Notice: The information contained in and transmitted
with this communication is strictly confidential, is intended only for
the use of the intended recipient, and is the property of Countrywide
Financial Corporation or its affiliates and subsidiaries. If you are
not the intended recipient, you are hereby notified that any use of the
information contained in or transmitted with the communication or
dissemination, distribution, or copying of this communication is
strictly prohibited by law. If you have received this communication in
error, please immediately return this communication to the sender and
delete the original message and any copy of it in your possession.
======================================================================
--
This is the Websphere Development Studio Client for iSeries (WDSCI-L)
mailing list To post a message email: WDSCI-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/wdsci-l
or email: WDSCI-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/wdsci-l.
--
This is the Websphere Development Studio Client for iSeries (WDSCI-L)
mailing list To post a message email: WDSCI-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/wdsci-l
or email: WDSCI-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/wdsci-l.
Privileged and Confidential. This e-mail, and any attachments there to, is
intended only for use by the addressee(s) named herein and may contain
privileged or confidential information. If you have received this e-mail in
error, please notify me immediately by a return e-mail and delete this
e-mail. You are hereby notified that any dissemination, distribution or
copying of this e-mail and/or any attachments thereto, is strictly
prohibited.
As an Amazon Associate we earn from qualifying purchases.