[Access to Wang masthead]

The SCRN2WP utility

Create a WP document from a screen dump

From "VS Procedure",  Access 86, May 1986
  [ Return to the Catalog of articles ]     [ Next Article ]  

Have you ever needed to incorporate screen images into your word-processing documents? This procedure takes a SCREEN DUMP (a print file showing a screen image), a work file, then copies it into the WP library of your choice. From here you may use the image for documentation, design or any other purpose.

How it works

Procedure SCRN2WP (see Figure 1, below) uses three common utility programs:

Creating SCRN2WP on your system

Before keying in the procedure, check to see that all three utilities are available. COPYWP should be found in the system library @SYSTEM@ on the system volume); be sure to avoid the version in USERAIDS, which is a very different program. CREATE and DISPRINT may be harder to find due to the peculiar distribution methods used for USERAIDS; try the library USERAIDS on the system volume. If in doubt, use FILEDISP (another USERAID) to help search or ask your Wang analyst for help.

While creating the procedure file, you can customize any file or library references to fit your system. For example, you may have to change the library name on line 50 to the one actually used for USERAIDS on your system.

After the code has been entered and successfully passed through the syntax checker, you might want to monitor the progress of the procedure during execution. One way to do this is to temporarily change selected ENTER statements to DISPLAY. For example, change the ENTER keyword to DISPLAY on line 52 and the procedure will stop at that screen, displaying the fields in the CREATE OUTPUT screen - as modified by the procedure. You can now make corrections, note desired changes or simply press RETURN to continue. Another interesting screen to display is the backward references used to create the lines of asterisks on the bottom of the screen image; change the ENTER statement on line 72 to see this in action. (Avoid changing ENTER statements that contain PF key references, such as line 55; this is viewed as an error condition by the procedure interpreter.)

Using SCRN2WP

To use the utility, you must first create a print file of the screen to be converted. To do this, key HELP and then PFl4 while the screen you wish to copy is showing. Important Note: The command processor - and thus screen printing capability- is only available in Data Processing mode, not in Word Processing.

Once the print file has been created, find its filename through DISPRINT or any other means and run the procedure. Enter the name of the print file to be converted, and the WP library and volume. If you wish to specify a document number, enter it here; otherwise, the system will assign the next number in sequence. If using a system-assigned document number, be sure to note the number when COPYWP stops on the last screen - I know of no other means of displaying that number while using this utility. (No kidding, I've tried every method I can think of to display this number.) After noting the document number, press PFl6 to exit COPYWP and continue with the procedure.

After successful completion, you have a WP document that contains a representative image of your original screen. Right away you'll see that overstrike characters, such as underlining or bold printing, will show up as individual tines. These items will have to be adjusted manually, as the logic needed to insert the necessary control characters is beyond the scope of a procedure.

Some variations on the theme

After you've run the program a few times, you may wish to try some variations, such as:

1. Hard-code the usual WP volume and library into the DECLARE statements at the head of the code so you won't have to enter them each time.

2. Adjust the "framing" of the screen image by creating a box completely around it. (Be sure to enlarge the line length of the work file before proceeding!)

3. The procedure already checks some error conditions. Add more messages to prevent other data entry errors.

4. SCRATCH the printer or work files after successful conversion.

That's all there is to it! I hope this assists you in your documentation efforts. Next month, we'll cover some elements of procedure style and the procedure writer's toolkit.


Figure 1: The SCRN2WP Procedure


     PROCEDURE SCRN2WP

**********************************************************************
*
*            SCRN2WP - Converts Screen Dumps to WP Documents
*
*    This procedure was featured in the May 1986 ACCESS 86.  It uses
*    CREATE to build a WP document from a user's screen dump.  The
*    screen image is delineated by rows of asterisks at top and
*    bottom.  One document is created for each print file.
*
*    NOTE: this procedure runs a poor second to the USERAID SCRNS2WP,
*    which will convert multiple print files and place them into a
*    single document.  Its sole advantage lies in the ability to
*    control the presentation of the screen image to suit personal
*    taste.
*
*    Written by Dennis S. Barnes
*
*    MODIFICATION HISTORY
*
*    Version 1.0   11/15/85   Initial version.
*
**********************************************************************

     DECLARE &INFIL, &INLIB
                         STRING (08)
     DECLARE &INVOL, &SVOL, &WPVOL
                         STRING (06)
     DECLARE &WPDOC      STRING (05)         INITIAL "NEXT "
     DECLARE &KEY, &VAL  INTEGER

     EXTRACT             &INLIB    = SPOOLIB, &INVOL   = SPOOLVOL,
                         &SVOL     = SYSVOL

MENU:

     ASSIGN &INFIL       = " "

     PROMPT              PFKEY     = &KEY
     "                      CREATE WP TEST FROM SCREEN DUMP";;;
     "                   Enter the location of the input file:";;
     "                           FILE =", UPPER &INFIL;
     "                        LIBRARY =", UPPER &INLIB;
     "                         VOLUME =", UPPER &INVOL;
     "               and the Word Processing VOLUME and LIBRARY:";;
     "                    WP DOCUMENT =", UPPER &WPDOC(1,4);
     "                     WP LIBRARY =", UPLOW &WPDOC(5,1);
     "                      WP VOLUME =", UPPER &WPVOL, " ";;;
     "                                    OR";;;
     "                   Press PF(13) to Display print files";
     "                         Press PF(16) to EXIT";;

     IF &KEY = 16        GOTO ENDOFJOB
     IF &KEY = 13        GOTO RUNDSPRT
     IF &KEY <> 0        GOTO MENU

     IF NOT EXISTS FILE &INFIL IN &INLIB ON &INVOL     GOTO MENU
     IF &WPDOC(1,4) = "NEXT"       GOTO RUNCREAT
     IF &WPDOC(1,4) < "0000"       GOTO MENU
     IF &WPDOC(1,4) > "9999"       GOTO MENU

RUNCREAT:

     RUN CREATE IN USERAIDS [ on volume ]

O1:  ENTER OUTPUT        FILE      = "##TEXT",
                         TYPE      = "C",
                         RECSIZE   = "80",
                         RECORDS   = "100"
     ENTER INPUT         02
P1:  ENTER PAD           PAD       = " ",
                         POSITION  = "1",
                         LENGTH    = "80"
     ENTER INPUT         16
     ENTER COUNT         RECORDS   = "1"

     ENTER INPUT         02
P2:  ENTER PAD           PAD       = "*",
                         POSITION  = "1",
                         LENGTH    = "80"
     ENTER INPUT         16
     ENTER COUNT         RECORDS   = "1"

     ENTER INPUT         FILE      = &INFIL,
                         LIBRARY   = &INLIB,
                         VOLUME    = &INVOL
     ENTER FILE          INPOS     = "8",
                         LENGTH    = "80",
                         START     = "8",
                         END       = "LAST",
                         CINPOS    = "3",
                         CLENGTH   = "4",
                         COMPARE   = "NE",
                         CSTRING   = "****"
     ENTER INPUT         16

     ENTER INPUT         02
     ENTER PAD           (P2)
     ENTER INPUT         16
     ENTER COUNT         RECORDS   = "1"

     ENTER INPUT         02
     ENTER PAD           (P1)
     ENTER INPUT         16
     ENTER COUNT         RECORDS   = "1"

     ENTER INPUT         16
     ENTER EOJ           16

     IF RUNCREAT = 0     GOTO RUNCPYWP

     ASSIGN &VAL         = RUNCREAT

     PROMPT              ALARM     = "YES"
     CENTER BLINK        "E R R O R ! !";;
     CENTER              "CREATE has returned error code ", &VAL;;
     CENTER              "The procedure will end";;

     GOTO ENDOFJOB

RUNCPYWP:

     RUN COPYWP IN @SYSTEM@ [ on volume ]
     ENTER FUNCTION      14
     ENTER INPUT         (O1)
     ENTER OUTPUT        VOLUME    = &WPVOL,
                         DOCUMENT  = &WPDOC,
                         TYPE      = "IMAGE"
     ENTER OPTIONS       LENGTH    = "81"
     DISPLAY FUNCTION

     IF RUNCPYWP = 0     GOTO MENU

     ASSIGN &VAL         = RUNCPYWP

     PROMPT              ALARM     = "YES"
     CENTER BLINK        "E R R O R ! !";;
     CENTER              "COPYWP has returned error code ", &VAL;;
     CENTER              "The procedure will end";;

     GOTO ENDOFJOB

RUNDSPRT:

     RUN DISPRINT IN USERAIDS [ on volume ]

     GOTO MENU


ENDOFJOB:

     RETURN
  

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


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