Was this helpful?
Retrieving Information about Menu Items
The menu object type can be used to retrieve information about menu items in the menu line for the current display loop. The syntax is:
inquire_frs menu formname | empty_string
    (variable = frs_constant[(menu_item)]
If you are referring to the current form you can omit formname and specify an empty string instead (in ESQL, specify ' ', and in EQUEL specify " "). The formname parameter can be specified to access menu objects in other display loops. The menu_item parameter must specify the name of the menu item about which you are inquiring.
The legal values for frs_constant are listed in the following table:
Frs_constant
Data Type
Comment
Active
Integer
Returns 1 if the specified menu item is active (displayed and available to the user), 0 if the menu item is inactive. To enable or disable menu items, use the set_frs statement (with the active option).
Examples--inquire_frs statement:
Example 1:
Find out if an error occurred. If so, call a clean-up routine.
exec frs inquire_frs frs (:err = errorno);
 if (err < 0) then
    call clean_up(err);
end if;
Example 2:
Confirm that user changed some data on the currently displayed form before updating the database.
exec frs activate menuitem 'Update' (validate = 1);
 exec frs begin;
    exec frs inquire_frs form (:updated = change);
    if (updated = 1) then
        exec frs getform (:newvalue = value);
        exec sql update newtable
            set newvalue = :newvalue
            where .....;
    end if;
exec frs end;
Example 3:
Find out the mode and current field of a form whose name is passed as a parameter.
exec frs inquire_frs form
    (:mode = mode(:formname),
               :fldname = field(:formname));
Example 4:
Implement a generalized help facility based on the current field name.
exec frs activate menuitem 'HelpOnField';
 exec frs begin;
    exec frs inquire_frs form (:fldname = field);
    Place appropriate file for "fldname" into
      "filebuf";
    exec frs helpfile 'Field Help' into :filebuf:
exec frs end;
Example 5:
Find out if the current field in form empform is a table field before issuing the deleterow statement on the current row.
exec frs activate menuitem 'Deleterow';
 exec frs begin;
    exec frs inquire_frs field empform 
        (:fldname = name, :istable = table);
    if (istable = 0) then
        exec frs message 
           'You must be on the table field to delete
           the current row.';
        exec frs sleep 2;
    else
        exec frs deleterow empform :fldname;
    end if;
 exec frs end;
Example 6:
Allow the runtime user to change the row following the current row in a table field. Verify that the current field is a table field and that the next row of the table field is visible.
exec frs activate menuitem 'ChangeNextRow';
 exec frs begin;
    exec frs inquire_frs field '' (:istable = table);
    if (istable = 0) then
        exec frs message 'You must move to the
            table field';
        exec frs sleep 2;
    else
        inquire_frs table '' 
            (:fldname = name, :currow = rowno,
             :lastrow = lastrow);
        if (currow = lastrow) then
            exec frs message 'You must scroll
                                 in a new row';
            sleep 2;
        else
            currow = currow + 1;
            /*
            ** Update data in row specified by 
            ** 'currow' 
            */
       end if;
    end if;
exec frs end;
Example 7:
Inquire whether a field was changed by the runtime user.
exec frs activate menuitem 'Salary';
 exec frs begin;
    exec frs inquire_frs field (:changed =
                               change(salary));
    if (changed = 1) then
        log salary change for employee;
        exec frs set_frs field (change(salary) = 0);
        /* clear the change variable */ 
    end if;
exec frs end;
Example 8:
Check to see if a change was made to make the application more efficient. For the example below, assume that the only field on the form is a table field with columns name and rank.
exec frs activate menuitem 'Update';
 exec frs begin;
    /* 
    ** Check if a change was made to column "rank" 
    ** in the current row. 
    */
    exec frs inquire_frs row 
        (:changed = change(rank));
    /* Only need to update database
    ** if a change was made. 
    */
    if (changed = 1) then
        get information and update database;
        exec frs set_frs row (change(rank) = 0);
        /* clear the change variable */
    end if;
 exec frs end;
Example 9:
Only validate field key if value has changed:
exec frs activate field key;
 exec frs begin;
    exec frs inquire_frs field 
        (:changed = change(key));
     if (changed = 1) then
        perform field validation
        /* clear the change variable */
        exec frs set_frs field (change(key) = 0);
     endif;
exec frs end;
Last modified date: 04/03/2024