.PAGE SIZE 55, 68 .CENTER Coping with Office Automation Products .BLANK.CENTER (such as All-In-1 and WPS-Plus) .BLANK.CENTER using Datatrieve. .BLANK 2.CENTER B. Z. Lederman .BLANK.CENTER ITT World Communications .BLANK.CENTER New York, NY 10004-2464 .BLANK.NOTE Abstract This paper is intended as the first in a series showing some of the uses for Datatrieve in managing and/or coping with such products as All-In-1. This particular article is being given first because it deals with the document database which is used by WPS-Plus/All-In-1 (formerly a separate product but now supplied automatically with All-In-1), WPS-Plus/VMS, and (probably) with ordinary WPS: this document database is used by All-In-1 even if you have selected the EDT editing style. I expect that most of the succeeding articles will be primarily All-In-1 oriented. .PARAGRAPH For the remainder of this article, AI1 is an abbreviation for All-In-1, WPS for any version of WPS or WPS-Plus, and DTR for Datatrieve. .END NOTE .PARAGRAPH Datatrieve is a product which allows easy access to and manipulation of data. In considering office automation, it is usually thought of as a product to manipulate end-user data (data bases containing accounting information, telephone directories, personnel directories, purchase order information, or whatever). What may not be immediately obvious is the data which must be managed when other office automation products are used, particularly All-In-1 and WPS word processing. These products create and use their own database files, and while they also (generally) come with their own utilities and commands for the proper examination and maintenance of those files, there are times when using Datatrieve allows faster, easier, or more versatile access or management of this information. I will present a number of such uses, starting with this article on the document database (the DOCDB.DAT file) which contains the list of documents for each user of All-In-1 and/or WPS-Plus. .BLANK.NO JUSTIFY.NO FILL.TEST PAGE 8 DELETE DOCDB__RECORD; REDEFINE RECORD DOCDB__RECORD OPTIMIZE ! ! Document data base (DOCDB.DAT) definition for ! WPS and All-In-1. ! ! I don't recommend adding or deleting documents using ! DATATRIEVE (except in emergencies like DOCDB.DAT ! corruption). However, it is useful if you want to find out ! what VMS file is related to a given document, and to check ! to see if there are any documents in a users' directory ! which do not appear in the document database, which happens ! occasionally when AI1 or WPS regurgitates. ! ! B. Z. Lederman ! 01 DOCDB__REC. 10 LOOKUP. ! ! The first three 20 level fields are the keys defined by DEC. ! 20 DOCUMENT PIC X(36). 20 FOL REDEFINES DOCUMENT. 30 FOLDER PIC X(30). 30 FIXER PIC X(6). 20 REFNUM PIC 9(6). 20 TITLE__HASH PIC X(6). 10 FILENAME PIC X(64). 10 DAF__POINTER PIC X. 10 TITLE PIC X(72) EDIT__STRING T(32). 10 AUTHOR PIC X(30). 10 TYPE PIC X(15). 10 UNUSED__SETUP PIC X(15). 10 FORMAT PIC X(15). 10 KEYWORDS PIC X(50). 10 DATE1. 20 FILLER PIC X(16). 20 CREATED COMPUTED BY CHOICE OF (IM1 EQ " ") THEN FN$DATE("18-NOV-1858 00:00:00.00") ELSE FN$DATE(ID1 | "-" | IM1 VIA MONTH__TABLE | "-19" | IY1 | " 00:00:00.00") END__CHOICE. 20 MODIFIED COMPUTED BY CHOICE OF (IM2 EQ " ") THEN FN$DATE("18-NOV-1858 00:00:00.00") ELSE FN$DATE(ID2 | "-" | IM2 VIA MONTH__TABLE | "-19" | IY2 | " 00:00:00.00") END__CHOICE. 10 DI1 REDEFINES DATE1. 20 IM1 PIC XX. 20 FILLER PIC X. 20 ID1 PIC XX. 20 FILLER PIC X. 20 IY1 PIC XX. 20 IM2 PIC XX. 20 FILLER PIC X. 20 ID2 PIC XX. 20 FILLER PIC X. 20 IY2 PIC XX. 10 MAIL__ORIG PIC X(6). 10 F3 PIC X(30). 10 MAIL__STATUS PIC X(8). 10 F2 PIC X(12). 10 DOCNUM PIC 9(6) EDIT__STRING Z(6). 10 DELETABLE PIC X. 10 MODIFIABLE PIC X. 10 DATE2. 20 FILLER PIC X(33). 20 CREATED COMPUTED BY CHOICE OF (IM2 EQ " ") THEN FN$DATE("18-NOV-1858") ELSE FN$DATE(ID3 | "-" | IM3 VIA MONTH__TABLE | "-" | IY3 | " " | IH3 | ":" | II3 | ":" | IS3 | "." | IF3) END__CHOICE. 20 CREATED__TIME COMPUTED BY FN$TIME(DATE2.CREATED) EDIT__STRING X(11). 20 MODIFIED COMPUTED BY CHOICE OF (IM2 EQ " ") THEN FN$DATE("18-NOV-1858") ELSE FN$DATE(ID4 | "-" | IM4 VIA MONTH__TABLE | "-" | IY4 | " " | IH4 | ":" | II4 | ":" | IS4 | "." | IF4) END__CHOICE. 20 MODIFIED__TIME COMPUTED BY FN$TIME(DATE2.MODIFIED) EDIT__STRING X(11). 10 DI2 REDEFINES DATE2. 20 IY3 PIC XXXX. 20 IM3 PIC XX. 20 ID3 PIC XX. 20 IH3 PIC XX. 20 II3 PIC XX. 20 IS3 PIC XX. 20 IF3 PIC XX. 20 F4 PIC X. 20 IY4 PIC XXXX. 20 IM4 PIC XX. 20 ID4 PIC XX. 20 IH4 PIC XX. 20 II4 PIC XX. 20 IS4 PIC XX. 20 IF4 PIC XX. 10 V1TYPE PIC X(16). 10 DSAB PIC X(16). 10 F6 PIC X(45). ; .BLANK.JUSTIFY.FILL I cannot find a use for all of the fields, and there are some (F4 and F6, for example), in which I have never seen any data from AI1 or WPS, but they must all be there to match the defined record length. I'm not sure what the distinction between the two sets of CREATED and MODIFIED dates is either, but I know they are there. In case you are wondering where I got some of these field names: I found a form in MEMRES called DOCDB (there is also one in OAFORM called DOCDBSF for the system shared DOCDB), and matched up the corresponding fields with a previous record definition which was obtained by looking for related data areas with the DUMP utility and Datatrieve. I have not found any forms, menus, or scripts in AI1 that will lead you to the DOCDB manipulation form (and I have looked), and once you are in the form it is typically tedious to use as you can only get one record at a time by using the FIXER field (entering a FOLDER doesn't seem to work). It does use FMS to spread the fields out on one screen, which can be nice, and it will allow you to add, delete, or modify records, but I prefer Datatrieve: I can always define my own form (or even copy the AI1 form) and use it from within DTR if I want to. .PARAGRAPH The key fields look a little odd, but they match the fields defined by WPS and AI1: you can find out about such fields by doing an ANALYZE/RMS or DIR/FULL on a file to see the fields, or you can look in OA$LIB for the FDL files supplied with the products and used during such things as document database (file cabinet) re-organization. .PARAGRAPH There is one very important field which is included in this record definition which is not usually obtainable within WPS or AI1, and that is the VMS file which contains the document (the field FILENAME). It happens (a little too often) that the DOCDB.DAT file becomes corrupted, and then it is necessary to try to coordinate the VMS files with the documents: this record definition allows you to obtain a listing of all documents AI1 (or WPS) knows about and compare it with a directory listing to find missing documents or files. If there are VMS files not recorded in the document database you could add an entry with Datatrieve, though I would recommend you first try using WPS to create a document and then do a Gold-G (GET) to incorporate that file into a new document. If there is an entry in the document database for which there is no file you can use Datatrieve to delete the entry, though again I would suggest you first try the document database verification procedure supplied for the All-In-1 manager. If the normal procedures don't work, then you may want to use DTR to modify the DOCDB.DAT file. .PARAGRAPH I also find that it is faster to use DTR to obtain an index listing of all documents than it is to use AI1. .BLANK.NO JUSTIFY.NO FILL.TEST PAGE 8 REDEFINE PROCEDURE DOCDB__REPORT ! ! Fast report of all documents with their VMS file name. ! ! B. Z. Lederman ! REPORT DOCDB ON *."file specification" SET COLUMNS__PAGE = 132 SET LINES__PAGE = 42 PRINT NUMBER, FOLDER, TITLE USING T(48), FILE USING T(24) END__REPORT END-PROCEDURE 13-Nov-1986 Page 1 NUMBER FOLDER TITLE FILE 13 DEC mulvey [.DOC3]ZRDQBBSVI.WPL 2 DICTIONARIES PERSONAL DSK3:[LEDERMAN]PERSONAL.LGP 16 OUTBOX Read Receipt for Test OA$SHARE1:ZRDXBRAEN.TXT 9 PLOTS dtrgraph [.DOC9]ZRBUASZZA.WPL 15 READ Test Mail Message OA$SHARE1:ZRDXBQWZF.TXT .BLANK.JUSTIFY.FILL The sample report has been squeezed to fit the newsletter page format, but you can still see the information provided. It happens to be sorted by folder because the folder name forms part of the primary key, but with DTR it is possible to easily change the report for the format and sort order you want. I have even put a Datatrieve procedure like this one into a form and included it as an All-In-1 application so that users can simply type one command and have a complete index of their documents sent to their default printer. .PARAGRAPH To use a record definition you must, of course, also define a domain. Rather than define one for every user, you can take advantage of the logical name created for WPS-Plus users during login to set the correct directory to access from DCL level: .BLANK DEFINE DOMAIN DOCDB USING DOCDB__RECORD ON OAUSER:DOCDB.DAT; .BLANK The logical name OAUSER should translate to the directory where your document database is (usually [user.WPSPLUS]). If you intend to use the definition only while you are within All-In-1 you should be able to specify the file as DOCDB.DAT with no directory, as AI1 should already have put you into the correct directory specified in your PROFILE, though you could also assign a logical name similar to OAUSER in the SYLOGIN.COM file so that the same definition can be used if you access DTR from within AI1, or if you go into DTR directly from DCL level. By using logical names, you can put one copy of the record and domain definitions, and any report procedures, into a common dictionary rather than multiplying them for every user. You might also want to define one domain just for the postmaster: .BLANK DEFINE DOMAIN DOCDB__POSTMASTER USING DOCDB__REC ON .BREAK.INDENT SYS$SYSDEVICE:[ALLIN1.POSTMASTE]DOCDB.DAT; .BLANK changing the logical name SYS$SYSDEVICE if you have your AI1 libraries on disk other than the system disk. This way you can look at the POSTMASTER's database (which may include system wide information such as mail messages) without logging into VMS POSTMASTER account, or you may not even have to have a VMS account for the POSTMASTER. This could be important, since the release notes for All-In-1 V2.1 warn against logging into the POSTMASTER account as it can lock out the message router and cause mail messages not to be delivered. .PARAGRAPH In defining the record definition I am covering up the ASCII character string representations of dates and times in the document database with FILLER, and then using COMPUTED#BY statements to convert them into Datatrieve standard dates and times. This may not be strictly necessary for all applications, but it does make it a lot easier to do lookups and comparisons of dates and times (for example, if you want to find the documents created or revised on a certain date, or before or after a given date, etc.). To do the conversion requires a table to translate numeric months into the appropriate abbreviated month name. .BLANK.NO JUSTIFY.NO FILL.TEST PAGE 8 REDEFINE TABLE MONTH__TABLE 01 : "JAN", 02 : "FEB", 03 : "MAR", 04 : "APR", 05 : "MAY", 06 : "JUN", 07 : "JUL", 08 : "AUG", 09 : "SEP", 10 : "OCT", 11 : "NOV", 12 : "DEC" END__TABLE