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



At first glance, it will break because you are looking 1 to 32, but the prototype is dim(20)

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Koester, Michael
Sent: Monday, May 05, 2014 3:22 PM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: RE: Varying length subfield contains blanks instead of length 0 ?

Here's the offending code in all its [stripped-down] glory.

h option(*srcstmt : *nounref : *nodebugio )
h dftactgrp(*no) actgrp(*new)

D results s 32767A varying

d ParmsIn ds qualified
d keysAndValues...
d likeds(Pairs) dim(32)

d Pairs ds qualified inz
d Key 32a varying
d Value 32a varying

D*--------------------------------------------------
D* Procedure name: AddUser
D*------------- ------------------------------------
D AddUser...
D pr 512a VARYING
d KVPairs likeds(pairs) dim(20)

*==================================================
* ********* Main logic ***********
*==================================================
* Program Prototype (*Entry parms)
d TEST_1 PR

d TEST_1 PI
/free
ParmsIn.keysAndValues(1).key = 'LastName';
ParmsIn.keysAndValues(2).key = 'Company';

results = AddUser(ParmsIn.keysAndValues);
*inlr = *on;
/end-free

* End Mainline Logic

_____ * Private subprocedures
D*--------------------------------------------------
D* Procedure name: AddUser
D* Purpose: Construct & return the XML string for add_user method.
D*------------- ------------------------------------
P AddUser...
P B
D AddUser...
D pi 512a VARYING
d KVPairs likeds(pairs) dim(20)

* Local fields
d String s 512a varying inz
d x s 3u 0 inz

/free
KVPairs(1).value = 'Moose';
KVPairs(2).value = 'Null & Void, Inc.';

for x = 1 to 32;
select;
when KVPairs(x).key = *blanks; // this is where it breaks
LEAVE;
when KVPairs(x).key = 'LastName';
String = KVPairs(x).value;

when KVPairs(x).key = 'Company';
String += ' of ';
String += KVPairs(x).value;
endsl;

endfor;

Return string;
/end-free

P AddUser...
P E

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of
Koester, Michael
Sent: Monday, May 05, 2014 3:22 PM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: RE: Varying length subfield contains blanks instead of length
0 ?

Give me a few minutes to put together a condensed version without all
the complexities of reality...
-Michael

--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-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.