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



Comments in-line Don.


On Sep 22, 2019, at 5:09 PM, Don Brown <DBrown@xxxxxxxxxx> wrote:

Thanks Jon,

I have added the count_ and now check for a count greater than zero.

But I would like to understand your comments ...

How would using a Template solve the problem of non initialised data ?

It wouldn't. But it saves storage. A template doesn't use storage - the base DS in your case was using storage.

Also the data structure for the data-into is already a nested data
structure but I do not follow how this would solve the non initialised
data problem ?

It doesn't solve the initialization. It was just a different way pif doing the nesting (i,e, directly rather than via LikeDS)

Are you suggesting that we initialise all data structure fields in the
template definitions ? Eg

dcl-ds big_nested_DS;
dcl-ds ValidationFields qualified template;
value varchar(50) inz('');
title varchar(50) inz('');
id varchar(10) inz('');
end-ds;
...
...
end-ds;


No - an INZ at the DS level should be sufficient I think.

i.e. dcl-ds big_nested_DS Inz;


As I said in the original post the json data we are processing is very
large in both the number of records and the size of each record. There is
one definition of the data structures and these are included in programs
as required. They should have been defined as templates.

Thank you, I appreciate your assistance greatly


Don Brown




From: "Jon Paris" <jon.paris@xxxxxxxxxxxxxx>
To: "Midrange Systems Technical Discussion"
<midrange-l@xxxxxxxxxxxxxxxxxx>
Date: 23/09/2019 01:21 AM
Subject: Re: DATA-INTO with array for varchar
Sent by: "MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxxxxxxxx>



I would personally always use a count - but I don't think that is your
issue per-se.

What I suspect will fix things is to add the Inz keyword to the DS or at
least to the VarChar. As it is unused fields will have an invalid length
because spaces are in the length position.

P.S. Why not use Template? Or for that matter simply nest your structures
directly so so no template is needed?

e.g.
dcl-ds someOuterDs;
count_ValidationFields int(5);
dcl-ds ValidationFields Dim(20) Inz;
... //stuff
end-ds;
end-ds;



On Sep 21, 2019, at 8:32 PM, Don Brown <DBrown@xxxxxxxxxx> wrote:

I have the following data structure;

dcl-ds ValidationFields qualified;
value varchar(50);
title varchar(50);
id varchar(10);
end-ds;

dcl-ds fields likeds(ValidationFields) dim(20);

This is just a snippet of a very large set of data structures used to
process json

If I do a data-into and the data contains for example 2 values for
fields
if I try and access the 3rd element I get an error;

MSG(RNX0115) Length of varying length field variable is out of range.

ok that is correct as the length of that field would be zero.

I could code a count ...

count_fields int(10);
dcl-ds fields likeds(ValidationFields) dim(20);

Which would be set to 2 and then use that to control what array elements
I
access. (While this is the best option I would like to understand the
following)

I thought I could check the length like

if %len(fields(x).id) > 0;

But this also fails with the same error which I am not yet understanding

why ?

In debug if I display fields I see all 20 occurrences of the three
fields.


Do/should I initialise the data structure ? and if I do that what length

would be assigned to the varchar fields or do I need to set a minimum
length in that case ?

I am sure there is a document that explains this but so far this morning
I
have not found it.

Assistance appreciated.

Thanks


Don Brown


______________________________________________________________________
This email has been scanned for computer viruses. Although MSD has taken
reasonable precautions to ensure no viruses are present in this email, MSD
cannot accept responsibility for any loss or damage arising from the use
of this email or attachments.
______________________________________________________________________
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
______________________________________________________________________



______________________________________________________________________
This email has been scanned for computer viruses. Although MSD has taken reasonable precautions to ensure no viruses are present in this email, MSD cannot accept responsibility for any loss or damage arising from the use of this email or attachments.
______________________________________________________________________
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com


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.