[Access to Wang masthead]

A User Management System

Using logon procedures to set usage constants

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

One of the unique aspects of the VS environment is its use of user-defined constants for many run-time parameters. These usage constants reduce the amount of system interaction required from the user by supplying missing information to the system. This information includes library and volume locations, printer routing instructions and form numbers, and many other items. The proper use of usage constants results in reduced errors, better security, and greater ease of operation.

Usage constants can be set interactively by the user from the Command Processor, from a program (through the SET subroutine), or from a procedure. When set interactively, there is risk that invalid information will be entered - sometimes with catastrophic effects! In addition, users without use of the HELP key are not able to set or even see these defaults. The SET subroutine requires considerable effort to use, and the values are not usually available for review or modification. Procedure Language offers the easiest and most versatile way of controlling usage constants - particularly when incorporated into the start procedure assigned to the user through the VS Security system.

Unfortunately, few shops have taken the time to design an effective and maintainable method of assigning user defaults and master menus. This month's column presents a prototype of such a system. Let's begin with some design considerations for our prototype system.

Design Goals

Our user management system will:

1. Allow easy user setup by defaulting common usage constants to a single procedure.

2. Handle variances to these defaults by exception, rather than recoding "from the metal" for each user.

3. Save the user's starting defaults for possible reuse at any time.

4. Control all fields affected by the SET keyword.

5. Direct the user to the proper menu.

6. Load Multi-Station microcode, when appropriate.

7. Allow changes to the basic defaults while the system is in use.

I have prepared four prototype procedures that comprise a management system meeting these requirements. These four procedures are:

Together, this system sets usage constants during logon, then retains these constants in a GLOBAL variable so they can be re-SET at any time. Let's get started.

The control module: START

The START procedure (Figure 1) can be used for ALL users. It defines the GLOBAL string &SETMAP, extracts the user ID, then runs subprocedures to actually perform the work. Why not put all the code into START? The use of subprocedures means that the defaults can be modified during working hours, since the subprocedures are called briefly by START and then closed.

Step S01 runs @STD, which returns master values for &SETMAP. Next, step S02 examines the logon procedure library for a file of personal exceptions; if found, this is run to further modify the contents of &SETMAP. Finally, step S03 runs SETDFLTS to actually perform the SETs.

At this point, the permanent defaults for the user have been identified and usage constants set accordingly. Now it is time to run the master menu or other root program. Like the usage constants, this is contained within &SETMAP; step S04 puts it into motion. I have included step S05 in the event that any run-time logging of usage is desired, such as through the SMF Useraid or other means.

START represents the high-level outlook to the system; now let's examine the components one level below.

Assigning values: the @STD and SETDFLTS subprocedures

START has now defined the GLOBAL variable that will hold the user's defaults; @STD (Figure 2) puts data into this variable. Elements are concatenated to form the data for &SETMAP, and this is later used by SETDFLTS. This approach was chosen because of it's simplicity and reduced lines of code; it is equally possible (and better from a documentation standpoint) to use discrete GLOBAL variables for each SET item. Note that START assumes that @STD resides in the same library.

In addition to the usual SET items, I have added space for the user's start menu (positions 1 through 22) and a flag to indicate a Multi-Station user (position 128). The VS Procedure Language Reference (publication 800-1205-05) gives further details on the use of the other elements.

The exclamation points in fields such as SPOOLIB will cause the SET statement to be bypassed for the element, preserving the system defaults. For example, it is not normally desirable to reset the value of the user's print library, so SPOOLIB is bypassed by filling it with exclamation points. (The exclamation point was chosen for this task because it cannot be used in a file, library, or volume name and thus can be readily identified as a bypass.)

After @STD has set the master defaults, control returns to START. If a file exists that is named the same as the 3-character user ID, this file is assumed to contain overrides to these defaults (see sample SPL, Figure 3). Again, the file must be in the same library as START.

When &SETMAP is finally ready, START calls SETDFLTS (Figure 4) to perform the SET statements. Each item is described by it's position in &SETMAP, then individual SET statements are used. Note that the OPERMSGS is not available through operating systems prior to 7.10, so it must be remarked out here. As always, SETDFLTS must be in the same library as START.

Since &SETMAP is a GLOBAL variable and always available in memory, you can reSET defaults at any time by simply running SETDFLTS. This is helpful if procedure writers in your shop have the rude habit of setting printer defaults in production procedures without restoring the original settings upon conclusion.

All that remains after setting the usage constants is to run the program described in the first 22 characters of &SETMAP (see @STD and SPL). After this program is cancelled, usage statistics can be logged before exiting.


Here are some of the many variations I can think of to this system:


I hope you find use for this user management system. If so (or if not), please let me know. I'd like to feature alternate approaches in later columns.

As I mentioned last month, I will augment the BOILER collection as space allows. This month I offer two useful USERSUBS (see Figure 5): PAUSE and the report date option of DATE. PAUSE puts the system to "sleep" for a specified amount of time; simply pass it the number of seconds to wait. The DATE subroutine has many options; it is used here to get a 45-character date and time string useful for screens and reports (example: see the ACCESSCK procedure in the July '86 issue of ACCESS 86). Try them both for yourself.

Next month: MESSAGE - the poor man's OFFICE.

Figure 1: The START Procedure

     PROCEDURE START - standard logon procedure
     OPTIONS             PROCMSG   = NO

*    Sets all default values and starts the appropriate procedure for
*    any user.

     DECLARE &ID         STRING (03)

* Usage constants and run proc - available from any procedure

S00: EXTRACT             &ID       = USERID,
                         &PROGLIB  = PROGLIB, &PROGVOL  = PROGVOL

S01: RUN @STD     [ in library on volume ]


S03: RUN SETDFLTS [ in library on volume ]       [ Set user defaults ]

S04: RUN &SETMAP(1,8) IN &SETMAP(9,8) ON &SETMAP(17,6)
     ERROR  EXIT         IS S05
     CANCEL EXIT         IS S05

S05: [ Log run statistics here ]


Figure 2: The @STD Procedure

     PROCEDURE @STD - usage constants for ???

     DECLARE &ID         STRING (03)
     EXTRACT             &SYSVOL   = SYSVOL,
                         &ID       = USERID

*                           Printer defaults                         *

     SET PRNTMODE        =  "K",
         PRTCLASS        =  "Z",
         FORM#           =  "000",
         PRINTER         =  "000",
         LINES           =  "058",
         PRTFCLAS        =  "#"

*                       File access defaults                         *

     SET INLIB           =  "        ",
         INVOL           =  "BIG111",
         OUTLIB          =  "        ",
         OUTVOL          =  "BIG111",
         RUNLIB          =  "USERAID ",
         RUNVOL          =  "VOL555",
         SPOOLIB         =  "#STDPRT ",
         SPOOLVOL        =  "BIG222",
         WORKVOL         =  "BIG222"
**  SET  SPOOLSYS        =  "        ",      [ Override local system ]
**       PROGLIB         =  "        ",      [ Take system default   ]
**       PROGVOL         =  "      "         [  "     "       "      ]

*                  Procedure submittal defaults                      *

     SET JOBQUEUE        =  "R",             [ RUN when activated    ]
         JOBCLASS        =  "A",
         JOBLIMIT        =  "000000"         [ UNLIMITED             ]

*                     Miscellaneous defaults                         *

     SET OPERMSGS        =  "YES"            [ OPSYS 7.0.0 or higher ]

*                     Load MWS code to workstation                   *

     ENTER INPUT         FILE      = STD,
                         LIBRARY   = MWS,
                         VOLUME    = &SYSVOL

Figure 3: The SPL Procedure

     PROCEDURE SPL - logon procedure for user ????
     OPTIONS             PROCMSG   = NO

* Select menu to run

* Set exceptions to standard logon
     ASSIGN &SETMAP( 34, 6)        = "VOL666"         [ INVOL      ]
     ASSIGN &SETMAP( 40, 1)        = "A"              [ JOBCLASS   ]
     ASSIGN &SETMAP( 41, 6)        = "000000"         [ JOBLIMIT   ]
     ASSIGN &SETMAP( 48, 3)        = "077"            [ LINES      ]
     ASSIGN &SETMAP( 60, 6)        = "VOL666"         [ OUTVOL     ]
     ASSIGN &SETMAP( 83, 1)        = "T"              [ PRTCLASS   ]
     ASSIGN &SETMAP( 84, 1)        = "K"              [ PRNTMODE   ]
     ASSIGN &SETMAP( 86, 8)        = "USERAIDS"       [ RUNLIB     ]
     ASSIGN &SETMAP( 94, 6)        = "SYSTEM"         [ RUNVOL     ]
     ASSIGN &SETMAP(128, 1)        = "X"              [ MWS flag   ]


Figure 4: The SETDFLTS Procedure

     PROCEDURE SETDFLTS  - sets usage defaults
     OPTIONS             PROCMSG   = NO

*    Uses the values in GLOBAL variable &SETMAP to set usage defaults.
*    Bypasses set if the item contains an exclamation point; these
*    items default to the system conventions.
*    Also loads user's Multi-Station microcode when appropriate.

     IF &SETMAP( 23, 1) <> "!"     SET FORM#    = &SETMAP(23,3)
     IF &SETMAP( 26, 1) <> "!"     SET INLIB    = &SETMAP(26,8)
     IF &SETMAP( 34, 1) <> "!"     SET INVOL    = &SETMAP(34,6)
     IF &SETMAP( 40, 1) <> "!"     SET JOBCLASS = &SETMAP(40,1)
     IF &SETMAP( 41, 1) <> "!"     SET JOBLIMIT = &SETMAP(41,6)
     IF &SETMAP( 47, 1) <> "!"     SET JOBQUEUE = &SETMAP(47,1)
     IF &SETMAP( 48, 1) <> "!"     SET LINES    = &SETMAP( 48, 3)
**   IF &SETMAP( 51, 1) <> "!"     SET OPERMSGS = &SETMAP( 51, 1)
     IF &SETMAP( 52, 1) <> "!"     SET OUTLIB   = &SETMAP( 52, 8)
     IF &SETMAP( 60, 1) <> "!"     SET OUTVOL   = &SETMAP( 60, 6)
     IF &SETMAP( 66, 1) <> "!"     SET PRINTER  = &SETMAP( 66, 3)
     IF &SETMAP( 69, 1) <> "!"     SET PROGLIB  = &SETMAP( 69, 8)
     IF &SETMAP( 77, 1) <> "!"     SET PROGVOL  = &SETMAP( 77, 6)
     IF &SETMAP( 83, 1) <> "!"     SET PRTCLASS = &SETMAP( 83, 1)
     IF &SETMAP( 84, 1) <> "!"     SET PRNTMODE = &SETMAP( 84, 1)
     IF &SETMAP( 85, 1) <> "!"     SET PRTFCLAS = &SETMAP( 85, 1)
     IF &SETMAP( 86, 1) <> "!"     SET RUNLIB   = &SETMAP( 86, 8)
     IF &SETMAP( 94, 1) <> "!"     SET RUNVOL   = &SETMAP( 94, 6)
     IF &SETMAP(100, 1) <> "!"     SET SPOOLIB  = &SETMAP(100, 8)
     IF &SETMAP(108, 1) <> "!"     SET SPOOLSYS = &SETMAP(108, 8)
     IF &SETMAP(116, 1) <> "!"     SET SPOOLVOL = &SETMAP(116, 6)
     IF &SETMAP(122, 1) <> "!"     SET WORKVOL  = &SETMAP(122, 6)

     IF &SETMAP(128, 1) <> " "     RUN MWSLOAD


Figure 5: Two Useful USERSUBS


*  Declare receiver for date/time string
      DECLARE &hdrdate   STRING (45)

      [Header date]       USING "HL",  &hdrdate



                         USING ?????     [Time in l00th sec]


  [ 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