|
Hello group:
I am trying to use bsearch & I am stumped on where it determines the
element number of the found entry in the array. Below is the code to
setup the array, I am having problems on the Eval Elem = ..... statement
When I run it, I get an error message Pointer or parameter error message
id: RNQ0222
TIA
Steve Jones
D FindIt PR * extproc('bsearch')
D key * value
D base * value
D num 10U 0 value
D size 10U 0 value
D compare * procptr value
D*
D myTemplate DS qualified
D Based(Template)
D AAdaitx 15A
D AAdaqqt 10S 3
D*
D Items DS likeds(myTemplate)
D dim(9999)
D*
D p_match S * Inz(*Null)
D*
D key ds likeds(myTemplate)
D*
D FindItem Pr 10I 0
D Elem1 likeds(myTemplate)
D Elem2 likeds(myTemplate)
D*
D Elem S 3P 0
Do some stuff to get necessary data....
C Eval Key.AAdaitx = Adaitx
C*
C Eval P_match = FindIt (%addr(key) :
C %addr(Items) :
C NumElem :
C %size(myTemplate) :
C %paddr(FindItem) )
C
C If P_match = *NULL
C Eval NumElem = NumElem + 1
C Eval Items(NumElem).AAdaitx = Adaitx
C Eval Items(NumElem).AAdaqqt = Adaqqt
C Else
C Eval Elem = (( P_match - Template)
C / %Size(MyTemplate)) + 1
C EVAL Items(Elem).AAdaqqt =
Items(Elem).AAdaqqt +
C Adaqqt
C Endif
P FindItem B
D FindItem PI 10I 0
D elem1 likeds(myTemplate)
D elem2 likeds(myTemplate)
C*
C Select
C when elem1.AAdaitx < elem2.AAdaitx
C return -1
C when elem1.AAdaitx > elem2.AAdaitx
C return 1
C other
C return 0
C endsl
P FindItem E
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.