# Define User Menus - Option 6

Contents of this section

Defining User Menus to call filePro and other programs
One line actions and commands
Multi-line commands [scripts, batch files]

Menu Flags

Advanced Concepts

It is surprising how many filePro users access all of their programs and data through the main filePro menu. This menu is more than adequate for most operations that concern designing and testing files, but once the program is up and running, it is overkill. The entire creation side and a good percentage of the runtime side of the menu are not required to operate the newly created program. In fact, most business users out there rarely do anything more than Inquire, Update & Add and Request Output from this powerful 4GL menu. Actually, it is even worse than that. A good majority of the users dont ever use the Set/Change file Name function either, which means they spend a great deal of their time answering lots of questions about; which file, what screen, browse mode, what record selection mode, etc.

You can make your computer time infinitely more productive by designing custom menus of your own that take you directly to the things you want to do without asking all those questions. You give the menus that you design names and you can run these "User Menus" from the command line or from the "G" option on the main menu, or most commonly from another menu.

Define User Menus

When entering "Define User Menus", a screen similar to the following screen is presented. You may see additional menu names not reflected in this example.

After selecting a menu name or [NEW] option you will get the following screen which allows you to enter "Menu Heading" and "Menu Version" for your user menu.

Menu Version

With filePro version 5.0.9 and later, you can use a system variable to control the menu version that is displayed for the user. Identify your variable name enclosed with the " %" symbol e.g. %menuv% where "menuv" is the variable included in your filePro configuration or system environment. You can use any variable within the limits of the version field

After saving the menu name and version, you will see the menu editing screen depicted below. You can enter up to 24 choices per menu, but it is often better to leave blank lines or to place sub-titles for your menu by leaving the choice blank and entering just the "Description Line". This will place a category title on your menu i.e. "My Creation Operations" in the following example.

Choice

Any single letter, number or punctuation mark except

x and X. The entry "X - Exit" is automatically

added to every menu.

Description

Any text that would tell the user what the menu entry does, such as "Print end-of-month report" or "Run Word Processor".

Action

The program, single or multiple operating system commands that you want executed when a user chooses this element.

You can use flags with many of the filePro programs to apply parameters.

In the above screen, "-t 120000" and "-ty 30000" are flags to control the processing table tokenization sizes.

Note: Use a minus "-" after filePro program names when using flags. This reserves space for the filePro filename variable so that the following parameters are recognized as flags.

Example: /fp/rcabe - -t 120000 -ty 30000

Menu Batch/Script Files

You can press the F5 key on the action line to create a filePro batch /script file when you want to perform more than one action per menu element.

Example: You need to run several reports each day before leaving work. Set up an option for "My Daily Reports", go to the action line and press the F5 key.

When pressing ESC to save the batch file, notice how the menu action line is entered for you. The action line contains the menu name with a suffix ".A" which corresponds to the CHOICE you have entered.

Long Description

This string will be centered on the bottom line when running your user menu when the menu cursor is on this element. "Long Descriptions" allow you to explain what the option does to the user, but can be left blank.

The long description entry in "MYMENU" option "A" would be presented to the user as follows;

The filePro "Define Menus" option is not limited to filePro programs. You can include your any system utility programs like editors, word processors, and generally apply about anything that you can do from the system prompt to manage your user applications.

Menu Passwords

Each menu can be password protected. The password is case sensitive in all operating systems.

You have the option to print a hardcopy of the menu when leaving the "Define User Menus" option.

Flags

Add flags to the menu action lines to control how your data is presented or output. Different flags apply depending on the program that you are running i.e. clerk, report, dxmaint etc. Any flag that can be used in a menu option can also be used from a command line. Refer to the following topics for lists of menu action flags.

Flags - Inquire Update & Add - Use these flags to control user input.

Flags - Request Output - Use these flags to control the creation of reports, printer redirection, selection etc. (report programs)

Flags - Expand Files - Use these flags to control expanding filePro files to reserve blank records. (dexpand program)

Flags - Index Maintenance - Use these flags to perform Index rebuilding. (dxmaint program)

Note: You can not put passwords on an action line or in a batch/script file. The user will be asked for it at the appropriate point in the program.

User Menu Indicators - Use these indicators at the beginning of the action line or lines in a filePro batch/script file indicate menu operational options.

@ Waits for user acknowledgement after executing command.

# Returns to previous menu after executing command.

! Tells filePro that the following command is a user menu. (This speeds the loading on UNIX/XENIX systems.)

Advanced Concepts

Flags

Flags - Inquire Update & Add - Use these flags to control user input.

Flags - Request Output - Use these flags to control the creation of reports, printer redirection, selection etc. (report programs)

Flags - Expand Files - Use these flags to control expanding filePro files to reserve blank records. (dexpand program)

Flags - Index Maintenance - Use these flags to perform Index rebuilding. (dxmaint program)

Note: You cannot put passwords on an action line or in a batch/script file. The user will be asked for it at the appropriate point in the program.

User Menu Indicators - Use these indicators at the beginning of the action line or lines in a filePro batch/script file indicate menu operational options.

@ Waits for user acknowledgement after executing command.

# Returns to previous menu after executing command.

! Tells filePro that the following command is a user menu. This speeds the loading of the menus.

Define User Menus allows you to create or modify any filePro menu (including the Main Menu itself which has a name of "dpromenu".

NOTE: Any changes you make to "dpromenu" will not become apparent until you exit the Main Menu or load a different menu and then come back to the Main Menu).

Advanced Example

Below is a User Menu called "test" to demonstrate a variety of things. You can copy some of the lines to a test menu and experiment with the actions shown here.

Two notes: The "-h" is used on menu action lines to place a heading at the top of the screen when the action is being performed. The heading must be enclosed in quotes. Here it is used to describe the actions a little better and, of course, not needed to run the action in any way. Choice "E" is a script which you created while in the Define Menus program. The script is created on a screen behind the menu (so to speak) and is reached by pressing F5 (check the prompts on your screen). This script is stored in a *nix file and the name "menuname.-CHOICE" is substituted on the command line for you automatically. You will need this feature if you want to do things that cannot fit on one action line.

Below is "test menu".

1 | CUSTOMER FILE | D | CATALOG FILE - to screen
2 | CUSTOMER FILE (screen 1) | E | PRINT 3 REPORTS IN A ROW
3 | CUSTOMER FILE (Add Records) | F | SCRIPSIT WORD PROCESSING
4 | PRODUCT FILE (Index B) | G | MAIL SYSTEM
5 | INVOICE FILE (Selection XXX) | H | Edit a File
6 | CATALOG (Browse Mode On) | I | SHELL ("exit")
7 | QUIKSTART (large token size) | J | FILEPRO MAIN MENU
8 | VENDOR FILE (output to file) | K | SOME OTHER USER MENU
9 | VENDOR FILE (debugger on) | L | WHO IS ON THE SYSTEM
A | CUSTOMER FILE Summary | M | Utilities
B | CUSTOMER FILE - Print Invoices | N | BACKUP FILEPRO FILES
C | VENDOR FILE - Report (Index.A) | O | Windows

Below are the action lines associated with the above menu.

1 /fp/dclerk cust -h "Customer File - Ask for screen number"
2 /fp/dclerk cust -s1 -h "Customer File"
3 /fp/dclerk cust s1 -xa -h "Customer File - Add Records"
4 /fp/dclerk prod -s1 -xib -h "Product File - Direct index B."
5 /fp/dclerk prod -s1 -xs XXX -h "Invoice by selection XXX.
6 /fp/dclerk catalog -s1 -b -h "Catalog - Browse Mode On."
7 /fp/rclerk - -h "Asks for filename because of the -."
8 /fp/dclerk vend -s1 -p /tmp/file -h "Any output to /file."
9 /fp/dclerk vend -sl -db -h "Vendor File with debugger on"
A /fp/dreport cust -f summary a
B /fp/dreport cust -f invoice s new
C /fp/dreport vend -f reportname -iA "Uses index.A"
D /fp/dreport catalog -f inventory -pq -h "Menu of output choices"
E /fp/menus/test.-E
F cd /usr/wp ; wp
G mail
H edit
I /bin/sh (Windows=command.com)
J !dpromenu or "p dpromenu"
K !usermenuname or "p usermenuname"
L @who (Windows=n/a) -h "The @ pauses the output to see it!"
M !util or "p util"
N cd /appl/filePro ; tar -cvf /dev/rctO . (Windows=pkzip rp filepro /appl/filepro/*.* )?
O win

The following script relates to choice E and stored in file /fp/menus/test.-E

/appl/fp/dreport filename -f reportl a

/appl/fp/dreport filename -f report2 a

/appl/fp/dreport filename -f report3 s selset

Hints:

Use the Menu Version number to print the menu name on the screen. It is not worth much as a version number, but it is valuable as a name. Users can tell you immediately which menu they are using when they run into trouble.

If PFNAME is set, then the value of PFNAME will be show at the top of all menus/submenus. This allows the programmer to use PFNAME in manners not originally intended, but nonetheless is very useful. You could use PFNAME to display the qualifer being used.

In Unix, where all commands specify -m $qualify by setting PFNAME = $qualify.

In WINDOWS/Windows where PFQUAL has been set, set PFNAME = %pfqual%.