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



Did I miss something? I must be ignoring the &#!% out of the OVERLAY
keyword...

-Eric

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Timothy Adair
Sent: Tuesday, April 20, 2010 8:38 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: *INPUTPACKED ignored for arrays ?

This is one method (of the many) that I tried. Unfortunately the RPG
compiler barfs on it with...

"*RNF3733 An array cannot overlay another array; keyword OVERLAY is
ignored."

BTW, I am using a DS for input:

ddsothr ds
d othTicket# 1 7s 0
d othDate 8 13s 0
d othCust# 14 18s 0
d othTotal 19 25s 2
d othComment 26 50
d othNSF 51 51
d othGroup# 52 56s 0

d othGL 7p 0 DIM(30)

d othFill1 177 296
d othAmt 7 2 DIM(30)
d othGLsuffix 507 508 0
d othFarmpat 509 509
d othFill2 510 510
d othBusy 511 511
d othStatus 512 512








"Scott Klement" <rpg400-l@xxxxxxxxxxxxxxxx> wrote in message
news:mailman.23778.1271738234.2580.rpg400-l@xxxxxxxxxxxxxxx
Hi Timothy,

Hmmm... Whomever 'cfuture' is, they seem to have given the answer I
would give. Though, I would add that you can read your record
directly
into a DS and skip the I-specs.

For example, I suspect you're currently doing something like this:

D ARRAY S 7P 0 DIM(30)

IMYFILE NS
I 1 5 FIELD1
I 6 30 FIELD2
I 31 150 ARRAY

C READ MYFILE

When you do the 'READ MYFILE' it populates the I-specs. This is the
traditional way of reading a program-described file. But, it's not
the
only way! You can also read directly into a DS, as long as that DS is
the
same length as the record length you defined on the F-spec.

So for example, you could do this:

D Record DS
D Field1 5a
D Field2 25a
D Array 7p 0 dim(30)

C READ MYFILE Record

So that eliminates the I-specs, which interesting by itself, IMHO...
but
you still could get blanks in the array, and that would still lead to
your
'Me duele la cabeza' problem.

But fortunately, the DS approach makes it easy to overlay stuff.

D Record DS
D Field1 5a
D Field2 25a
D ArrayA 4a dim(30)
D ArrayP 7p 0 dim(30) overlay(ArrayA)

C READ MYFILE Record

c for x = 1 to %elem(ArrayA)
c if ArrayA(x) = *blanks
c eval ArrayP(x) = 0
c endif
c endfor

Now if there were any blanks in the array, I've forced them to zeros.
Not
bad, aina hey?



Timothy Adair wrote:
I have an RPG IV pgm (not ILE) that is reading in an old QS36F
program-described file. This file has a "field" that is actually a
30-element packed numeric array (7,0). For records with valid data
in
this array, everything is fine; but I have some records with spaces
(hex
'4040404') in this array, and when it hits one of these, the program
gives a decimal-data error (understandably so).

I have specified the compile option of FIXNBR(*INPUTPACKED) but the
program is not fixing the data at input-time. Does *INPUTPACKED not
work
for input arrays? It seems to work for single fields.

And yes, I know, I need to fix the data. I intend to but that
doesn't
guarantee I won't encounter more of these in this file (or other
files).
I'd like to nail down a viable solution now. We will be converting
to
externally-described files eventually but for now this is the
situation I
have to deal with.

And yes, I have tried every conceivable combination of overlays &
arrays
to program around the problem. Every attempt either wouldn't
compile, or
gave the DD error when run.


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.