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



My original attempt had the inz on the subfields. Buck suggested I initialize the DS, so I tried that instead. Still crashed.

d ParmsIn ds qualified
d Phone# 10s 0 inz
d Domain 16a varying
d Method 16a varying
d keysAndValues...
d likeds(Pairs) dim(32)

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


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

Did you specify the INZ keyword on the data structure or any subfields?

From the RPGLE reference:

Note: When the INZ parameter is not specified: Definition-Specification
Keywords
- Static standalone fields and subfields of initialized data
structures are initialized to their RPG default initial values (for
example, blanks for character, 0 for numeric).
- Subfields of uninitialized data structures (INZ not specified on
the definition specification for the data structure) are initialized to
blanks (regardless of their data type).



On Mon, May 5, 2014 at 12:47 PM, Koester, Michael <mkoester@data-
east.com>wrote:

I'm having trouble understanding why a subfield of a data structure
does not have the length designation (it crashes when I test with
"when
%len(datastructure(x).subfield) = 0;" ).
I get the RNX0115 Length of varying length variable is out of range.
It clearly is out of range, because the value of the subfield is set
to all blanks, and the length bytes show x'4040'.

My question is why the subfield is initiated to all blanks, including
the length bytes, instead of to all x'00', like any other respectable
varying length field should have?

Examining in SEP debug showing hex, I could see that the subfields
with non-blank values did have proper length bytes, but they did have
x'40' on all bytes that were beyond that length -- not x'00'.

I see in the archives that there was a lengthy discussion in Feb 2013
about how a varying length subfield operates somewhat differently,
but
no mention of this particular nuance.

Was not able to find anything in the docs about why a subfield
defined
as varying would get loaded with blanks.

Looks like testing for an "empty" varying subfield will need to be
"if
datastucture(x).subfield = *blanks" instead of testing its length.
Let me know if there's a better alternative.


Michael Koester
Programmer/Analyst

DataEast

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


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

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.