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



That is something outside my understanding and will dig into that further.

If I needed at add an another array wouldn't I just add them with another _LENGTH field?

No idea how to make IWS do that automatically.

Here is my current code.

// ===================================================================================
// Data Stuctures
// ===================================================================================

Dcl-DS Response Qualified Template Inz;
Type Char(2);
Description Char(40);
End-Ds;

// ===================================================================================
// Input Parameters
// ===================================================================================

Dcl-pr WOMConTypR;
Envir Char(2);
Responses_LENGTH Int(10);
Responses LikeDS(Response) Dim(50);
Fail Char(100);
End-pr;

Dcl-pi WOMConTypR;
Envir Char(2);
Responses_LENGTH Int(10);
Responses LikeDS(Response) Dim(50);
Fail Char(100);
End-pi;


-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Jon Paris
Sent: Monday, May 12, 2025 3:18 PM
To: RPG programming on the IBM i (AS/400 and iSeries) <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: External RE: Web Service Return DS Array

And suppose the requirement chages so that you need elements after the array. Or two separate arrays, Now your code is more fragile because any change requires a check on the math.

As I said - IWS has a built-in capability to handle this - I'm surprised that Amra didn't mention it.


Jon Paris
Jon.Paris@xxxxxxxxxxxxxx



On May 12, 2025, at 2:14 PM, (WalzCraft) Jerry Forss <JForss@xxxxxxxxxxxxx> wrote:

I am setting the Length in the pgm after all elements are loaded.

// Get Contact Types
SetLL ('COMMENT TYPES' : 'CONTACTS') Param;
DoU Done;
ReadE ('COMMENT TYPES' : 'CONTACTS') Param;
If %EOF(Param)
Or Idx = %Elem(Response);
Leave;
EndIf;

Idx = Idx + 1;
Responses(Idx).Type = PmKey3;
Responses(Idx).Description = PmText1;

EndDo;

Responses_Length = Idx;

-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Jon
Paris
Sent: Monday, May 12, 2025 11:58 AM
To: RPG programming on the IBM i (AS/400 and iSeries)
<rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: External RE: Web Service Return DS Array

Is this IWS you are using for deployment? I'm guessing but in future if it is please say so.

If so a better way than setting the response length (which will cause you ongoing maintenance issues) is to have your routine return a count of the number of elements and tell IWS to use that to control the output.

I can't point you at any articles or anything but the approach is detailed in a presentation that I give. If you email me direct I'll gladly send you a copy.


Jon Paris
Jon.Paris@xxxxxxxxxxxxxx



On May 12, 2025, at 10:06 AM, (WalzCraft) Jerry Forss <JForss@xxxxxxxxxxxxx> wrote:

Got it. Wasn't setting the Response_Length. :(

-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of
(WalzCraft) Jerry Forss
Sent: Monday, May 12, 2025 9:00 AM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: RE: External RE: Web Service Return DS Array

I did get that working.
Data in pgm looks good.

The service is getting back blanks so need to figure out what I have wrong.

{
"RESPONSE": [],
"FAIL": ""
}

-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of
Jean-Marc DUVAL via RPG400-L
Sent: Monday, May 12, 2025 8:53 AM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Cc: Jean-Marc DUVAL <jean-marc.duval@xxxxxxxxxxx>
Subject: External RE: Web Service Return DS Array

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.

Hi,

Try something like that :

Dcl-pr WOMOrdTypR;
Envir Char(2);
data likeds data_t dim(20);
Fail Char(100);
End-pr;

Dcl-pi WOMOrdTypR;
Envir Char(2);
data likeds data_t dim(20); Fail Char(100);
End-pi;

dcl-ds data_t template ;
Type Char(2);
Description Char(25);
End-ds;

-----Message d'origine-----
De : RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> De la part de
(WalzCraft) Jerry Forss Envoyé : lundi 12 mai 2025 14:56 À : RPG
programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx> Objet : Web
Service Return DS Array



ATTENTION : Ce message provient d'une source EXTERNE. Veuillez n'ouvrir les liens ou pièces jointes que si vous êtes sûr de l'expéditeur.



Hi All



Cross posting to Web list as well.



In my current pgm that is called from my Web Server I return arrays for each element.

I want to return a DS array instead.



Current Parameters



Dcl-pr WOMOrdTypR;

Envir Char(2);

Type Char(2) Dim(20);

Description Char(25) Dim(20);

Fail Char(100);

End-pr;



Dcl-pi WOMOrdTypR;

Envir Char(2);

Type Char(2) Dim(20);

Description Char(25) Dim(20);

Fail Char(100);

End-pi;



Which returns this from the service





{



"TYPE": [



"DS",



"EX",



"LT",



"NC",



"RM",



"RW",



"SL",



"",



"",



"",



"",



"",



"",



"",



"",



"",



"",



"",



"",



""



],



"DESCRIPTION": [



"Drop Ship",



"Expedited Order",



"Literature Packed",



"No Charge",



"Remake",



"Re-Work",



"Standard Lead",



"",



"",



"",



"",



"",



"",



"",



"",



"",



"",



"",



"",



""



],



"FAIL": ""



}





I want it to return



[

{

"TYPE": "DS",

"DESCRIPTION": "Drop Ship"

},

{

"TYPE": "EX",

"DESCRIPTION": "Expedited Order"

},

{

"TYPE": "LT",

"DESCRIPTION": "Literature Packed"

}

]





How do I define this as a DS so the service returns what I want?
I am looking for some good documentation on templates, I am assuming this is what I want but have never used it.





Subject to Change Notice:

WalzCraft reserves the right to improve designs, and to change specifications without notice.

Confidentiality Notice:

This message and any attachments may contain confidential and privileged information that is protected by law. The information contained herein is transmitted for the sole use of the intended recipient(s) and should "only" pertain to "WalzCraft" company matters. If you are not the intended recipient or designated agent of the recipient of such information, you are hereby notified that any use, dissemination, copying or retention of this email or the information contained herein is strictly prohibited and may subject you to penalties under federal and/or state law. If you received this email in error, please notify the sender immediately and permanently delete this email. Thank You

WalzCraft PO Box 1748 La Crosse, WI, 54602-1748
www.walzcraft.com<http://www.walzcraft.com> Phone: 1-800-237-1326

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