[Access to Wang masthead]

Procedures from Boilerplate

Plus the External Copy function within the Wang Editor

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

Well, for those of you expecting a full-blown procedure generator this month, I have some news. Automated procedure generation through a procedure, though technically possible, proved impractical. Instead, I'll demonstrate the use of a boilerplate procedure library and cover a little-known feature in the external copy function within the Wang Editor. I think you'll agree that this combination represents a truly effective alternative to creating Procedure text from scratch.

What's Boilerplate?

Boilerplate is defined by the American Heritage Dictionary as "Material, such as syndicated features and sometimes repeated items like the masthead, available in plate or mat form." Students of printing will know that the plates and mats mentioned here date from a time when newspapers were primarily printed from the raised surface of a metal or rubber plate, which hasn't been true for some time.

In modern use, boilerplate has come to mean the use of common text elements arranged mechanically to resemble authentic composition. The clearest examples of this are those "personalized" letters that clog our mailboxes.

BOILER source in use

The basic concept behind BOILER is simple: create a bunch of generic Procedure statements and merge them together to form new procedures. Some of the advantages include adherence to personal and shop standards, faster procedure writing, and a fuller understanding of all items on the related GETPARMs.

To aid in understanding the represented programs, I have adopted several notational conventions in BOILER. These should help call attention to options, required data, and data obtained through system or user defaults.

1. Options are shown to the right of the appropriate line. The default option, if any, is shown with the item; any other legal values are contained as comments to the right, separated by backslashes. Programs that have many options - such as CREATE - are explained with additional comment lines.

2. Required Fields are indicated with question marks; these items must be filled in.

3. Defaulted values are shown with plus signs ('+'). The values in these items are normally supplied by the system and need to be overridden only in special circumstances.

4. Comments are included to help make sense of the options within a program.

XCOPY's well-kept secret

Most people who have spent any time with the Wang Editor come to use the External Copy function (PF 8 from the Editor Special Menu; see Figure 1), and have used it to copy a range of lines from another file. Most have not noticed, however, that text may be substituted for the line numbers to designate the start and end positions in the external file. As you can see from Figure 2, the START and END parameters consist of 16 characters - far more than a six-digit line number.

To use this function, press PF 8 from the Editor Special Menu (PF 16 from the first menu or from a text file) and enter the desired file, library and volume names of the file to be copied from. You may also specify a range of items within that file to be copied through the START and END parameters; enter text strings in these areas. Those with recent operating systems in use (e.g. 6.40 or better) may enter text without quotations marks. As with line-number mode, a START item without and END will copy only one line. The XCOPY Editor function will search the external file, copying from the first occurrence of the START parameter and ending at the first occurrence of the END parameter. Why am I making such a big deal about the first occurrence? Simply to point out that the text can contain duplicate text strings, but the first occurrence with trigger the start or end of the copy.

The BOILER "procedure" takes advantage of this use of the XCOPY function by marking the start and end positions in the file with known text elements.

An example

Suppose you wish to create a procedure that performs the following steps:

1. PROMPT the user for a cutoff date.

2. Validate the user-entered date, using the DATE functions in USERSUBS.

3. Extract and store the record count for file BIGGUY in MAINLIB.

4. Run INQUIRY, using the EXTRACT option to create a work file from BIGGUY in MAINLIB. Write only those records with an invoice date beyond the cutoff date entered above.

5. If the extract is successful, rename BIGGUY to HISTORY and the output file to BIGGUY. If the extract is unsuccessful, display a warning screen to the user, showing the return code from INQUIRY.

6. Inform the user how many records are in the old and new BIGGUYs. Exit.

Assuming you had a comprehensive boilerplate Procedure library, your programming session might take the following form:

1. Enter the Editor, proceeding directly to the Change option (PF 9). Create the first line (PROCEDURE . . .) and any normal comment lines.

2. Proceed to the XCOPY function, specifying procedure BOILER as your external file. Specify START = 'PROMPT' and END = '****' (the end point for all BOILER paragraphs). When the copy is complete, re-enter the Editor and position the cursor to the last line by pressing PF 3; this will reset the destination line number for the next external copy.

3. Repeat the second step using 'DATE VALID', 'EXTRACT', 'INQUIRY', 'RENAME', 'WARNING PROMPT' as your start points and '****' as the end points, each time re-positioning the cursor as described above.

4. Edit the procedure, removing any unnecessary lines and filling in required parameters.

5. Test and run.

Properly used, this process should yield a working procedure in half the usual time.

More to come. . .

For space reasons, this version of BOILER has been cut to only a few functions. I will be augmenting it with other paragraphs in the months to come. In the meanwhile, I will be especially interested in the items you come up with on your own, so please send me your best. Remember, it's cheap publicity!

Next month I'll cover logon procedures.


Figure 1: External Copy Screen Within EDITOR


********************************************************************************
 *** MESSAGE 0800 BY EDITOR

                  INFORMATION REQUIRED BY PROCEDURE DSBPROC
                              TO DEFINE XCOPY
                          ACTIVE PROGRAM IS WE1EDIT



                           External Copy Command

  To copy a portion of another file into the present work file, fill in the
  information below and press ENTER.  Press PF1 to return to the special
  command menu.

  FILE     = BOILER** in LIBRARY  = DSBTOOL* on VOLUME   = SYSTEM

  START    = START*DISPLAY***   (Range of lines in the file specified above)
  END      = ****************

  TARGET   = 7000************   (Target line in the present work file)

  Retain the modification codes of the external file MODCODE  = NO*  (YES/NO)

********************************************************************************

Figure 2: The BOILER Text File


* BOILER - boilerplate procedure steps

[ START COPY ]

STP: RUN COPY IN @SYSTEM@
     ENTER INPUT         COPY      = FILE,     [ library, volume ]
     [optional]          FILE      = ????????,
     [optional]          LIBRARY   = ????????,
                         VOLUME    = ??????,
                         MODE      = INPUT     [ shared ]

* The LOCK PRB will appear if MODE = SHARED
     ENTER LOCK          LOCK      = YES,      [ no ]
     [if LOCK = YES]     TIMEOUT   = 10,
     ["   "   "  " ]     BYPASS    = NO        [ yes ]

     ENTER OPTIONS       FILEORG   = +,        [ con, ind, rel ]
                         LENGTH    = +,        [ fixed, variable ]
                         COMPRESS  = +,        [ no, yes ]
                         REORG     = NO,       [ yes ]
                         KEYLEN    = +++,
                         KEYPOS    = +++++,
     [index pkng dens.]  IPACK     = +++,
     [data  pkng dens.]  DPACK     = +++,
     [DMS/TX blks all.]  RECBKJ    = N         [ none, alloc, used ]

     ENTER OUTPUT        FILE      = ????????,
                         LIBRARY   = ????????,
                         VOLUME    = ??????,
                         RECORDS   = ++++++++,
                         RETAIN    = ???,
                         RELEASE   = YES,      [ no ]
                         FILECLAS  = +,
                         DEVICE    = DISK      [ tape, none ]
     ENTER EOJ           16                    [ 01 ]

**** END COPY

[ START DATENTRY ]

STP: RUN DATENTRY IN @SYSTEM@
     ENTER INPUT         FILE      = ????????,
                         LIBRARY   = ????????,
                         VOLUME    = ??????,
                         CTLFILE   = ????????,
                         CTLLIB    = ????????,
                         CTLVOL    = ??????

     ENTER OPTIONS       ??       [ 02 (create), 03 (add records),
                                    04 (modify), 05 (delete),
                                    06 (display), 07 (field attributes),
                                    16 (exit)                            ]

* The following appears if OPTION = MODIFY and the file is alt-indexed
     ENTER PATH          PATH      = ????????

     ENTER OPTIONS       16
     ENTER INPUT         16

**** END DATENTRY

[ START DISPLAY ]

STP: RUN DISPLAY IN @SYSTEM@

     ENTER INPUT         FILE      = ????????,
                         LIBRARY   = ????????,
                         VOLUME    = ??????,
                         ACCESS    = RECORD,        [ block, print ]
                         MODE      = INPUT          [ shared ]

* The following PRB appears if MODE = SHARED
     ENTER LOCK          LOCK      = NO,            [ yes ]
     [if LOCK=YES]       TIMEOUT   = ???,           [ seconds ]
     [if LOCK=YES]       BYPASS    = NO             [ yes ]

* This screen has no function if MODE = PRINT
     ENTER EOJ           16                         [ 01 ]

**** END DISPLAY

[ START INQUIRY ]

STP: RUN INQUIRY IN @SYSTEM@

* Hidden GETPARM to control whether WORK or SPOOL library is used
     ENTER DISPFILE      DISPFILE  = WORK           [ spool ]

     ENTER INPUT         FILE      = ????????,      [ 16 ]
                         LIBRARY   = ????????,
                         VOLUME    = ??????,
                         MODE      = INPUT,         [ shared ]
     [CONTROL file]      CHANGE    = NO,            [ yes ]
                         OPTION    = DISPLAY        [ extract ]

     ENTER CONTROL       FILE      = ????????,
                         LIBRARY   = ????????,
                         VOLUME    = ??????,
                         DEVICE    = DISK           [ none ]

* Note that the query MUST be structured in UPPER case
     ENTER QUERY         TITLE     = ?....?,        [ 40 char ]
                         DISPLAY   = YES            [ no ]
     LINE1A = "                                        ",
     LINE1B = "                                       ",
     LINE2A = "                                        ",
     LINE2B = "                                       ",
     LINE3A = "                                        ",
     LINE3B = "                                       ",
     LINE4A = "                                        ",
     LINE4B = "                                       ",
     LINE5A = "                                        ",
     LINE5B = "                                       ",
     LINE6A = "                                        ",
     LINE6B = "                                       ",
     LINE7A = "                                        ",
     LINE7B = "                                       "

* Hidden GETPARM to control file location of query results
     ENTER PRINT         FILE      = ##INQU,
                         LIBRARY   = ++++++++,
                         VOLUME    = ++++++,
                         RECORDS   = +++++++,
                         RETAIN    = ???,
                         RELEASE   = YES          [ no ]
                         FILECLAS  = +,
                         DEVICE    = DISK         [ printer ]

* If OPTION = EXTRACT
     ENTER OUTPUT        FILE      = ????????,
                         LIBRARY   = ????????,
                         VOLUME    = ??????,
                         RECORDS   = ?????,
                         DISPLAY   = YES,         [ no ]
     [End after?]        RUN       = NO           [ yes ]

* PF03 from EOJ

     ENTER RPTDEF        FILE      = ????????,    [ 01 (exit) ]
                         LIBRARY   = ????????,
                         VOLUME    = ??????

**** END INQUIRY


[ START REPORT ]

STP: RUN REPORT IN @SYSTEM@

     ENTER FUNCTION      04                      [ 02 (create), 03 (modify),
                                                   16 (exit)                 ]

     ENTER OPTIONS       ID        = ????????,   [ REPORT file name ]
                         DEVICE    = PRINTER,    [ display ]
                         FILES     = NO,         [ yes ]
     [record count]      OPTION    = YES,        [ no ]
     [sum]               ONLY      = NO,         [ yes ]
     [lines per...]      PAGE      = ??,
     [select lines...]   LINES     = 123,
     [print spacing]     SPACING   = 000

* If REPORT not in user's default libary...
     ENTER RPTDEF        FILE      = ????????,   [ 16, exit ]
                         LIBRARY   = ????????,
                         VOLUME    = ??????

* If CHANGE FILES= YES or file not found (PRIMARY FILE)
     ENTER INPUT1        FILE      = ????????,
                         LIBRARY   = ????????,
                         VOLUME    = ??????,
                         MODE      = INPUT       [ shared ]


* If CHANGE FILES= YES or file not found (SECONDARY FILE)
     ENTER INPUT2        FILE      = ????????,
                         LIBRARY   = ????????,
                         VOLUME    = ??????,
                         MODE      = INPUT       [ shared ]

     ENTER OPTIONS       16

**** END REPORT


[ START DATE ]

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

STP: RUN DATE IN USERSUBS [ on volume ]
         USING "HL", &HDRDATE

**** END DATE


[ START PAUSE ]

STP: RUN PAUSE IN USERSUBS [ on volume ]
         USING ?????                        [ time in 100ths sec. ]

**** END PAUSE

  [ 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