Here's the Needle!Finding files fast with BACKDATA |
|
From "VS Workshop", Access to Wang, July 1990 |
|
[ Prior Article ] [ Return to the Catalog of articles ] [ Next Article ] |
This month I'll demonstrate one way that you can use your backup listings as data for ad hoc inquiries, converting the print files into data files. The conversion process itself also provides an excellent forum for discussing Wang's COBGEN utility - a COBOL code generator perfect for simple programming problems such as this. So let's dive in!
Picture a VS user who has just discovered that a file has be accidentally deleted. Backup tapes from the prior evening have already been sent off-site, and there will be a delay (and some cost) to bring them back. The prior night's backup tapes are on hand, but you're not sure whether the file has been modified between these backups - or even which days it was backed up. Our user settles with a groan before a large stack of backup listings and begins to sift through them.
My alternative to this scenario is to convert the listings themselves to data and store that data for inquiry purposes. With the data in this simple file format, sophisticated queries can be constructed with programs or the Wang File Management utilities (INQUIRY, REPORT) to find specific information fast. Instead of poring through reports - with the possibility of missing critical information - a search could be constructed using INQUIRY, REPORT, or other means.
Since print files are a form of consecutive file, they could be used by themselves as a basis for inquiry. I have used this technique in the past, retaining the print files as permanent logs and searching within DISPLAY and with text search tools such as FINDTEXT. The data file approach allows all file references to be combined into a single file, providing a full view of its backup and modification history.
In creating the backup data file (BACKDATA), you have a choice of the information you wish to pick up from the backup listing. Some fields may not be of interest and could be ignored, reducing the size of the output file. For my purposes, I chose to accept all of the fields and even add the date and time the backup was performed. The field locations in the input and output files are listed in Figure 1 (below).
The CREATE utility and an appropriate procedure may be used to convert the backup listings into BACKDATA format. If you use this approach, be sure to use the PAD option (PF2 from the INPUT screen) to move spaces into the record area before each print record is read. This is necessary because print file records vary in length and characters left in the buffer from prior records will be "carried" through to subsequent records, resulting in garbage in the output records.
Programming languages offer better control and more functionality than procedure-driven solutions. In my use, I extracted the run date and time from the second header record of the file and duplicated it as a time stamp within each record. I also appended the new listing information into an existing version of BACKDATA, checking for duplicate entries and removing entries over 60 days old.
COBGEN is among the utilities that are supported by Wang Laboratories beginning with the 7.20 operating system. Like others, it was formerly a USERAID - distributed by the International Society of Wang Users but not maintained or supported in any way.
The purpose of COBGEN is to create a shell COBOL program with most standard sections of a COBOL program defined, allowing the programmer to concentrate on the real meat of the problem: the PROCEDURE DIVISION. It accepts information about the program from the user, then generates the code using standard names and sections. Other than main control paragraphs and file I/O, the PROCEDURE DIVISION is left for the user.
While not a requirement, COBGEN works best with CONTROL files for its file specifications. COBGEN can interpret these files, creating the required SELECT, FD, and file access sections. Standard PROCEDURE DIVISION file I/O statements are also generated.
Prior versions of COBGEN suffered from imperfect translations of CONTROL files, including mistakes when record areas were defined within more than one data element (i.e. redefined). The program checked that no COBOL reserved words were used for illegal purposes (such as data names), but the list of those words was out of date. Version 2.08.03 corrects most of these difficulties and adds some functionality as well.
The new version supports COBOL-85 as well as COBOL-74, and offers SORT operations using either the SORTLINK subroutine or the internal SORT verb. As before, code can be generated to handle FIGURATIVE-CONSTANTS, dates, calls to other programs, and the WORKING-STORAGE elements for calls to the GETPARM and PUTPARM subroutines. Up to nine disk files can be processed, and the workstation can display up to nine screens; a single print file is allowed. COBGEN relies on other Wang utilities (EZFORMAT for screens, CONTROL for file definitions, EZPRINT for report definitions) and optionally links to these utilities for convenience.
If you are conversant with COBOL, the COBGEN utility makes an excellent starting point for simple problems such as the BACKDATA conversion program. The CONTROL files created for use with INQUIRY and REPORT become the only input necessary to generate a shell program, leaving only the data field MOVEs and few other details to take care of. In short, COBGEN helps you to concentrate on solving the problem - rather than spending long hours chasing variable names and errors. Give COBGEN a try the next time you need to write a short program.
Figure 1: Field Locations for BACKDATA
Field description Field name Input
PositionOutput
PositionLength Location - Volume VOLUME 3 1 6 Location - Library LIBRARY 13 7 8 Location - File FILE 24 15 8 File sequence FSEQ 34 23 4 File organization FORG 40 27 6 Record format RECFM 48 33 1 Record length LRECL 54 34 4 Number of Records NRECS 59 38 7 Protection class CLASS 70 45 1 Owner of record USER 76 46 3 Creation date - month CREMM 84 51 2 Creation date - day CREDD 87 53 2 Creation date - year CREYY 90 49 2 Expiration date - month EXPMM 95 57 2 Expiration date - day EXPDD 98 59 2 Expiration date - year EXPYY 101 55 2 Modification date - month MODMM 106 63 2 Modification date - day MODDD 109 65 2 Modification date - year MODYY 112 61 2 Error flag ERROR 120 67 5 Backup date - year TIMEYY - 72 2 Backup date - month TIMEMM - 74 2 Backup date - day TIMEDD - 76 2 Backup time - hour TIMEHOUR - 78 2 Backup time - minute TIMEMIN - 80 2
Copyright © 1990 Dennis S. Barnes
Reprints of this article are permitted without notification
if the source of the information is clearly identified