|
Thanks Darren and Jon.
I thought things were a bit too easy when I found that I could load a similar (but not same) data structure as a target of the call. Close, but...
I'm not yet familiar enough with the advantages of template DS, but I do use /copy for common definitions.
Thanks again.
Michael Koester
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jon
Paris
Sent: Wednesday, June 24, 2015 2:57 PM
To: Rpg400 Rpg400-L
Subject: Re: varying subfield in array DS getting loaded with blanks?
Darren has it right I think.
Personally I would code it like so: (not tested)
DCL-DS KnownUsersDS QUALIFIED DIM(64);
UserIDs LikeDS(UserIDs_T) Inz;
ChildOf VARCHAR(32) INZ('');
IsArchived IND;
END-DS;
DCL-DS UserIDs_T QUALIFIED Template;
Domain CHAR(16);
UserID VARCHAR(32) INZ('');
END-DS;
Pass UserIds to the procedure.
Really the template should be in a /Copy then you can also incorporate it
into the called procedure.
Jon Paris
www.partner400.com
www.SystemiDeveloper.com
On Jun 24, 2015, at 12:53 PM, Koester, Michael <mkoester@xxxxxxxxxxxxx>
wrote:
I have an array data structure that has some varchar subfields,initialized with INZ(''). There is no space between the quotes, which
appears to set the length to 0 for all rows. That's what I want. All's
cool.
I then call a procedure that gets some values for two of the foursubfields, and loads three rows with those values. That's cool too. What
isn't so cool is the two fields that should be untouched by the called
procedure get blank-filled, and I don't know why, or how best to prevent
that. I could spin through a for-loop and load the target DS from the
results of the called procedure, but I thought I might not have to.
has a ds defined as:
Calling program defines the target ds as:
DCL-DS KnownUsersDS QUALIFIED DIM(64);
Domain CHAR(16);
UserID VARCHAR(32) INZ('');
ChildOf VARCHAR(32) INZ('');
IsArchived IND;
END-DS;
Called Procedure only retrieves values for "Domain" and "UserID", so it
gets stuffed into the 4-subfield array data structure with:
DCL-DS UserIDs QUALIFIED DIM(64);
Domain CHAR(16);
UserID VARCHAR(32) INZ('');
END-DS;
The UserIDs data structure is what is passed back to the caller, and
(including the length bytes). What I find curious is that the UserID
KnownUsersDS = GetUserIDsFromNova(acct : phone : domainsDS);
After the call, all 64 rows of the ChildOf subfield get blanks
subfield for the 61 unfilled rows remain empty with length = 0.
making it the receiver of the call? (seeems to work except for trashing
We're at v7.1 here.
So have I pushed my luck trying to load only two of four subfields by
the unused subfields).
Michael Koester
--
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 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.