Close and Free the Cursor

Closing and freeing the cursor when you no longer need it is good practice, especially if the modules are part of a larger program.

This function must be placed in the same module as the DECLARE/OPEN/FETCH statements and in sequence, so this is the last function in the query_cust module. However, the function can be called from cust_main, as a final "cleanup" routine.

Function cleanup (custquery.4gl)
01 FUNCTION cleanup() 
02   WHENEVER ERROR CONTINUE 
03   CLOSE cust_curs 
04   FREE cust_curs 
05   WHENEVER ERROR STOP
06 END FUNCTION
Note: