|
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jon
Paris
Sent: Tuesday, May 06, 2014 9:35 AM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: Varying length subfield contains blanks instead of length
0 ?
You could have achieved the same thing with Inz(*LIkeDS) alongside the
LikeDS keyword. This has the benefit of copying any and all
initializations from the cloned DS.
On 2014-05-05, at 4:56 PM, "Koester, Michael" <mkoester@xxxxxxxxxxxxx>
wrote:
Thanks Buck. That seems to have fixed it!be behaving as well.
I applied the same fix to my "real thing" module, and it appears to
Many thanks to Bob, Chuck, and Stuart as well.
-- Michael
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of
Buck Calabro
Sent: Monday, May 05, 2014 4:37 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: Varying length subfield contains blanks instead of
length
0 ?
On 5/5/2014 4:22 PM, Koester, Michael wrote:
Here's the offending code in all its [stripped-down] glory.add_user method.
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
D*------------- ------------------------------------breaks
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
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
Right, so you're passing the data structure ParmsIn and it is not
initialised. Put an INZ on that and see how it works. INZ on the
'likeds' doesn't inherit up to the 'liking' DS.
--buck
As an Amazon Associate we earn from qualifying purchases.
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.