VMS Help  —  RDML72  Statements  BASED_ON, Examples  C Example
    #include <stdio.h>
    DATABASE PERS = FILENAME "PERSONNEL";

    typedef  BASED ON JOBS.JOB_CODE job_code_type;
    typedef  BASED ON JOBS.JOB_TITLE job_title_type;
    DECLARE_VARIABLE temp_job_name SAME AS JOBS.JOB_TITLE;

    job_title_type job_name(job)
    job_code_type job;
    { /* begin  function */
        READY PERS;
        START_TRANSACTION READ_ONLY;

        FOR FIRST 1 J IN JOBS
        WITH J.JOB_CODE = job
           strcpy (temp_job_name, J.JOB_TITLE);
        END_FOR;

        COMMIT;
        FINISH;
        return temp_job_name;
    } /* end of function */

    main ()
    {
    printf ("%s\n",job_name("APGM"));
    }
Close Help