I would like to know what value is returned when a statement as below is executed:
FIND NUMBER MARKS-FILE WITH SUPER-MARKS = ‘JOHN10000’
Does the above statement return the number of records having the value of SUPER as ‘JOHN10000’?
How can the value in the NUMBER be made use of?
FIND NUMBER changes the value of the Natural system variable *NUMBER.
The fields contained in the view MARKS-FILE are not changed.
FIND NUMBER will give you how many records are there in MARKS-FILE which have SUPER-MARKS = ‘JOHN1000’. The result would be stored in system variable *NUMBER.
It can be used to check whether a particular record exist or not. E.g. if no records are there then *NUMBER will be 0 and you can decide your processing. This way it is efficient than IF NO RECORDS FOUND as FIND NUMBER only queries the database and does not actually read it, thus increasing the efficiency of a program.