RESET #A1(A14)
RESET #PROGRAM (A7)
REDEFINE #A1(#A2(A7/1:2))
MOVE ‘XXW1027XXV1015’ TO #A1
MOVE ‘XXV1015’ TO #PROGRAM
IF #MODULE-ARRAY() NE #PROGRAM
DISPLAY #MODULE-ARRAY()
END
This is a reporting mode program and I want to check for a value in the array. Actually the display stmt should not be executed as the array contains the #program value.
Its actually getting executed because its checking only for the first occurence in the array (xxw1027) which is not equal to #program and hence executing the display stmt.Is there any other way of checking all the occurences in the array. I don’t want to use a “FOR” loop either.
Can someone help me in this?
However, if you simply want a yes/no answer to whether a value exists in a table, and, if this code will be executed a lot, you might want to work with the string #A1 rather than deal with the array #A2.
If you want to read an article about some timing comparisons of EXAMINE’ing a string versus EXAMINE’ing an array versus SCAN, just send me an e-mail (address below in signature)
Ya I simply want to check if the value exists in the array and this code will be executed many times. Thanks a lot Steve. I’ll send you a mail requesting for the article.Thanks