Solution (source code)

= Solution

With the fixed <array> `f` visible to the procedures, use a <Boolean> result for success and two output <array indices>:
``
TYPE Search = PROCEDURE(x: INTEGER; VAR i, j: INTEGER): BOOLEAN;
``
On success, $0\leq i<M$, $0\leq j<N$, and $f[i,j]=x$. On failure there is no occurrence; the output indices are unspecified. Thus
$$
\boxed{\mathrm{TRUE}\Longrightarrow f[i,j]=x;\qquad\mathrm{FALSE}\Longrightarrow x\text{ is absent}.}
$$