Saturday, August 15, 2009

(Tips) AS/400 Built In Functions %Found

%FOUND (Return Found Condition)
%FOUND returns ’1’ if the most recent relevant file operation found a record, a
string operation found a match, or a search operation found an element.
Otherwise, this function returns ’0’.

The operations that set %FOUND are:
File operations:
– “CHAIN (Random Retrieval from a File)”
– “DELETE (Delete Record)”
– “SETGT (Set Greater Than)”
– “SETLL (Set Lower Limit)”

String operations:
– “CHECK (Check Characters)”
– “CHECKR (Check Reverse)”
– “SCAN (Scan String)”
Note: Built-in function %SCAN does not change the value of %FOUND.

Search operations:
– “LOOKUP (Look Up a Table or Array Element)”

If %FOUND is used without the optional file_name parameter, then it returns the
value set for the most recent relevant operation. When a file_name is specified,
then it applies to the most recent relevant operation on that file.

For file operations, %FOUND is opposite in function to the ″no record found NR″
indicator.

For string operations, %FOUND is the same in function as the ″found FD″
indicator.

For the LOOKUP operation, %FOUND returns ’1’ if the operation found an
element satisfying the search conditions.

Examples:


No comments:

Post a Comment