|
Thought this bug/gotcha with the %LOOKUP BIF may be of interest to the list.
I have code that is dynamically allocating memory to an array in increments.
The array starts with 50 elements and then adds 10 elements at a time.
Theoretically the array should never get near 50 elements but this code has
been included to prevent any error occurring anyway...
The array has been declared as having 32767 elements (i.e. 32767 is a 5,0
number)
The index however has been declared as 3,0 as the number of elements is
never likely to get very high.
If a %LOOKUP is issued using the index variable to limit the number of
places in the array searched, an MCH1210 error occurs.
If the index is declared as 5,0 then the MCH1210 does not occur. If it is
declared as any size smaller than 5,0 then it does.
However, if a numeric literal with less than 5 digits is specified then
everything works fine...
I thought that passing variables by value into a BIF meant that the declared
length shouldn't be a factor?
I'd be especially interested to hear the views of those in the Toronto lab
as to what is happening under the covers here...
The following code can be used to re-create the problem:
D DynamicArr@ S *
D DynamicArr S 10A DIM(32767) BASED(DynamicArr@)
D ArrayEntry S 10A INZ('ABCDEF')
D Idx S 3 0
* Initial number of entries in the array
D ArraySizeLimit S 3 0 INZ(50)
C EVAL DynamicArr@ =
C %ALLOC(%SIZE(DynamicArr) * ArraySizeLimit)
* The following line causes MCH1210
C IF %LOOKUP(ArrayEntry:DynamicArr:1:Idx) = 0
C ENDIF
C EVAL *INLR = *ON
C RETURN
Regards
Stu Bramley
Senior Technical Developer
Skandia Life
Southampton
UK
If you are not the intended recipient, please notify the sender by return email
and then delete the message from your computer. The Skandia UK Group reserves
the right to monitor e-mail communications through its networks.
No contract may be concluded on behalf of the Skandia UK Group by email.
Skandia Life Assurance (Holdings) Limited Skandia Life Assurance Company
Limited Skandia MultiFUNDS Limited
Registered Nos: 1606702, 1363932, 1680071, England
Registered Office : Skandia House, Portland Terrace, Southampton SO14 7EJ,
United Kingdom
Royal Skandia Life Assurance Limited Registered No : 24916 Isle of Man
Registered Office : Skandia House, King Edward Road, Onchan, Isle of Man IM99
1NU, British Isles
Skandia Life Assurance Company Limited, Skandia MultiFUNDS Limited and Royal
Skandia Life Assurance Limited are authorised by the FSA for UK investment
business.
Internet: www.skandia.co.uk
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.