Locate Function
with Example
Locate Function finds
exact String in array, it return position of element.
Code:
SUBROUTINE PK.M.LOCATE
$INSERT I_COMMON
$INSERT I_EQUATE
GOSUB INIT.FILES
GOSUB PROCESS
PROCESS:
LENGTH = DCOUNT(CHK.ARR,FM)
*CRT "LENGTH = ":LENGTH
NAME = 'Furqan'
LOOP
WHILE POS LT LENGTH
CRT I
LOCATE NAME IN CHK.ARR SETTING POS THEN
CRT CHK.ARR<POS>:POS
CHK.ARR<POS> := '!'
I +=1
END
REPEAT
FOR I = 1 TO LENGTH
CRT CHK.ARR<I>
NEXT I
RETURN
INIT.FILES:
CHK.ARR = ''
I = ''
POS = ''
CHK.ARR <-1> = '12Monday'
CHK.ARR <-1> = '14Tuesday'
CHK.ARR <-1> = 'Furqan'
CHK.ARR <-1> = '32Thursday'
CHK.ARR <-1> = '36Saturday'
CHK.ARR <-1> = '38Sunday'
CHK.ARR <-1> = 'Furqan'
CHK.ARR <-1> = '58Wednesday'
CHK.ARR <-1> = '60Thursday'
RETURN
OUTPUT
No comments:
Post a Comment