program based_on_clause (INPUT,OUTPUT); DATABASE PERS = FILENAME 'PERSONNEL'; type job_code_type = BASED ON JOBS.JOB_CODE; job_title_type = BASED ON JOBS.JOB_TITLE; function job_name (job : JOB_CODE_TYPE ) : JOB_TITLE_TYPE; begin {* function *} READY PERS; START_TRANSACTION READ_ONLY; FOR FIRST 1 J IN JOBS WITH J.JOB_CODE = job job_name := J.JOB_TITLE; END_FOR; COMMIT; FINISH; end; {* function *} begin {* main *} writeln (job_name ('APGM')); end.