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
As an Amazon Associate we earn from qualifying purchases.