[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: RPG Array's - Please Help



This is not related to HTTPAPI but before dismissing you off to MIDRANGE.COM, I will take a stab at it.

You have a web service on the IBMi that sends data.
You have a series of repeating values you want to send.
The web service doesn't care if it sends 1 or 100.
Assumption...you are reading detail records and creating the data.
Assumption...you are using XML.

D XML         s    65000A

XMLHeader(); // add XML header information to XML variable
Read detail;
Dow not %eof();
  XMLDetail( valueFromDetail );
  Read detail;
Enddo;
XMLFooter();
.
.
.
XMLDetail   PI
  valuetoWrite      10i 0

XML += '<thisisyourdata>' + %char(valuetoWrite) + '</thisisyourdata>';


Not too hard now is it?

On the other hand, in a previous message you indicated you are using IWS. No experience with it other than doing a test deploy, but there appears to be array support. You need to specify the count as a variable or live with the non used elements or you need to manually construct the PCML document...

http://www-03.ibm.com/systems/i/software/iws/quickstart_server.html

"The Count column indicates that the parameter is an array. If the Count value is a number, then the number identifies the number of entries in the array. If the Count value references another parameter, which must be an integer type, then the referenced variable is used at runtime to determine the actual number of elements in the array. There are performance ramifications to consider regarding parameters that are arrays. If the Count value is a number, and the usage of the parameter is output or input/output, then all the array elements are returned in the response to a client request, even if the valid elements in the array is less than the maximum. To improve the performance of Web service requests, it is a good idea for output or input/output arrays to have the Count value reference another parameter that contains the actual number of elements in the array if you know that the number of elements in the array is not constant. For nested arrays, such as arrays within structures, the Count value cannot be set. In order to change the nested array's count value, a manually constructed PCML document needs to be provided. Refer to the IBM Information Center for more information on PCML syntax."


-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Giel van der Merwe
Sent: Monday, October 08, 2012 9:45 AM
To: ftpapi@xxxxxxxxxxxxxxxxxxxxxx
Subject: RPG Array's - Please Help

I am using a RPG program with an array to pass information out via a web service deployed on my AS400, but I don't have the now-how to make the array flexible, because right now I specify the array with 200 records, when the web service runs, it creates 200 records although there might only be data in the first 2 records.

Any advice or where I can start looking for - how to do

Giel van der Merwe


#####################################################################################

The provisions of Sections 11,12, and 13 of the Electronic Communications and Transactions Act, 25 of 2002, in so far as e-contracting is concerned is expressly excluded and contracted out by  Barloworld South Africa (Pty) Ltd ("Barloworld") and no data message or electronic communication will be recognised as having legal contractual status as per the aforementioned provisions under any circumstances. All contracts concluded by Barloworld, its Business Units, Divisions and Subsidiaries will only be legally binding and recognised once reduced to physical writing and physically signed by a duly authorised representative of Barloworld. 

All other provisions of  the Electronic Communications and Transactions Act, 25 of 2002 are accepted. 

#####################################################################################
Note:
This message is for the named person's use only.  It may contain confidential,
proprietary or legally privileged information.  No confidentiality or privilege
is waived or lost by any mistransmission.  If you receive this message in error,
please immediately delete it and all copies of it from your system, destroy any
hard copies of it and notify the sender.  You must not, directly or indirectly,
use, disclose, distribute, print, or copy any part of this message if you are not
the intended recipient. Avis and any of its subsidiaries each reserve
the right to monitor all e-mail communications through its networks.

Any views expressed in this message are those of the individual sender, except where
the message states otherwise and the sender is authorized to state them to be the
views of any such entity.

Thank You.
##################################################################################### 
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------