Input is a array field with 500 occurences.[ pic X10 occurs 500 times]
Output should be a error message if the validation(that is if second occurence of 7 or 8 is found in the first position) fails
Input field is coming from Database[adabas].
Joined: 23 Nov 2006 Posts: 19270 Location: Inside the Matrix
Define 2 indicators in ws - one for "found-7" the other for "found-8".
Loop thru the array looking for a 7 or an 8. When either is found, check if the indicator is already set as having found this value previously. If already found - it is an error. If not already found, set the indicator that this value has been found.
The loop should end whenever there is an error or the end of the array is reached.
Joined: 14 Jul 2008 Posts: 1235 Location: Richfield, MN, USA
I would use Dick's solution but would replace the indicators by tallies. Increment the appropriate tally when encountering a 7 or 8 and display these tallies at end of program. End the program however you want to depending on the values of the 2 tallies.