Hi,
try to initialize your data structure bevore filling it. (Either INZ in the
data structure definition or OpCode CLEAR).
But do not try to iniztalize a single element!
CLEAR DSTOTS(1) will initialize the numeric values in DepDatS(1) (and
others) to *Blanks.
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
-----Ursprüngliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im
Auftrag von BButterworth@xxxxxxxxxxxxxx
Gesendet: Thursday, 17. December 2009 21:47
An: rpg400-l@xxxxxxxxxxxx
Betreff: Re: %Lookup on non-qualified DS array subfield
Hi Scott,
No, I didn't code the ASCEND or DESCEND keyword on the DS definition. The
problem was that in the first iteration of the loop, the %Lookup BIF set j
equal to 0 when searching for the date value in the array (yes, we use
numeric dates). This was expected since each array element equaled 0 on
the first iteration. So the code incremented i to 1 and set depDats(i)
equal to the date value. On the second iteration (and second deposit
record), the date value was the same. %Lookup should have then set j equal
to 1, but it instead set it equal to 0. So i was then incremented to 2,
and depDats(i) set to the same date value. The exact same code worked as
expected when depDats was a stand-alone field.
Just to double-check things before responding, I removed the 26A,
recompiled and ran the program in debug. To my surprise, it worked. I put
the 26A back in, recompiled and re-ran. It still worked. As you mentioned,
the 26A is not an issue one way or another, just superfluous. So I
obviously did something wrong somewhere -- maybe I changed the code
without recompiling, I don't know, which is really frustrating. I am glad
it now works, though. Sorry to have wasted your time, but thanks for the
assistance nonetheless.
Blake
hi Blake,
I don't see any reason why this code shouldn't work. Can you explain the
problems you're having? What errors/symptoms do you get?
Can you please verify that your real code (as opposed to the code in the
e-mail) doesn't have the 'ASCEND' or 'DESCEND' keywords on the array? If
it /does/ have these keywords, that would explain why it fails. But since
you aren't using them in the >e-mail post, I don't see why it wouldn't
work.
You might want to eliminate the silly hard-coded '26A' since it's
superfluous -- but it wouldn't cause the program to not work, it's just
silly to hard code something that doesn't need to be hard coded. (RPG can
out the length of dsTots automatically.)
As an Amazon Associate we earn from qualifying purchases.