[Access to Wang masthead]

Menu Generating Utilities

Menu management options

From "VS Workshop",  Access 87, October 1987
  [ Prior Article ]     [ Return to the Catalog of articles ]     [ Next Article ]  

You don't have to look very closely to see my clear bias toward menu-driven software. From the screen-oriented procedures to the NEWMENU procedure featured in an earlier column, I have always expressed this preference. Indeed, the lowest level that most users see - the Command Processor - is a menu.

That's good for me, since the VS clearly works best from a menu. Anyone that has had the misfortune of working with canned software hastily converted to the VS will attest to how poorly the VS architecture accepts the command-driven or line-oriented approaches.

Naturally, you will want to make menus work best for your conditions, your applications, and your peccadilloes. While many software developers include menu management software into packaged systems, often they offer very little control or flexibility. Even tying the menus of several applications to each other may not be possible.

Faced with this situation, programming hacks would try to beat out a program, while advanced users might work up something in Procedure language. What if you don't want to do either? If yours is one of the many VS shops that lacks programming ability, you should know that there are a few alternatives to purchasing a menu management application; bear in mind, however, that each has drawbacks and limitations, and the final solution might indeed be a Wang OFFICE lookalike or some equally sophisticated application.

What's available?

Menu management software ranges from simple freebies offered by Wang to sophisticated menu management systems costing thousands of dollars. For the purposes of this article, we will limit discussion to those items available in the public domain: Useraids and the Wang utilities.

EZFORMAT is the first utility that comes to mind when menu generators are discussed. Included with Wang operating systems, EZFORMAT is a screen formatting tool that offers several options. The MENU options, discussed in the VS Systems Utilities Reference, creates either an Assembler or RPG II program from a screen display "painted" by the user. The screen contents and associated key definitions can be saved for later use. Selections from this menu must be through PF keys, and these keys are tied to programs or procedures within the same library as the menu program itself.

Note well the limitation expressed in the previous sentence: the programs or procedures controlled by a EZFORMAT menu must reside in the same library as the menu program itself, OR in the system library (e.g. @SYSTEM@ of the system volume). This limitation often rules out the use of such menus, since many applications require access throughout the system.

One way of getting around this problem is by creating a procedure for each step to be executed by the menu and then placing these procedures in the same library as the menu. Naturally, maintaining all those procedures could be a daunting task unless carefully constructed with generic routines and understandable structure.

On the other hand, using individual control procedures can offer the advantage of greater access control, since they could be specifically tailored to the user's needs. For example, it your menu lists the Wang Editor but you wish to limit access to it to three authorized users for security reasons you could construct a procedure that would allow only specific user IDs, name it EDITOR, and place it in the menu library. Unauthorized users would then be prevented from using the Editor from that and any other menus in that library.

Using the MENU option of EZFORMAT

To create a EZFORMAT menu, decide what items are to appear and list their program names. You should also have a general idea of the appearance of the screen. Run EZFORMAT in the system library and select the MENU option. If you wish to begin the menu with an existing screen definition file, select the option to use previously-created screen displays; otherwise, you must create a new screen work file. If you are creating a new menu, be sure to specify two records at the OUTPUT screen that appears next.

After selecting the input option, you will be prompted for the programs to be associated with each key. All 32 PF keys are available for use, along with the RETURN key. Note that special keywords can be used to allow the user to run any program, to return to the previous menu, or to log the user off the system. An option is also available to disable the HELP key while this menu is in use; this option overrides the usual HELP access defined within SECURITY.

After specifying the programs to be run, you may create the screen to your liking. It is not necessary to show all PF keys available, and you may wish to suppress mention of some options. Note that you do not need to enclose the text in quotes as with other EZFORMAT options, and row 24 is reserved by the system for messages.

When the screen is to your liking, select the exit option. You will be prompted for the language (select Assembler; the RPG II option doesn't seem to work) and the storage locations of the screen file, the Assembler source file, and the object (executable program) file. I suggest that all three of these file be saved with the same file name and library names of xxxSAVE for the screen definition file and xxxCOPY (or xxxSRC) for the program source file, where 'xxx' is your initials; the program file (object) may be located wherever you wish. If you receive no error messages after specifying the file locations and pressing RETURN to start code generation, you should have a usable menu program.

Creating a menu without source

The EZFORMAT screen definition specified above can be used to regenerate a similar menu program at any time, so there is often little need to save the Assembler source code that is generated; I generally don't bother. But what would you do if you inadvertently scratched the SAVE file?

If you need to create an EZFORMAT screen definition file, there is a Useraid you should know about: PRT2SAVE. This utility takes a the print file from a screen dump and turns it into a screen definition file. This program is a lifesaver when you have lost the source code for a critical program but still have a running version you can take some "snapshots" from. To use, run the program (it's usually in USERAIDS) and specify the print file to be used for input and the SAVE file to be created. Note that underlines will cause the screen to create extra lines and miss detail, so you will have to recreate these manually. Note particularly that the screen portion of the file is all that is created; you must specify the program names yourself.

Creating COBOL menus from EZFORMAT source

EZFORMAT menus work well, but there is often need to modify the operation of the menu to more closely meet your needs. If you aren't an Assembler hack (I'm not) you might be interested in MENUGEN, a Useraid that creates a COBOL menu program from an EZFORMAT SAVE file. With COBOL source in hand, such modifications become easier to accomplish.

To use, simply enter the location of the SAVE file you created in EZFORMAT. The system will then prompt for the names of the programs to be run. Like EZFORMAT, the 32 PF keys and RETURN are available, along with the RUN, EXIT and LOGOFF options; the option to disable the HELP key is missing, however, and there is an additional option to link to the SMF subsystem to track program usage by user - I'll have more on this and other job accounting systems in a future column. Note a variation on the RUN option syntax: EZFORMAT uses USERPROG to specify a user-entered program name, while MENUGEN requires RUN.

After making the key selections GETPARM screens for the locations of the source and object files will come up. Make your selections and press RETURN to generate COBOL code. You may also create source without generating the object if you wish. No error should develop if you are using Version 1.02 of the utility; Version 1.01 - sometimes listed as COBMENU in the Useraids library - will produce a COBOL error in the definition of the variable PF-KEY. No code will be generated if the companion MENUCODE file is not present in the Useraids library, since this file contains much of the guts of the generated program.

The finished COBOL program may be modified by the user in any way. Typical modifications might include underlines and other display attributes on the screen or the addition of library and volume data to the table of program values. Naturally, all COBOL options are available.

Variations: NEWEZFMT

Back in the days before EZFORMAT was a supported utility, many programmers thought they might do a better job developing a screen generation tool. NEWEZFMT appears to be such a tool. In addition to the options provided by EZFORMAT, NEWEZFMT lists GETPARM generation, screen attribute control, and other interesting options. On the whole, NEWEZFMT is bug-ridden and generally not worth the effort of learning, but there is one interesting option it features: automatic logoff.

Like the system option to log off workstations that have been idle for a long period of time, the timeout option of NEWEZFMT is based on keystroke activity. Unlike the system option, however, it is selective; you can log off idle terminals safely from menus rather than risking annihilation to your data files by randomly dumping out of long terminal sessions. Thus, this feature is worth exploring for master menus and other "safe" applications.

NEWEZFMT is similar in use to EZFORMAT, so I won't cover its use here. The timeout option is specified in minutes during generation, with the default being no timeout. I have tested the this option and found it works reasonably well, though it tends to wait longer than the stated time. Assembler is the only option available - probably because it is the only way to simultaneously check for key entry and loop within a timing routine.

Conclusion

Menus are definitely a way of life for VS users, and there are a few good ways to create them without expensive software. If you need specific access control, usage chargeback, or other sophisticated options you should look into the commercial system management software available for these purposes.

Items mentioned in this article:

EZFORMAT: A Wang utility distributed with the operating system. Most options of this utility are covered in VS File Management Utilities Reference, pub. 800-1308-01 (be sure to get the Release 7 Series Addendum, pub. 800-1308-01.01.); the MENU option is covered in the VS Systems Utilities Reference, pub. 800-1303-04.

PRT2SAVE, MENUGEN, COBMENU, and NEWEZFMT: All are Useraids, 'free' software contributed by users. Available through the International Society of Wang Users, Write to: ISWU Software Library, Wang Laboratories, Inc., One Industrial Drive, Mail Stop 019-350, Lowell, MA 01851-9971. (ISWU membership required.)


  [ Prior Article ]     [ Return to the Catalog of articles ]     [ Next Article ]  


Copyright © 1987 Dennis S. Barnes
Reprints of this article are permitted without notification if the source of the information is clearly identified