THE WOMBAT EXAMINER February 1982 Vol. 4 No. 1 DATATRIEVE GOES NATIVE TABLE OF CONTENTS 1 Message From the Editors 1 In This Issue 2 Instructions for Contributors 3 Survey of DTR SIG Members at Miami DECUS 5 Of Special Interest for the Atlanta DECUS 7 Review of Los Angeles DECUS 31 Datatrieve-11 Optimization 36 Letters and Papers 81 Datatrieve Library and Library Contributions 93 Wombat Magix - LA DECUS ------------------------------------------------------------------ EDITORIAL BOARD Chairman: Chuck Watson Batelle, Pacific NW Labs P.O. Box 999 Richland, Washington 99352 FTS: 444-2227/(509)376-2227 Editors: Cynthia Curry Boeing Commercial Airplane Company P.O. Box 3707 Mail Stop 9R-05 Seattle, Washington 98124 (206)237-3242 Virginia Sventek Computer Science and Mathematics Building 50B Room 3238 Lawrence Berkeley Laboratory Berkeley, California 94720 FTS: 451-5216/(415)486-5216 ----------------------------------------------------------------------- ABOUT THE COVER At the Fall DECUS in Los Angeles Digital announced their VAX-11 Information Management Architecture. One of the parts of this new product is VAX-11 Datatrieve, otherwise known as "native mode Datatrieve." The Digital development people created the slogan on the cover for their T-shirts worn for the unveiling. 1 MESSAGE FROM THE EDITORS Due to the recent job change by the previous newsletter editor, Kathy Tamer, the WOMBAT EXAMINER is now under new management. Virginia Sventek and myself are joining forces to get the presses rolling again. Our membership is somewhere around 2000. We perceive that membership is motivated by a need to share DTR techniques. The newsletter is the primary vehicle to do this and its success depends on written contributions from our members. The policy has been to publish only when there is enough material to break even on the publishing costs. We are going to try to put out about four issues per year so please take a few minutes and send us your written material. IN THIS ISSUE This issue contains a lot of material which has stacked up during the year since the last newsletter was published. Chuck Watson has written an article about the VAX Data Management Day at the upcoming Spring 82 DECUS in Atlanta. Larry Jasmann has written a description of the DATATRIEVE Pre-symposium Seminar planned for Atlanta. Thanks to the Digital development people who gave presentations in LA on DATATRIEVE and the VAX Information Management Architecture for submitting their slides to the newsletter. Phil Naecker has written an excellent paper on user-defined functions in VAX-11 DATATRIEVE. We also have the slides from the WOMBAT Magic session in LA. Something new is the library section where we will print DTR techniques, hints, suggestions, applications, etc., submitted to the DATATRIEVE library by the SIG members. All of the information submitted to this newsletter is transcribed and/or printed as is. This means the newsletter staff does not attempt to verify the correctness or explain the reasoning behind any items submitted. We have tried to be as accurate as possible in transcribing information from slides but we apologize for any errors we may have missed. Cynthia Curry Virginia Sventek 2 INSTRUCTIONS FOR CONTRIBUTORS contributions for the newsletter should be sent to: Editor, DATATRIEVE Newsletter c/o DECUS, One Iron Way MR2-3/E55 Marlboro, MA 17562 Letters and articles for publication are requested from members of the SIG. They may include helpful hints, inquiries to other users, reports on SIG business, summaries of SPRs submitted to Digital or other information for members of the DATATRIEVE SIG. Camera ready copy is appreciated, but almost anything legible will be considered. However, this newsletter is not a forum for job and/or head hunting, nor is commercialism appropriate. NAME OF CONTACTS The following SIg members have volunteered to receive phone calls regarding DATATRIEVE. Please remember that your phone call is an interruption of a full-time obligation to their employer. Prepare your questions beforehand and limit the call to 15-20 minutes. Additional volunteers will be listed in the next issue. Beth Carter (RSX-11M) Bob McCormick (RSTS) Bridgeport-Textron Farm Credit Banks of Springfield 200 Precision Rd. P.O. Box 141 Horsham, PA 19044 Springfield, MA 01101 215/674-2700 413/786-7600 Joan Hilton (VMS, RSX-11M) Leigh Hart Smith (VMS) G. D. Searle MS 2500 P. O. Box 1045 XEROX Corporation Skokie, IL 60076 Pasadena, CA 91107 213/351-2351 X1820 WANTED - J. CLARK!!! During the DTR SIG wrap-up session in LA, somebody named J. Clark volunteered to coordinate a consultant list which would be published in the WOMBAT EXAMINER. Unfortunately, we have not heard from him and have no address or phone number by which to reach him. Any information leading to his identity will be greatly appreciated. Please contact me as soon as possible. Cynthia Curry WOMBAT EXAMINER Editor 3 SURVEY OF DATATRIEVE SIG MEMBERS AT MIAMI SYMPOSIUM MAY 21, 1981 The following survey was conducted by show of hands at the closing session of the SIG on Thursday morning. About 55 people were in the room. A similar survey ought to be conducted via mail to obtain a profile of the membership at large. Rate the overall DECUS symposium experience. LESS THAN EXPECTED 0 (0%) ABOUT AS EXPECTED 28 (51%) GREATER THAN EXPECTED 12 (22%) no opinion 15 (27%) Which DATATRIEVE activity was the most useful to you? USER PAPER 0 (0%) CAMPGROUND 1 (2%) PANEL DISCUSSION 2 (4%) DEC INTRO TO DTR 3 (5%) DEC OPTIMIZATION 23 (42%) WOMBAT MAGIC 10 (18%) no opinion 16 (29%) Which DATATRIEVE activity was the least useful to you? USER PAPER 8 (14%) CAMPGROUND 0 (0% PANEL DISCUSSION 1 (2%) DEC INTRO TO DTR 10 (18%) DEC OPTIMIZATION 0 (0%) WOMBAT MAGIC 0 (0%) no opinion 36 (66%) What is your primary programming language? BASIC 17 (31%) FORTRAN 14 (25%) COBOL 6 (11%) OTHER 3 (5%) no opinion 15 (27%) What is your operating system? RSX 11M/M+ 20 (36%) RSTS 16 (29%) IAS 3 (5%) VMS 14 (25%) no opinion 2 (4%) 4 Rate your experience with TSC> DON'T USE IT 29 (53%) POOR 9 (16%) ABOUT AS EXPECTED 2 (4%) EXCELLENT 0 (0%) no opinion 15 (27%) The following questions deal with education. Would someone from your site be sent to a 3-5 day DEC training course for an intermediate (beyound the primer level) course? YES 31 (56%) NO 24 (44%) Would someone from your site be sent to a 3 day DEC seminar on advanced DATATRIEVE if it would be taught without hardware? YES 20 (36%) NO 35 (64%) Would your site bring in a DEC instructor for a 1 day tutorial on advanced DATATRIEVE techniques? What about a 3 day on-site seminar? ONE DAY SEMINAR YES 11 (20%) NO 44 (80%) THREE DAY SEMINAR YES 7 (13%) NO 48 (87%) Would someone from your site pay $100 to attend a pre-symposium tutorial in advanced DATATRIEVE on the Sunday prior to the Los Angeles DECUS symposium? If the SIG were presenting it? If DEC were presenting it? SIG PRESENTING YES 16 (29%) NO 39 (71%) DEC PRESENTING YES 13 (24%) NO 42 (76%) 5 DATATRIEVE WORKSHOP (Sponsored by the DATATRIEVE SIG) This will be a workshop for those who have had experience tiwh DATATRIEVE. Both beginners and advanced topics will be presented for DATATRIEVE-11 and VAX-11 DATATRIEVE users. Presentation will be in one hour modules with two modules taught simultaneously throughout the day. Additionally, a clinic will be provided for those who wish to discuss particular issues on a one-on- one basis with experienced users. Participants will receive a notebook as well as DATATRIEVE documentation. Modules to be presented include: . Basic DATATRIEVE . Reporter Writer . Data Manipulation PT I . System Management . Data Manipulation PTII (DTR-11) . Data Manipulation PTB(VAX-DTR) . Hints & Kinks (DTR-11) . Hints & Kinks (VAX-DTR) . New Features VAX-DTR PT I . New Features VAX-DTR PT II Who should attend: If you wish to earn to use DATATRIEVE to really "Talk" to your computer, come to Atlanta a day early. Coordinator: LCDR L.M. Jasmann, U.S. Coast Guard, New Orleans, LA Registration fee: $150.00 6 VAX Data Management Day At Atlanta DECUS Chuck Watson Datatrieve SIG Chairman ----------------------------------------------------------------------------- Something new is in the works for the Spring DECUS symposium at Atlanta. The VAX, Data Management, and Datatrieve SIgs are cooperating to sponsor the first "theme" day at a symposium. Tentatively scheduled for Tuesday, May 11, this day will focus on the common theme of data management on VAX computers. The day will get started with a keynote address focusing on the opportunities for developing effective data management under the VAX Information Architecture. Negotiations are underway to obtain an outstanding personality for this address. Other speakers will address areas of global interest in the morning. at least two streams of sessions will be given in the afternoon, covering such topics as . Decision Support Services in a Data Base Environment . Data Base Systems in a Scientific Environment VAX Datatrievers will be especially interested in: . A New Approach to Systems Design and Documentation through Datatrieve . Who Should Implement Datatrieve Applications: End Users or DP Personnel? This joint scheduling of papers in a single day, and hopefully in adjoining rooms, indicates an awareness of your SIG leadership that many of your interests cross SIG boundaries. I see this as a healthy trend. I look forward to Atlanta, and especially to Tuesday, VAX Data Management Day. 7 VAX-11 Information Architecture Overview Digital Equipment Corporation December 1981 DECUS Los Angeles, California Observations: . Applications and requirements vary widely . Programming is difficult and expensive . Established requirements grow over time Conclusions . No single product can meet all requirements Design Goals: . Improve productivity of programmers . Allow end users to work independently Different Environments ____________________________________________________________________________ . Structured . "Ad hoc" . End user Structured Environment _____________________________________________________________________________ . Often staff function (EDP department, MIS group) . Experienced DP professionals . High pay-back applications . Traditional DP tools . Large backlog of work "Ad Hoc" Environment ----------------------------------------------------------------------------- . Part of line organization . Some stable functions, many transient applications . Decision support focus . Often need access to corporate data . Often report up to corporate . Less sophisticated DP people . Need higher level tools End User Environment ----------------------------------------------------------------------------- . Line individual . Decision support interest, not computer as computer . Need access to corporate and departmental data . Must be independent of programmer 8 The Challenge to Digital ----------------------------------------------------------------------------- . Design information management software products in an architecture -Range of tools (technologies) for varying needs -Improve productivity at all levels -Integrated to facilitate controlled information flow within organization -Effective in local and distributed environments . Provide the foundation for additional tools and growth Familiar Components of the Architecture ----------------------------------------------------------------------------- . Virtual memory operating system . Single file access methods . Full range of traditional programming languages . Forms management New Components of the Architecture ----------------------------------------------------------------------------- . High level access to traditional files and DBMS data structures . CODASYL DBMS . Distributed data access . Query and report writing . Graphics . Common data dictionary VAX-VMS Operating System ----------------------------------------------------------------------------- . This single operating system for VAX . Virtual memory . Proven performance VAX-11 RMS ----------------------------------------------------------------------------- . Multiple access methods (sequential, relative, multi key ISAM) . Freedom of design choice . Standard VAX file management system . Proven reliability VAX Application Languages ---------------------------------------------------------------------------- . Wide variety of languages . Programmer matches tool to the task . Languages have the ability to call one another . -Standard call interface 9 VAX-11 FMS ----------------------------------------------------------------------------- . Interactive paint-the-screen forms definition . Fill-in-the-blanks data input . Formatted data output . One forms manager for programming languages and other information management products. VAX-11 DBMS ----------------------------------------------------------------------------- . CODASYL DBMS . ANSI March 1981 Working Document -Designed for mid to large scale applications environment . Multi-user support . Database integrity, recovery support . Fortran, Cobol . "Network" data structures -Complex data relationships . Data base integrity -Journaling, recovery -Rollback of partial transactions -Validation checks -Concurrency control for updates . Control of data definitions -Schema stored in common data dictionary -Subschemas, too . Data indepencence -Subschema mapping -Data definitions removed from program -Relationships managed by DBMS . Simple restructuring without reloading . Default subschemas and storage schemas . Interactive data base manipulation utility for on-line testing . DML extensions to Fortran and Cobol for data base access . Cobol-like interface to manipulation utility for all other languages . Automatic concurrency control with record-level locking and journaling . Storage schema for tuning independent of applications VAX-11 Datatrieve ----------------------------------------------------------------------------- . Powerful and versatile data management language . Query, report writing . High-level data access -Value based semantics -Group operations . Transparent access to DBMS, RMS, DECnet . Transparent distributed access . Business graphics 10 High-level Data access . English-like, non-procedural commands . Powerful data manipulation and relational operators . Transparent access to data in RMS and DBMS . User provided with logical view of data . Callable from user application programs Distributed Data access . User need not know where data is stored . Data is presented as if it were stored locally . Efficient - only records that satisfy query are returned Query and Report Writing . English-like syntax . Full update capabilities . Report writer - print statement . Guide mode Graphics . Graphics presentation of data accessed . Variety of plotting formats identified with simple plot statement . VT125 display and hardcopy on LA34-VA -Color monitor available VAX-11 Common Data Dictionary ----------------------------------------------------------------------------- . Hub of the architecture providing the foundation for control and growth . Central repository for data definitions and remote node addresses used by Datatrieve and DBMs -Datatrieve domains -Record definitions -Schemas, subschemas for VAX-11 DBMS . Same definition can be used by multiple programs . Security controls placed on access to definitions VAX Information Architecture Range of Uses ---------------------------------------------------------------------------- . Structured . Ad hoc . End users 11 VAX Information Architecture Goal: Range of products --------------------------------------------------------------------------- . DBMS . RMS . FMS . CDD . Languages . Datatrieve Well-integrated set of facilities Goal: Improve Productivity -------------------------------------------------------------------------- . Integration of components . Database managements . DBMS defaults, training & graphics features . Choice of languages, tools . High productivity languages . Callable high-level data access . Distributed access Less Programming = Less Management Goal: Let End Users Work Independently ------------------------------------------------------------------------ . Datatrieve non-procedural data access . Logical views of data . Forms . Graphics . Distributed data access Goal: Growth and Change With Less Pain ------------------------------------------------------------------------ . Integration of components . DBMS restructuring . Logical views of data . Distributed data access . Consistent end user interface SUMMARY ---------------------------------------------------------------------------- "The architecture is the key," providing . A set of tools to match the problems . A way to manage organizational growth . Improved productivity at all levels 12 Common Data Dictionary Jeff East Digital Equipment Corporation Presented at December 1981 DECUS Los Angeles, California Topics ---------------------------------------------------------------------------- Directory structure and use Sub-dictionaries and their use Path names Security and protection Audit trails Directory structure and use ----------------------------------------------------------------- Directory is tree structure Root directory called CDD$TOP There are three types of structure: . Objects . Directories . Sub-Dictionary directories Objects: . Holds one data definition -record definitions -VAX-11 Datatrieve domain, procedure, table, and plot definitions -VAX-11 DBMS record, set, area, and realm definitions . Owned by precisely one directory . Are assigned a name by the user Directories: . Used to organize data definitions . Can own other directories, objects, and sub directories . Are owned by precisely one directory . Assigned a name by the user . Each name must be unique within a directory Rationale Behind the Directory Structure: . Promotes the sharing of common data . Allows users to keep their own data definitions private . Provide a central mechanism for maintaining data definitions on VMS Suggestions for Using the Directory Structure: . Keep the top level under the control of a system manager and/or DBA . Divide next layer between departments or major application areas . Keep at least one directory for company wide data definitions . Provide individuals with their own directories if you want them to 13 have unrestricted use of VAX-11 Datatrieve's functions. Sub Dictionary Directories --------------------------------------------------------------------- . Behaves just like a directory . VAX-11 Datatrieve and VAX-11 DBMS do not distinguish between a directory and sub-dictionary directory . Also assigned a name by the user . Holds the name of the dictionary file . Each dictionary file may only be named in one sub-dictionary directory on a system . Sub-dictionary files may be moved to other systems Advantages of using Sub-Dictionary Directories: . VMS security on the dictionary files . VMS accounting and disk quotas can be applied to the dictionary files . Dictionary files can be placed on dismountable media Disadvantages of using Sub Dictionaries: . Performance . You use valuable resources: -open file quotas -CDD lock table slots . Loose binding between dictionary files . Its one more file to manage. Path Names -------------------------------------------------------------------------- . Used to identify directories and objects . Two types of path names: -Absolute -Relative Absolute: . Each directory and object has a unique absolute path name . Always starts at CDD$TOP . Formed by concatenating given names of all ancestors to given name of target directory or object Relative: . Starts at default directory instead of CDD$TOP . Formed by concatenating given names of all ancestors from default directory to target directory or object Guidelines for Path Names: Use absolute when . You will be referencing the directory or object irrespective of your default directory . You want to clearly document the location of a data definition 14 . You need to use a password to gain proper access to the target object or directory Use relative when . You want ease of use . The target object or directory is always referenced from the same default directory . You are building procedures whose operating scope is set by the default directory Security and Protection ------------------------------------------------------------------------ . Dictionary files are subject to VMS file protection . Directories, sub-dictionary directories, and objects are also subject to CDD protection CDD Security Model . Based on the directory hierarchy . Uses Access Control Lists (ACL) to grant and deny access rights . 13 distinct types of access rights which are divided into two parts: universal access rights, and those exclusive to Datatrieve. Universal Access Rights Function Code Description ---------------------------------------------------------------------- Control C May see and modify ACLs Extend X May create directories and objects Forward F May create sub-dictionary directories Global_delete G May delete non-empty directories History H May add audit entries Local_Delete D May delete objects and empty directories Pass P May reference directory or object in a path name See S May look at objects Update U May update objects Access Rights Exclusive to Datatrieve Function Code Description ---------------------------------------------------------------------- Execute E May execute a procedure Modify M May ready a domain for MODIFY access Read R May ready a domain for READ access Write W May ready a domain for WRITE access 15 User Identification Criteria Password (put into path name) Terminal number or class: TTcn -LOCAL -NON-LOCAL -BATCH -NETWORKS USERNAME UIC How This All Fits Together . User starts out with same rights as the parent . The ACL is searched for an entry that matches the user . If none is found then the user has the same rights as at the parent . Otherwise, the matching entry's access right masks are used with the rights at the parent to find the user's rights here Audit Trails ---------------------------------------------------------------------- . Each directory and object may have a history list . History lists are entirely optional . Stored as last-in, first-out History List Entry The following information is kept: . Type of access used . Program name . Process name . User supplied text . Facility . Time of access . UIC Facilities That Use History Lists: . VAX/11 DBM'S DDL & DBO . VAX-11 CDD's Dictionary Management Utility 16 Vax-11 Datatrieve Technical Overview Digital Equipment Corporation DECUS, December 1981 Los Angeles, California New Features ------------------------------------------------------------------------ . Relational join operator . Missing value support . User definable synonyms . User definable functions . Start up file . Scientific notation input/output . Enhanced Collection Manipulation Commands . Domain-based tables . New statistical functions Common Data Dictionary -------------------------------------------------------------------------- . Hierarchical Organization: . One logical dictionary per system . Dictionary may be multiple files (transparent to the user) . Hierarchical (hereditary) security system . Access by name (local directory) or path name . Default directory controlled by logical name (CDD$DEFAULT) . Best of public and private dictionaries Graphics ------------------------------------------------------------------------- . VT125 based (only device supported) . Hardcopy on LA34-VA (receive only version of LA34) . Color on separate monitor . Automatic scaling and labeling . Simple PLOT command . Plot library stored in CDD Plots . Pie chart . Bar charts (single, multiple, and stacked) . X-Y Scatter charts (linear, date, log, and semi-log) . Linear regression (least squares) . PLOT WOMBAT 17 VAX-11 DBMS Access ------------------------------------------------------------------------- . Read, Write, and Modify (no erase) . Explicit set access - MEMBER/OWNER clause in RSE . Magic set access with SET SEARCH . Hide sets with views . COMMIT and ROLLBACK commands Remote Data Access ------------------------------------------------------------------------ . Point of distribution to Information Management Architecture . Uses remote server layered on callable Datatrieve . Data definition and control resides on node with data . Datatrieve decomposes request into local and remote portions . Remote portion of request transmitted to remote server in Datatrieve language . Boolean selection and sorting are done at remote node . Report formatting and calculations done at host node . Performance Advantages: 1. Line traffic minimized by subsetting records and fields 2. Synchronization is minimized 3. Parallelism maximized Datatrieve Callable Interface -------------------------------------------------------------------------- . Commands passed as strings . Records are passed through domains called "ports"; . Callable from all languages supporting call interface except Pascal . Full functionality of stand alone Datatrieve except guide mode, ADT, and command files Benefits . Provides data independence (conversion on the fly) . Provides data base independence (RMS vs DBMS) . Provides high performance remote data access . Automatically optimizes record access and sorting . Reduces program (and programming) time Forms Interface -------------------------------------------------------------------------- . Uses the FMS form driver . Domain definition contains form and form library name . Form automatically used for simple PRINT, STORE, and MODIFY statements . Datatrieve maps record fields to form field by field name . Controlled by SET FORM/SET NOFORM commands . Simplifies data input, update, and display of lartge records . Requires FMS license to build forms 18 Improved Editor ------------------------------------------------------------------------ . Datatrieve editor is modified version of real EDT . Uses standard EDTINI startup file . Follows DCL defaults and logical name . Can INCLUDE and WRITE file external to Datatrieve . Can edit procedures directly . Can edit "last" command entered (error correction) . Can edit any dictionary object by EXTRACT/EDIT/INCLUDE sequence Relational Join Operation -------------------------------------------------------------------------- The Datatrieve CROSS clause in the record selection expression . Form cross products of record stream . Used with OVER or boolean to form relation Example: JOIN(YACHTS CROSS OWNERS OVER TYPE) . Can flatten a hierarchy Example: FAMILIES CROSS KIDS . Can be used to hide DBMS structure Example: PARTS CROSS SUPPLIERS WITHIN PART-SUPPLIER-SET . Can be used with FIND to build cross-collections . Easier to learn and use than hierarchies Missing Value Support ---------------------------------------------------------------------- . A particular value can be designated as "missing" for a field . Missing values are omitted from TOTAL, AVERAGE,MAX, MIN, and standard Deviation . A special edit string to handle missing values . Records may be selected with MISSING boolean operator . "Missing" is propagated through expressions and through assignments . If you're missing MISSING, your're missing VAX-11 Datatrieve User Definable Functions -------------------------------------------------------------------- . May be Run Time Library or written in any language . May return numbers or character strings . Defined in module DTRFND.MAR(on kit): -entry point name -calling sequence -returned value -Datatrieve function name . Must be linked with VAX-11 Datatrieve sharable image 19 User Defined Startup File: ----------------------------------------------------------------------- . Logical name DTR$STARTUP . May contain ANY combination of commands and statements . Not used by callable Datatrieve Scientific Notation: ------------------------------------------------------------------------ . Fortran style scientific notation (1.3E6) accepted for input . Exponential form edit string permits any style scientific notation output . Boring, but it gets the SIG off my back Enhanced Collection Manipulation Commands: ------------------------------------------------------------------------ . The SELECT statement may take boolean . Search may be: Forward (SELECT NEXT WITH ....) Backward (SELECT PRIOR WITH ...) From top (SELECT FIRST WITH ...) From bottom (SELECT LAST WITH ...) . DROP command - drop selected record from collection Domain-Based Tables ------------------------------------------------------------------------- . Second form of DEFINE TABLE . Semantics identical with dictionary tables (VIA and IN) . Table uses existing DOMAIN (RMS, DBMS, or REMOTE) . Table specifies lookup field, value field . Easier to update than dictionary tables . Faster for very large tables New Statistical Functions: ------------------------------------------------------------------------- . Standard deviation . Running count . Running total 20 Datatrieve to DBMS Technical Overview Digital Equipment corporation December 1981 DECUS Los Angeles, California Assumptions ------------------------------------------------------------------------- . Everyone has been introduced to VAX-11 DBMS . Everyone has been introduced to Datatrieve Topics ----------------------------------------------------------------------- . Capabilities of Datatrieve with DBMS . Limitations . Extensions to Datatrieve for DBMS Capabilities ----------------------------------------------------------------------- . Printing data . Changing data . Storing data Many Ways of Displaying Data . Print . Reports . Graphics . Forms Higher Level Data Access . Views . Distributed access . Call interface Limitations ------------------------------------------------------------------------ . One subschema at a time . No ERASE . Speed 21 Extensions ------------------------------------------------------------------------- Data Defintion Language . Query names . Query headers . Edit strings DBMS Set Access . From an owner record get the member records . From a member record get the owner record Set Connections . Store . Disconnect . Connect . Reconnect Data Integrity . Binding . Commit . Rollback Context Magician . Works on Print Lists . Understands Sets . Takes short path over long path . Takes member path over owner path Recap - Extension ----------------------------------------------------------------------- High level, easy to use . Data definition language . DBMS SET ACCESS . Set connections . Data integrity . Context magician Summary ------------------------------------------------------------------------ . All Datatrieve features . Extensions for DBMS 22 VAX-11 Datatrieve Editor and Application Development Wayne Jones Documentation Project Leader, VAX-11 Datatrieve V1.0 Supervisor, Commercial Engineering Documentation Digital Equipment Corporation DECUS, December 1981 Los Angeles, California First: The CONTEXT for this talk -------------------------------------------------------------------------- . Have you used Datatrieve-11? Yes? I bring you tidings of great joy. No? Examine your soul, for you are not yet among the elect. Datatrieve-11 is a powerful data manipulation language. . Easy to learn . Easy to use . Friendly user interface - English language-like syntax - Useful defaults for retrieval of data and for formatting output - Guide Mode - ADT - Useful error messages - Two levels of on-line HELP - Prompting next element in command line These features add up to a tremendous increase in the productivity of application developers. It broadens the range of people who can develop applicatons. It can enhance YOUR productivity. Furthermore, Datatrieve-11 offers . Private dictionaries for data definitions . A report writer . An interfact to DBMS-11 and . An editor 23 With the Datatrieve-11 Editor, you can change definitions of: ------------------------------------------------------------------------ . Domains . Record definitions . Tables . Procedures Two syntax formats for the EDIT command: ------------------------------------------------------------------------- . For editing Datatrieve procedures and tables EDIT EDIT . For editing Datatrieve domains and record definitions EDIT ADVANCED EDIT ADVANCED The Editor performs a valuable and essential function. BUT... No One can deny the PAIN of using the Editor: -------------------------------------------------------------------------- . It's a line editor . The command set is very limited: - TYPE - INSERT - DELETE - SUBSTITUTE - REPLACE - EXIT - QUIT . You have no access by line numbers . You have no one-step access to previous lines The pain of editing with the Datatrieve-11 Editor drives some people to command files -------------------------------------------------------------------------- This is the procedure they follow: . Use the EXTRACT command to copy the dictionary object to a command file - The command file contains a DELETE command, and a DEFINE command . Exit from Datatrieve-11 . Use your favorite editor to change the content of the command file . Return to Datatrieve-11 . Invoke the command file . Go to first step if a problem arises 24 The problems with using command files -------------------------------------------------------------------------- . You have to leave Datatrieve - All collections are released and have to be formed again - All domains are finished and have to be readied again . You incur unnecessary overhead from switching in and out of Datatrieve-11 . You get frustrated at delays when switching in and out of Datatrieve-11 . You must deal with the complexity of naming different versions of experimental changes and backup copies - and you must remember And now for something completely different... Have you ever made a typing error? Of course Have you ever made a typing error or a syntax error when using Datatrieve-11? If you have used Datatrieve-11, of course. Ask yourself or the nearest Datatrieve-11 user, what they have felt after making a typo in: ------------------------------------------------------------------------ . A report specification . A procedure or record definition . A complex STORE or MODIFY statement . A compound statement using BEGIN-END blocks in a FOR loop Not only frustration, but usually rage Not only mutterings underbreath, but too frequent shrieks, curses, and gnashing of teeth. There is no recourse. You must retype THE WHOLE THING Using the Datatrieve-11 Editor to soothe the raging beast within is not a concept. In their dispair, some people put everything complex into procedures. But there are tradeoffs here as well: . You lose immediate prompting and monitoring of syntax . You clutter your dictionary Yes, but... What has all this to do with the VAX-11 Datatrieve Editor? Everything. The VAX-11 Datatrieve Editor can: . Deliver you from these pains and frustrations . Increase your productivity - For all types of work with VAX-11 Datatrieve - Especially for developing Datatrieve applications 25 The VAX-11 Datatrieve Editor is the VAX-11 EDT Editor ------------------------------------------------------------------------ The VAX-11 Datatrieve Editor has all the features of EDT, except journaling. These features include: Hardcopy and screen display On-line HELP faciltiy Keypad Editing On-line error diagnosis Character and line mode editing Commands based on the English language Startup command file Buffer input/output handling Macro capability File input/output handling Fixed, decimal line numbers With the VAX-11 Datatrieve Editor, you can: ---------------------------------------------------------------------- . Change the defintions of domains, records, tables, and procedures . Correct errors that result from faulty typeing, and mistaken syntax and logic . Develop applications including complex procedures and Report Writer specifications The EDIT command has a simplified format ---------------------------------------------------------------------- EDIT [prodedure-path-name] . The results of the EDIT procedure-path-name are the same as those in Datatrieve-11: Datatrieve copies the procedure from the data dictionary to the main text buffer of the editor. However, when you type EDIT something happens: Datatrieve puts the previous command or statement in the main test buffer of the Editor. This is the secret to . Reduced frustration from typing errors . Increased productivity in applications development What happens when you invoke the VAX-11 Datatrieve Editor? ----------------------------------------------------------------------- . The Editor looks for a startup-file - It looks for the logical name EDTINI - It looks in your default VAX/VMS director EDTINI.EDT . If a startup file exists, the Editor executes it to: - change the default settings governing display and editing mode - Set up any special buffers 26 - Set up any user-defined keys . It identifies the type of terminal you have, and responds accordingly Editing Procedures --------------------------------------------------------------------- Editing a VAX-11 Datatrieve procedure is nearly the same as it is in Datatrieve-11. When you leave the Editor with the EXIT command, Datatrieve replaces the old version of the procedure with the new one. When you leave the Editor with the QUIT command, Datatrieve does nothing to the old vesion in the data dictionary. To test a changed procedure, you must invoke it in the usual way; :procedure-path-name More about backup later. Error Correction and Automatic Execution ------------------------------------------------------------------------ When you type EDIT, a world nearly free of frustration and anxiety opens before you: . VAX-11 Datatrieve activates the Editor . It runs your startup file if you have one . It puts the previous command into the main text buffer; now you can - Correct that type - Correct the syntax error - Insert the command(s), statement(s), or both - Change your mind and make adjustments to the previous input line to refine it You can make these changes to previous input because VAX-11 Datatrieve automatically executes everything in the main buffer of the Editor when you leave with the Editor's EXIT command. When you use the QUIT command to leave the Editor, VAX-11 Datatrieve ignores the contents of the Editor's buffer. Correcting a typo ----------------------------------------------------------------------- . Make an error in a long input line (YAHCTS for YACHTS): DTR> PRINT BUILDER, LOA OF YAHCTS WITH LOA>39 AND BEAM>13 "YAHCTS" is not a readied domain, collection, or list DTR> . read error message . Enter EDIT command 27 DTR> EDIT . Make the correction *S/HC/CH 1 PRINT BUILDER, LOA OF YACHTS WITH LOA>39 AND <13 1 substitution * . Use the EXIT command to leave the Editor *EXIT . Watch result of corrected input line: Length Over Manufacturer All Columbia 41 Gulfstar 41 Nautor 41 Newport 41 ------------------------------ DTR> Entering a Forgotten Command -------------------------------------------------------------------------- . Make another error. Enter a premature statement DTR> Print Families "Families" is undefined or used out of context DTR> . Enter EDIT command . Insert new first line before PRINT statement *I Ready families Z 1 Print families *T WH 0.1 Ready families 1 Print families [EOB] * . Use the EXIT command to leave the Editor . Watch the result of the corrected sequence of statements 28 Changing the prior command or statement ----------------------------------------------------------------------- . Enter a REPORT statement DTR> Report Yachts with Beam > 13 RW> At top of LOA print LOA RW> print boat RW> end-report DTR> . Notice error: No output . Enter EDIT command . Change boolean expression: beam>13 to beam bt 11 13 . Enter EXIT command . Notice that no control groups exist . Enter EDIT command . Add SORTED BY LOA to end of rse in REPORT statement . Notice result . Enter EDIT command . Change PRINT statement to omit LOA: PRINT TYPE,RIG,BEAM,DISP,PRICE . Enter EXIT command What Goes into the Editor's buffer? -------------------------------------------------------------------- All of the prior command or statement, regardless of complexity: . An entire report specification (The REPORT statement is one statement) . An entire Define Record, Define File, Define Procedure, or Define Table command . A whole statement, regardless of the number of nested FOR loops, IF-THEN-ELSE statements, or BEGIN-END blocks Exceptions ---------------------------------------------------------------------- . If you have no startup file (DTR$STARTUP), there is no prior command or statement immediately after you log in. . If you abandon an input line with c, that line is lost and is not entered into the Editor's main buffer when you use the EDIT command: If you end the first input line of a command or statement with c, there is no previous command or statement left; If you use c to end a statement with more than one input line, only the line that you end with the c is lost. The previous commands and statements, however, are included in the text buffer of the Editor. . If you have invoked a procedure or command file that contains more than one command or statement, only the last command or statement is available for editing . If a procedure or command file fails, the statement containing the error and all subsequent statements and commands are available for editing . The error message Datatrieve displays if the prior command is: 29 Prior Command Lost. Sorry. It's important to remember the distinction between input line and statement. It is also important to remember one of the differences between commands and statements: You can use only statements to form compound statements. Editing Tables, and Domain and Record Definitions ------------------------------------------------------------------------ There is no EDIT ADVANCED command. This is the general method for editing dictionary objects: . Use the EXTRACT command to put the definition of the object in a disk file. There are now two formats: EXTRACT ON file-spec name[,...] EXTRACT name[,...] ON file-spec . Enter the EDIT command . Delete the EXTRACT command from the main buffer of the editor . Use the INCLUDE command to put the extracted file into the main buffer of the editor: *INCLUDE OBJECT.DEF . Make the desired changes, including changing the name of the object (for testing or transportation) . Use the WRITE command to make a backup copy of the changed definition. This is especially useful for editing record definitions and dictionary tables: *WRITE BACKUP.DEF . Use the EXIT command to leave the Editor . VAX-11 Datatrieve automatically executes the DELETE and DEFINE commands in the main buffer of the Editor . If Datatrieve signals a syntax error, enter the EDIT command again and make the necessary changes . Leave the Editor and Datatrieve automatically executes the DELETE and DEFINE commands . Repeat until done What if I misspell EDIT? ------------------------------------------------------------------------- Datatrieve dutifully notes the error: Expected command or statement encountered "EIDT" Use DTR$SYNONYM to canonize your favorite typos for EDIT: EIDT, EDT, EDIRT The Editor and Restructuring Your Domains ------------------------------------------------------------------------ You may want to change . A record definition - To change edit-strings, missing and default values, etc. - To delete fields - To add elementary fields - To add group fields - To add virtual fields 30 - To restructure field tree - To change data types for a field - To change storage allocation . The organization of a data file - Sequential to indexed - Variable length to fixed length (hierarchies) . Change the domain definition - For different record definition - For different data file Clever but slightly risky hack: . Use EXTRACT and Editor to change record definition . Enter READY with alias: DTR> ready yachts as old DTR> . Invoke command file if created in first step, or leave Editor and have it execute READY, DELETE, and DEFINE commands . Use DEFINE FILE command to create new data file . Use READY command again to get access to new data file and record definition DTR> ready yachts write DTR> . Enter the Restructure command: DTR>Yachts=old DTR> 31 DATATRIEVE-11 OPTOMIZATION COMMANDS AND STATEMENTS by Anne Duncan Digital Equipment Corporation o COMMANDS STAND ALONE o STATEMENTS MAY BE JOINED TOGETHER AS COMPOUND STATEMENTS - BEGIN-END - FOR - IN-THEN-ELSE - REPEAT - THEN o ONLY STATEMENTS MAY CONTAIN VALUE EXPRESSIONS AND RECORD SELECTION EXPRESSIONS COMMANDS GENERALLY PERFORM o THE DATA DESCRIPTION FUNCTIONS - DEFINE - DEFINEP - FINISH - READY - RELEASE o CONTROL AND DISPLAY THE DTR ENVIRONMENT - EXIT - GUIDE MODE - SET - SHOW o PROVIDE ON-LINE ASSISTANCE - ADT - EDIT - HELP 32 COMMANDS AND STATEMENTS STATEMENTS GENERALLY PERFORM o QUERY AND DATA MANIPULATION FUNCTIONS - FIND - STORE - MODIFY - SELECT - ERASE - ASSIGNMENT - SORT o REPORT FUNCTIONS - PRINT - REPORT - SUM o GROUPING OF OTHER STATEMENTS - FOR - BEGIN-END - IF-THEN-ELSE - REPEAT - THEN 33 THE DATATRIEVE-11 TASK ------------------------------------------------------------- : : : ROOT : : : ------------------------------------------------------------- : : : : : : GUIDE : PARSER : COMPILER : RUNTIME : : MODE : AND : AND : : : : COMMANDS : EXTRA : : :---------: : REPORT WRITER : : : : : : : : : : : : : : : : : : : :-------------------: : : :-------------------: : : :---------:-------------------:-------------------:---------: : : : : : RMS : FP EMULATOR : DBMS : : CO-TREE : AND MISC CODE : CO-TREE : : : : : : : : : : : . : : : : . : : : : . : : :-----------------------------------------------------------: : : : : : POOL : : : : : : : 34 CONTEXT AND NAME RECOGNITION CONTEXT IS o THE SET OF CONDITIONS THAT GOVERN FIELD NAME AND TARGET RECORD RECOGNITION o DETERMINED DURING COMPILATION o WHEN NOT RESOLVED, RESULTS IN THE FAMILIAR MESSAGE "NOT DEFINED OR USED OUT OF CONTEXT" A CONTEXT VARIABLE IS o AN ARTIFICIAL "NAME" o SPECIFIED AS PART OF AN RSE o USED AS PART OF FIELD NAME QUALIFICATION o ACTIVE ONLY FOR THE DURATION OF THE STATEMENT TO WHICH THE RSE APPLIES o FOR EACH STATEMENT A CONTEXT STACK IS BUILT o THE CONTEXT STACK IS A LIST OF POINTERS TO CONTEXT BLOCKS. o A CONTEXT BLOCK IS A LIST OF NAMES - CONTEXT VARIABLE OR COLLECTION NAME - DOMAIN NAME - FIELD NAMES 35 CONTEXT AND NAME RECOGNITION THE CONTEXT STACK : :-----------------------------------------------------------: : : : : : LOCAL VARIABLES : : : AND : : : RECORD STREAMS : : : FOR THIS STATEMENT : : : : : :-----------------------------------------------------------: : : : : : COLLECTIONS : : : WITH SELECTED RECORDS : : : : : :-----------------------------------------------------------: : : : : : GLOBAL VARIABLES : : : : V :-----------------------------------------------------------: 36 USER DEFINED FUNCTIONS IN VAX 11 DATATRIEVE Philip Naecker James M. Montgomery, Consulting Engineers, Inc. 555 East Walnut Street, Pasadena, California 941101 ---------------------------------------------------------------------- With the virtual memory power of VMS behind it, new VAX-11 DATATRIEVE (DTR-32) had many new and exciting features and capabilities. Perhaps foremost among the new features are the various "customizing" capabilities: the DTR$STARTUP indirect command file, the DTR$SYNONYM command name substitution file, and the User Defined Functions. This article will provide a general introduction to the use of User Defined Functions (UDFs) and will describe how one may include new UDFs on an installation-specific basis. Examples will be provided, with the overall goal being to give the reader some ideas on how UDFs might help extend DTR-32 into specific applications. WHAT ARE UDFs? User Defined Functions are aptly named - they are both truly User defined and strictly Functions. UDFs are "user defined" in that each DTR-32 installation can easily and completely customize the use ofUDFs, including their operation, their names, and their calling conventions. UDFs are strict "functions" in that they are single-valued on output. A UDF may take zero to 31 input arguments, but may produce only one output result. This distinguishes UDFs from what are commonly thought of as subroutines, which may be multi-valued on output. DTR-32 is installed with a few default UDFs already defined. These functions perform useful specialized operations such as logarithms, trigonometric functions, string manipulations, and conversion of 64-bit VAX-format dates to other formats. All of the UDFs that come with the DTR-32 installation package have names of the form FN$function-name, e.g., FN$SINE (trigonometric Sine), FN$JULIAN (Julian Day), FN$MAX (the maximum of two numbers), etc. The system manager or person responsible for DTR may remove, rename, or extend the list of UDFs by a fairly simple procedure. For example, one could re-define the logarithm function from FN$LN to LOG. The only reason that the FN$function-name naming convention was adopted was to avoid name conflicts. If one changes the name of the log function to LOG, then LOG may not be the name of any other DTR object, such as a field-name, variable-name, or dictionary-name. Typically, UDFs are used to provide access to VMS System Services from DTR but the user lmay also write a program and through UDFs link it with DTR to serve a special purpose. We will examine both uses of UDFs in this article, but let's first examine some typical uses of UDFs. HOW TO USE UDFs UDFs are like functions in many programming languages. They accept arguments in an argument list, 37 enclosed by parentheses. The result is returned as the function itself, which may then be used anywhere that a DTR variable, field, or value- expression may be used - including as an argument to another function. Let's look at some typical uses of the standard UDFs. SOME TYPICAL UDFs FN$MAX(val-1, val-2): The result is the maximum of val-1 and val-2. FN$MAX(FN$ABS(val-1),FN$ABS(val-1)): The result is the maximum absolute value of the two arguments. FN$MONTH(date-1): The result is the number of the month of the date-string. The argument must be of the type DATE, or of the CHARACTER data type with contents interpretable as a date by the usual rules. (The rules for data data types are explained in the DTR documentation, but they haven't changed appreciably from their implementation in DTR-11/VAX (compatibility mode DTR)). FN$STR-EXTRACT (input-string,start,length): The result is the substring that begins at position "start" and has length "length". FN$MIN(FN$FLOOR(val-1/val-2),1): This interesting combination of functions is a simple binary operator. It produces 1 if val-1 is greater than or equal to val-1, 0 otherwise. Here are some examples of how we usually use UDFs. Note that we encourage imbedding UDFs in variables, which gives one access to the edit-string and query-header features of variable while maintaining the power of UDFs. -------------------------------------------------------------- DECLARE LOG-VAL USAGE REAL COMPUTED BY FN$LN(VALUE)/2.303 QUERY-HEADER IS "Log Value". In this example, DATE is a field that has the format YMMDD, where Y is the last digit of the year. This format is conveniently converted to standard VMS date format by the following variables: DECLARE YR USAGE LONG EDIT-STRING IS Z(4) COMPUTED BY 1980 + DATE/10000. DECLARE MO USAGE LONG EDITPSTRING IS Z(2) COMPUTED BY (DATE - 10000*(DATE/10000))/100. DECLARE BY USAGE LONG EDIT-STRING IS Z(2) COMPUTED BY (DATE - 10000*(DATE/1000) -MO*100). DECLARE DAY USAGE DATE COMPUTED BY MO|"/:||DY||"/"||YR EDIT-STRING IS WWWBMMMBDDBYY. 38 The variable LAST-YEAR is used repeatedly, so define it. DECLARE LAST-YEAR PIC 99 USAGE INTEGER COMPUTED BY (FN$YEAR("TODAY")-1). The Age is the employee's nearest age to January 1st. DECLARE AGE USAGE WORD QUERY-HEADER IS "AGE AS OF"/"JAN.1" COMPUTED BY LAST-YEAR-FN$YEAR(BDATE) + 1 - FN$FLOOR(FN$MONTH(BDATE)/7). ---------------------------------------------------------------------- CREATING NEW UDFs UDFs must actually be linked into DTR-32 and if new UDFs are added or if UDFs are changed, all programs using the sharable DTR library (DTRSHR) must be re- linked. (These programs would be using another feature of DTR-32, the Call Interface. This feature allows users to perform functions not easily done in DTR along, while still using the features of DTR by calling it as a sub- program>) It should therefore be obvious that one does not change or extend the UDFs capriciously. However, the process is sufficiently painless that one may wish to have many specialized UDFs, even for functions used infrequently. The process of adding a function is well documented in the VAX-11 DATATRIEVE Call Interface Manual, Chapter 6 but it can be reviewed here quickly by examining the process of defining a simple UDF> A SIMPLE UDF The documentation on UDFs is excellent, as is all of the DTR-32 documentation. It shows an example where one uses UDFs to do some simple string manipulation. Let's take an even simpler example here - we wish to merely convert our input string to all uppercase characters. Thus, our function will have a single input (a string) and a single output (another string.) A brief examination of the VMS Run Time Library Reference Manual (Volume 5 of the VMS documentation set) shows us that there exists a System Service to do this for us, STR$UPCASE. In fact, one might use the more general STR$TRANSLATE service, of which STR$UPCASE is just a special case. STR$TRANSLATE could be used to provide character-wise string substitution, such as replacing all dashes ("-") with underscores ("_"). The documentation shows STR$UPCASE as requiring only 1 input (a descriptor) and with the output also a descriptor. (for readers unfamiliar with the VMS calling standards, the first part of Volume 4 of the VMS documentation set has a fairly good introduction.) To include a new UDF in DTR, we first edit the source program DTRFND.MAR, found in SYS$LIBRARY. This short MACRO program is the connection between our UDFs and DTR, communicating to DTR information about how the UDF is called and how it expects its input and output arguments. The compiled version of DTRFND is then inserted into an object library, DTRFND.OLB. In our case, we insert the following MACRO code fragment into DTRFND. 39 ----------------------------------------------------------------------------- ;FN$UPCASE - String Uppercase Conversion ;Output is a string descriptor ;Input is a string descriptor $DTR$FUN_DEF FN$UPCASE,STR$UPCASE,2 $DTR$FUN_OUT_ARG TYPE = FUN$K_STATUS $DTR$FUN_IN_ARG TYPE = FUN$K_TEXT,OUT_PUT = TRUE $DTR$FUN_IN_ARG TYPE = FUN$K_DESC,DTYPE = 14,ORDER = 1 $DTR$FUN_END_DEF __________________________________________________________________________ The name FN$UPCASE is the internal name which is used to call the function within DTR - it could as easily have been UPCASE, or FN$UPPER_CASE_OF, or FOO. The name STR$UPCASE is the external name of the library routine or user written routine and is used by DTR as the global symbol for the routine entry point. The VMS Linker is instructed to first look in the object library named DTRFUN in SYS$LIBRARY (the same one where we have inserted our new version of DTRFND) for the routine with this external name., If no routine by that name is found, the linker looks in the system library to attempt to resolve the reference. The last argument on the first line of the function definition is the numeral "1", telling DTR that there is only a single input argument. The next three lines of the function definition tell DTR how the arguments and results are passed. The first line tells DTR how to use the contents of the registers after the function call, in this case indicating that a status code is returned in RO. The next two lines correspond to each of the arguments required by the system service STR$UPCASE, in the order that they appear in the argument list for the service. The OUT_PUT = TRUE clause indicates that this argument contains the output of the service call, and the FUN$K_TEXT clasue indicates that the output is a test string of variable length. The FUN$K_DESC clause indicates that the service requires the address of a descriptor, which DTR will then pass. The DTYPE = 14 clause indicates that the data type required by the system service is character coded test (from Appendix C of the Callable Interface Manual.) The meaning of the ORDER clause is more easily understood in a later example, so let's ignore that clause for now. 39A Once we have inserted this code fragment into DTRFND.MAR, we simply compile DTRFND and relind DTR-32. (We must also re-link any other programs that use the DTR-32 sharable library.) $ MACRO/LIST DTRFND $ LIBRARY DTRFUN DTRFND $ @DTR32BLD These three steps will take about one or two minutes on an unloaded system. One may also wish to re-install DTR, it it is normally a known image. That's it!!! No fuss, no muss. MORE COMPLICATED UDFs It is possible to write much more complicated UDFs than the example just given. You may use more powerful system services to perform your tasks, or you may even write programs to link with DTR as functions. A word of warning! If you employ user written functions in your UDFs, remember that you will be linking it with DTR. You are thus responsible for cleaning up after yourself if you do any fancy error handling, trap interrupts, or the like. Needless to say, you should thoroughly test any UDGs you creat before turning them loose on your user community! However, our experience in this area is that DTR is amazingly 40 forgiving, generally continuing to do a good job even after you butcher the foundations on which it is built. Consider the following three UDFs that we are currently using at our installation, a consulting engineering firm with about 700 employees. FN$INV_NORM: The inverse of the normal (Gaussian) distribution function. FN$FAO: The Formatted Ascii Output system service. FN$SALARY_AS_OF: A function to operate on four dates and three real numbers to calculate which salary was in effect at a certain date. FN$INV-NORM The inverse normal distribution function is important in many fields of engineering. It describes the shape of the bell-shapped curve commonly used in statistics. The function itself is the integral of an exponential and is difficult to calculate directly, but there exist some very complicated polynomials to approximate it's value. Unfortunately, the selection of the appropriate polynomial is complicated by the fact that each has a range of applicability. A program to do this can be written in FORTRAN or BASIC, requiring as input just a value from zero to one, representing a percentage of the area under the bell-shaped curve. 40A In our case, the function was written in FORTRAN. The DTR documentation indicates that all procedures to be linked the DTR must be position independent (PIC) if DTR is itself to be PIC. A function written in FORTRAN does not generate PIC code (despite what the VMS Link Map may indicate). Thus, if one writes a function to be linked with DTR in FORTRAN, that portion of the DTR image will not be sharable and each user will get his own copy of the executable code for that portion. This is not a serious limitation in most cases. The function routine in FORTRAN looks something like this: REAL FUNCTION INV_NORM(PERCENT) REAL*4PERCENT ... ... ... INV_NORM = RESULT RETURN END The code indicated by the ellipses contains many different constructs including FORTRAN DO loops, IF statements, DATA statements, etc. It also contains calls to some other subroutines and functions. After the function is compiled with the statement $ FORTRAN INVNORM.FOR, the function and any external routines that is references are placed in the object library DTRFUN, just as in DTRFND.OBJ. In this case, the MACRO code fragment that is placed in DTRFND.MAR is very simple: -------------------------------------------------------------------------- ;FN$INV_NORM - Inverse Normal Distribution Function ;Input is a real longword, the percent probability P in (0.1) ;Output is a real longword. $DTR$FUN_DEF FN$INV_NORM,INV_NORM,1 $DTR$FUN_OUT_ARGTYPE = FUN$K_VALUE,DTYPE = 10 $DTR$FUN_IN_ARG TYPE = FUN$K_REF,DTYPE = 10,ORDER = 1 $DTR$FUN_END_DEF 41 DTR>PRINT FN$INV_NORM(0.54) FN$INV NORM .100433811 DTR>PRINT FN$INV_NORM(23.45871/194.873)("Cumulative"/"Probability")- CON>USING 9.9999 Cumalative Probability 1.1750 ---------------------------------------------------------------------------- FN$FAO The system service Formatted Ascii Output (FAO) is a general purpose routine for converting numbers and characters from internal format to some printable character string. FAO uses a character string called the control string to indicate what the user wishes to do with the arguemnts, which may be of either numeric or character data type. Typical functions performed by FAO include zero-filled or blank-filled numeric conversion (byte,word, or longword) to either decimal, hexadecimal, or octal format. FAO canalso do cute little things like pluralization (inserting the letter "s" if the most recently converted numeric value was not "1"). The particular version of FAO that we have implemented on our system takes a control string and eight numeric arguments, seven integer and one of type DATE. It allows us to print these numbers in almost any format, and also gives us ready access to the system time, pluralization, hex and octal conversion, etc. The following code fragment defines the function in DTRFND, and the example shows how one might use the power of FN$FAO to manipulate character data with ease. --------------------------------------------------------------------------- ;FN$FAO - Formatted Ascii Output ;Output is a character string. ;Input is of any data type, converted to Ascii representation and ;substituted into the output string as specified by directive parameters. ; $DTR$FUN_DEF FN$FAO,LIB$SYS_FAO,11 $DTR$FUN_OUT_ARGTYPE = FUN$K_STATUS $DTR$FUN_IN_ARG TYPE =FUN$K_DESC,DTYPE=14,ORDER=1;Ctr-Str $DTR$FUN_IN_ARG TYPE =FUN$K_NULL;Output Buffer Length $DTR$FUN_IN_ARG TYPE =FUN$K_TEXT,OUT_PUT = TRUE;Output Buffer $DTR$FUN_IN_ARG TYPE =FUN$K_VALUE,DTYPE = 8,ORDER = 2 $DTR$FUN_IN_ARG TYPE =FUN$K_VALUE,DTYPE = 8,ORDER = 3 $DTR$FUN_IN_ARG TYPE =FUN$K_VALUE,DTYPE = 8,ORDER = 4 $DTR$FUN_IN_ARG TYPE =FUN$K_VALUE,DTYPE = 8,ORDER = 5 $DTR$FUN_IN_ARG TYPE =FUN$K_VALUE,DTYPE = 8,ORDER = 6 $DTR$FUN_IN_ARG TYPE =FUN$K_VALUE,DTYPE = 8,ORDER = 7 $DTR$FUN_IN_ARG TYPE =FUN$K_VALUE,DTYPE = 8,ORDER = 8 $DTR$FUN_IN_ARG TYPE =FUN$K_REF, DTYPE = 8,ORDER = 9 $DTR$FUN_END_DEF 42 DELETE TIME; DEFINE PROCEDURE TIME BEGIN DECLARE NOW USAGE DATE. NOW="NOW" PRINT FN$FAO( 'There are !ZL hour!%S.!ZL minute!%S and !ZL second !%S in!4(+)!%T'. FN$HOUR(NOW),FN$MINUTE(NOW). FN$SECOND(NOW,0,0,0,0,NOW)(-)USING X(80) END END-PROCEDURE DTR>:TIME There are 23 hours, 10 minutes and 29 seconds in 23:10:29.78 DTR> ---------------------------------------------------------------------- The example above also shows the use of the ORDER clause in the function definition. Note that the FUN_OUT_ARG refers only to the passing of the data from the function to DTR, not to the passing of the data from the system service to the function. In this case, the system service passes the data to the function in a buffer as defined in the clause with OUT_PUT = TRUE. Note that the length of the output buffer is ignored (FUN$K_NULL) and that only the first and fourth through 12th arguments are passed from DTR to the function. If we wished to pass the argument with a DATE data type (the last argument in the example shown), we could do so merely by changing the ORDER clause to ORDER = 2, and modifying the other order clauses accordingly. FN$SALARY-AS-OF In personnel applications it is common to need to know not only an individual's current salary, but his salary at some previous date. For example, some insuracne policies are based upon an employee's age and salary as of a particular date, usually the first of the year or the effective date of the policy. In our case, we maintain a salary history with three previous salaries and the date each was effective, and it is necessary to compare that list with the effective date and retrieve the salary in effect at that time. This difficult function is easily accomplished in the following FORTRAN function and UDF code fragment. Again, note that we could modify the ORDER clasues to, say, pass all of the dates followed by all of the salaries - without modifying the FORTRAN function. ---------------------------------------------------------------------------- ;This routine calculates an employee's salary as of a particular ;date. It is called from DTR with the function: ; FN$SALARY_AS_OF(TODAY,DATE1,DAL1,DATE2,SAL2,DATE3,SAL3) REAL FUNCTION SALARY_AS_OF(TODAY,DATE1,SAL1,DATE2,SAL2,DATE3,SAL3) ;Declarations... REAL*8 TODAY,DATE1,DATE2,DATE3 REAL*4 SAL1,SAL2,SAL3 43 ;Check each of the dates in turn... IF(TODAY .GE. DATE1) THEN SALARY_AS_OF = SAL1 ELSE IF ((TODAY .GE. DATE2) .AND. (DATE2 .GT. 0)) THEN SALARY_AS_OF = SAL2 ELSE IF ((TODAY .GE. DATE3) .AND. (DATE3 .GT. 0)) THEN SALARY_AS_OF = SAL3 ELSE ; If today is before the effective salary date, use the most ; current salary. TYPE*,'Using latest salary in FN$SALARY_AS_OF.', SALARY_AS_OF = SAL1 ENDIF RETURN END ;FN$SALARY_AS_OF - Calculates the salary of a certain date ;Output is a floating value in R0,R1 ;Input is a series of longwords and quadwords $DTR$FUN_DEF FN$SALARY_AS_OF, SALARY_AS_OF,7 $DTR$FUN_OUT_ARGTYPE = FUN$K_VALUE,DTYPE = 10 $DTR$FUN_IN_ARG TYPE = FUN$K_REF, DTYPE = 11, ORDER = 1 $DTR$FUN_IN_ARG TYPE = FUN$K_REF, DTYPE = 11, ORDER = 2 $DTR$FUN_IN_ARG TYPE = FUN$K_REF, DTYPE = 10, ORDER = 3 $DTR$FUN_IN_ARG TYPE = FUN$K_REF, DTYPE = 11, ORDER = 4 $DTR$FUN_IN_ARG TYPE = FUN$K_REF, DTYPE = 10, ORDER = 5 $DTR$FUN_IN_ARG TYPE = FUN$K_REF, DTYPE = 11, ORDER = 6 $DTR$FUN_IN_ARG TYPE = FUN$K_REF, DTYPE = 10, ORDER = 7 ! DECLARE JAN_SAL USAGE REAL QUERY_HEADER IS "DALARY"/"AS OF"/"JAN. 1" EDIT-STRING IS $$$,$$$ COMPUTED BY FN$SALARY_AS_OF(JAN-FIRST,DATE1,SAL1,DATE2,SAL2,DATE3,SAL3). ! ------------------------------------------------------------------------- SUMMARY By applying User Defined Functions, one may extend the power of VAX-11 Datatrieve into almost any area of programming. The examples included in this article show how simple it is to create your own UDFs, and how use of UDFs can lead to efficient and powerful new applications. It should also be pointed out that UDFs can conceivable be used for complicated terminal output, getting job or process information, creating or manipulating logical names, hibernating or waking up processes sending messages to operators, and an endless variety of similar functions. 44 WOMBAT EXAMINER August, 1981 SPECIAL EDITION DATATRIEVE TRAINING News Flash - Digital's Educational Services has finally organized some seminars on DATATRIEVE. The enclosed material describes a beginners seminar to be given by Steve Pacheco starting in September. This three-day course should help fill the void in DEC's DATATRIEVE training. It looks as if our complaints have finally reached the right person. Richard Jaross, Manager of Seminar Programs requested a copy of our membership list so that this material could be sent directly to you. Since DECUS regulations protect the confidentiality of our membership list, even from DEC, I arranged for Ed Services to pay DECUS for this special mailing. Our regular newsletter will be distributed soon. Not that Ed Services is also planning to offer an advanced DATATRIEVE Seminar next yeat. These seminars will supplement the one-day course that the SIG is offering in conjunction with Los Angeles Symposium. Chuck Watson DATATRIEVE SIG Chairman 45 ***************** * d i g i t a l * I N T E R O F F I C E M E M O R A N D U M ***************** TO: SAT MOHAN DATE: APRIL 8, 1981 BARBARA MANN FROM: ANITA MOEDER PAT SNYDER DEPT: CENTRAL COMMERCIAL CHUCK WATSON ENGINEERING EXT: 264-7197 LOC/MAIL STOP: MK1-2/D03 SUBJECT: ANITA MOEDER AS INFORMATION MANAGEMENT PRODUCT MANAGER FOR DATATRIEVE AND DBMS This is just a short memo informing you that I replaced John Anderson as Information Management Product Manager for Datatrieve and DBMS> I look forward to working with you and our DECUS participants. If I can be of service to you, don't hesitate to call. 46 UAB The University of Alabama in Birmingham School of Medicine/Department of Rehabilitation Medicine August 28, 1981 Chuck Watson Batelle Pacific NW Laboratories P.O. Box 999 Richland, WA 99352 Dear Mr. Watson: I am writing to you to ask that you include the following on the Datatrieve-11 wish list as soon as possible: A version of Datatrieve similar to "SLOTKB" which uses disk storage for managing its pool space. It might be slow, but it could do just about anything requested of it. When we READY a domain that has a large record definition associated with it, about the only thing we can do IS ready it. We can't even find any collections or print any variables, much less sort or qualify our FIND statements. Datatrieve-11 is very good at what it does. It is just very cramped. I am also including a copy of a macro subroutine to convert a VAX date (and, of course, a Datatrieve date) into something more usable by PDP-11 programs. I hope you can use it. Tony L. Wilson System Manager Spain Data Center Spain Rehabilitation Center 47 ; This routine will convert a vax format date (64-bit) into three 16-bit ; integers containing the year, month and day corresponding to the date ; passed. ; It can be called from FORTRAN, COBOL (I hope) or BASIC Plus II. ; CALL FORMAT: ; ; FORTRAN ; DIMENSION NDAT(4) ! VAX date (64 bit precision) ; : ; : ; CALL VAXDAT(NDAT,1YR,1MON,1DAY) ; COBOL (Never tried) ; DATA-DEVISION. ; : ; 03 VAX-DATE PIC 9(4) COMP OCCURS 4 TIMES. ; 03 YEAR PIC 9(4) COMP. ; 03 MONTH PIC 9(4) COMP. ; 03 DAY PIC 9(4) COMP. ; : ; CALL 'VAXDAT' USING VAX-DATE, YEAR, MONTH, DAY ; ; BASIC-PLUS-II ; ; DIM VAX.DATE%(3%) ! (4-word date form) ; : ; CALL VAXDAT(VAX.DATE%(), YEAR%,MONTH%,DAY%) ; ; Inorder to use this subroutine, the DATATRIEVE-11 library (V2.0) must be ; available. You must extract the routine "NUMTIM" from it in the following ; manner: ; ; Assemble this routine: ; ; MAC VAXDAT=VAXDAT ; ; Extract the "NUMTIM" routine from it. ; ; LIB NUMTIM=[n,m]DTRLIB/EX:NUMTIM ; ; Load the "NUMTIM" routine into the working library (e.g., BP2COM.OLB) ; so that it may be referenced when necessary. ; Also load this routine into the library. ; ; LBR LB:BP2COM/RP=NUMTIM,VAXDAT ; ; (BP2COM is just an example. You will need to MACRO it and store it in ; SYSLIB.OLB or SYSLIB.OBJ as necessary for other languages). ; ; They will be pulled by TKB or LINK when VAXDAT is referenced by the ; program. ; 48 .TITLE VAXDAT .IDENT /VO1.01/ .ENABL LC .ENABL GBL WORK: .WORD 0,0,0,0,0,0,0,0 ; ; Destroys R0 and R1 VAXDAT:: MOV 2(R5), R1 ; GET THE ARRAY POINTER (MUST BE 4 WORD ARRAY) MOV 2(R1),R1 MOV #WORK,R0 CALL $NUMTI MOV #WORK,R0 MOV (R0)+, @4(R5) MOV (R0)+, @6(R5) MOV (R0)+, @10(R5) RETURN .END 49 DTR> !!! WHY DOES DTR-11 PROMPT FOR FIELDS THAT COMPRISE A CONDITION DTR> !!! A PRINT STATEMENT IN REVERSE ORDER ??? DTR> DTR> READY YACHTS SHARED READ DTR> PRINT FIRST 10 YACHTS WITH BEAM=*.BEAM AND PRICE=*.PRICE ENTER PRICE: 0 ENTER BEAM: 12 LENGTH OVER MANUFACTURER MODEL RIG ALL WEIGHT BEAM PRICE BLOCK 1. 40 SLOOP 39 18,500 12 CABOT 36 SLOOP 36 15,000 12 DOWN EAST 38 SLOOP 38 19,500 12 ERICSON CRUISING/3 SLOOP 36 16,000 12 FISHER 37 KETCH 37 30,000 12 NAUTOR SWAN 41 SLOOP 41 17,750 12 PEARSON 39 SLOOP 39 17,000 12 DTR> CLOSE ANSWER - This is a "feature" of the language which we will have to live with. It is not a bug. 50 MILLSAPS COLLEGE Jackson, Mississippi 39210 Larry O. Horn System Manager Station A Millsaps College Jackson, MS 39210 Mr. Chuck Watson Batelle Pacific MW Laboratories P.O. Box 999 Richland, WA 99352 Dear Sir: We are relatively new users of Datatrieve, with no training except our own experimentation. We would appreciate any leads you can give us on optimizing DTR and exchanging information that can help us (such as through your newsletter). We would like to see our small colony of wombats mature and expand. Thank you for your attention. Sincerely, Larry O. Horn 51 SERVICIO DE PROCESAMIENTO DE DATOS SUBCYT-CONICET-SENOC PD PRODAT BUENOS AIRES November 12th., 1981. Mr. Chuck Watson Battelle Northwest Battelle Boulevard Richland, WA 99352 Dear Sir: I'm a new user of PDP 11/34 under RSTS/E and I've began to work with Datatrieve -11 this last month. I will appreciate very much any news you have about it. Cordially, Paulina Membership number: 152096 52 ACME ELECTRIC CORPORATION CUBA, NEW YORK 14727 716/968 2400 June 4, 1981 Mr. Chuck Watson Battelle Northwest Battelle Boulevard Richland, WA 99352 Dear Mr. Watson: Is there a method using Datatrieve-11 to create a new disk file made up of selected records from the original domain that Datatrieve acts upon. I realize we can write these records to a printer but we require a new disk file that Datatrieve can subsequently access to generate reports and additional files. If in fact Datatrieve cannot do this, as our DEC personnel claims, has anyone that you are aware of solved this problem by custom programming. Cordially yours, Dean E. Wildrick CAD Engineer DECUS NO. 138855 ae 53 John Guidi The Computing Center The Jackson Laboratory Bar Harbor, Maine 04609 (207) 288-3371 X275 Chuck; Rumors abound that the WOMBAT EXAMINER has been nominated for a Pulitzer Prize. Congratulations! Assuming that you are the Wish List Coordinator, I would like to make the following submissions: 1) Problem: DTR-11 does not accept match control constructs inside search strings used with the condition clause of the FIND rse command. Solution: Incorporate the amtch control constructs used by TECO-11 into DTR-11. Some of the useful constructs would be: ^X Accepts any characters ^N Accepts any character EXCEPT character matched by following charactes. ^EA Accepts any alphabetic character (A-Z,a-z). ^ED Accepts any digit (0-9). ^ER Accepts any alphanumeric (A-Z,0-9). ^EV Accepts any lowercase alphabetic (a-z). ^EW Accepts any uppercase alphabetic (A-Z). ^E[a,b,c...] Accepts exclusive OR of the characters or constructs specified. By using these constructs with the FIND rse command, the DTR-11 user can do fairly sophisticated free textual searches of Datatrieve domains. Example: DTR> FIND WORDS WITH NOUN CONTAINING "B^EAT" This command would be used to find a collection of words with the field NOUN containing BAT,BET,BIT,BTT,etc. Words with the field NOUN containing B2T,B#T,etc. would not be included in the collection. DTR> FIND WORDS WITH NOUN CONTAINING "B^E[L,R]T" This command would find only those words with NOUN containing BLT or BRT. 54 2) Problem: DTR-11 does not have the ability to selectively remove or add records to a collection. Often when a domain is used to generate a report, a collection of records is found (collection A). another collection of records is found (collection B), and then a composite collection is found which contains all those records in collections A and B (collection C). Then reports are generated for each of the 3 collections (collections A,B,C). Rather than having to find each collection from a domain, it would be useful to: a) find collections A and B, then join these collections to create collection C. -or- b) find collections B and C, then remove from collection C all those records common to collection B to create collection A. Solution: Incorporate the phrases UNION and INTERSECTION into the FIND rse command. Examples: 1) to do number 1 above: DTR> READY YACHTS; DTR> FIND A IN YACHTS WITH RIG="KETCH"; DTR> FIND B IN YACHTS WITH RIG="SLOOP"; DTR> FIND C IN A UNION B; 2) to do number 2 above DTR> READY YACHTS; DTR> FIND C IN YACHTS WITH RIG="KETCH","SLOOP"; DTR> FIND B IN YACHTS WITH RIG'"SLOOP"; DTR> FIND A IN C NOT INTERSECTION B; 3) Problem: There is no way to interrupt the processing of a Datatrieve command under the IAS operating system. Once a command is entered, DTR-11 executes that command until completion. Typing ^C under IAS causes the Datatrieve task to SUSPEND, whereupon the user can either ABORT, or CONTINUE the task. What is needed is a method to allow the unfortunate user who has mistakenly entered a command to gracefully interrupt Datatrieve's processing of that command. Solution: Incorporate a new control character as a command termination character. ^X would be a possibility. With DTR-11 still being in its infance, I think an active DTR-11 SIG could have a lot to say regarding the direction future releases of DTR-11 takes. The offer of assistance I made to you in New Orleans still stands. John 55 21 NOV 81 TO: SIG Newsletter Editors FROM: PDP 11 DECUS Library Program Evaluation Project SUBJECT: Publication of Report on Pilot Phase of PDP 11 DECUS Library Program Evaluation Project The pilot phase of the PDP 11 DECUS Library Program Evaluation Project has been completed with the evaluation of 20 programs. This report may of interest to potential users of these programs. Therefore, we request that the enclosed report be published in a future issue of your SIG Newsletter. An original copy is provided. The report is available upon request on WS78/81/211 single density diskette from Wilber R. Boykin, NASA Johnson Space Center/SE2, Houston, TX 77058, telephone (713)483-4211. Questions about the report should be directed to Wilber R. Boykin. Wilber R. Boykin, chairman, LSI-11 SIG Eric Morton, Librarian, RT-11 SIG John Runyon, Librarian, LSI-11 SIG 56 RESULTS OF PILOT PHASE OF PDP 11 DECUS LIBRARY PROGRAM EVALUATION PROJECT The pilot phase of the PDP 11 DECUS Library Program evaluation project has been completed. Twenty programs were evaluated and the results are tabulated herein for users. The project was a joint effort of the LSI-11 and TR-11 SIGs; the programs were evaluated by members of the two SIGs and others. To the persons who did the program evaluations which are summarized herein, we say a Texas size "Thanks." They did an excellent job and performed a very valuable service to the user community and to the DECUS Library. The data presented are in the following format. Program Number - Program Name. Key Words: Key words describing the program. Comments: Evaluator comments about the program. Op System: operating system, compiler/assembler, and version numbers used in program exvaluation. Date: Date of evaluation, month/year. The following questions are answered concerning each program. Pgm Worked? Y/N. Program Worked? Did the program work as advertised? F/P/N Checked? Fully (F), Partly (P), or Not(N) checked? Was the program fully, partly or not checked out and tested (e.g., program was for obsolete operating system or hardware/software required for program checkout not available, etc.)? Doc Compl? Y/N. Documentation complete? Was the program documentation complete and usable? R/A? Retain or Archive? Should the program be retained in the active program library or should it be archived? Archived programs are those which are non- functional or obsolete, but could still be ordered. Summary of Program Evaluation Results by Program Number 11-010 - PDP11 Basic Demonstration Package. Key Words: Basic, MU-Basic, Games, RT-11 Comments: Well known, simple games that have been around for some time. Easily modified. Op System: TR-11 V3B, Basic-11 V2. Date: 3/81 Pgm Worked: Y F/P/N Checked? F Doc Compl? Y R/A: R 11-071 - Accept. Key Words: Fortran, Input/Output. 57 Comments: Does not run under current Fortran products and duplicates features in those products. Op System: RT-11 V4.0, Fortran IV V2.5, Macro-11 V4.0 Date: 2/81 Pgm Worked: N F/P/N Checked: N Doc Compl? N R/A? A 11-072 - 3D Tic Tack Key Words: Demonstration, Game, Macro-11 Comments: Program did not run, conflict with RT-11 I/0 services. Program could be easily modified to use operating system I/O services. Op System: RT-11 V3B, Macro-11 V3. Date: 3/81 Pgm Worked? N F/P/N Checked? N Doc Compl? N R/A: R 11-162 - CHSSLV-Chess Solving Program. Key Words: Macro-11, RT-11, Chess. Comments: Documentation consists of clear, well done, profuse comments in source file. Dutch piece names used. Op System: RT-11 V3B, Macro-11 V3 Date: 8/80 Pgm Worked? Y F/P/N Checked? F Doc Compl? Y R/A: R 11-181 - Modification of RT-11 Terminal Handler. Key Words: RT-11, Driver, Handler, Macro-11. Comments: Forms control for LA-30. Operating system dependent, obsolete. Op System: RT-11 V3B, Macro-11 Date: 8/80 Pgm Worked? N F/P/N Checked? N Doc Compl? Y R/A: A 11-188 - Forms Control Simulation for DECwriters and Teletypes. Key Words: Utility, RT-11, Macro-11, Format. Comments: Program works ok. Op System: RT-11 V3B Macro-11 V3 OR V3B Date: 8/80 Pgm Worked? Y F/P/N Checked? F Doc Compl? Y R/A: R 11-221 - ODT-11T Key Words: Debug, RT-11, Simulator, Vector. Comments: Program contains CPU dependent instruction but works ok. Some commands don't 58 appear to work as expected, but this may be normal. Op System: RT-11 V3B Date: 9/80 Pgm Worked? Y F/P/N Checked? F Doc Compl? Y R/A: R 11-231A - Algol (RT-11). Key Words: Algol, Compiler. Comments: modified to run on RT-11 V3B or later. Poor documentation assumes knowledge of Burroughs B6700 Algol. Documentation updated. Op System: RT-11 V3 and V3B Date: 1/81 Pgm Worked? Y F/P/N Checked? F Doc Compl? Y R/A: R 11-231 - Alogol (RSX). Key Words: Worthles. Comments: Poor documentation assumes knowledge of Burroughs B6700 Algol. Would not task build under RSX-11M V3.1 OR V 3.2. Apparently for older operating system version. Obsolete. Op System: RSX-11M V3.1 or V3.2 Date: 1/81 Pgm Worked? N F/P/N Checked? N Doc Compl? N R/A: A 11-235 - Cycles.BAS. Key Words: Mu-Basic, RT-11. Comments: Documentation included in program. Modified to use memory resident table; increased run speed considerably. Improved prompting messages. Op System: RT-11 V3B, Basic-11 V2, Mu-Basic V1C Date: 11/80 Pgm Worked? Y F/P/N Checked? F Doc Compl? Y R/A: R 11-246 - PASCAL-11 Programming System. Key Words: Pascal, Compiler. Comments: Requires DOS Batch. does not compile standard PASCAL. Omsi PASCAL is better. Operating System not evaluated. Obsolete. Op System: N/A Date: 9/80 Pgm Worked? N F/P/N Checked? N Doc Compl? Y R/A: A 11-255 - Telep. 59 Key Words: Basic, Business, Utility Comments: Updated to run under Basic V2. Op system: RT-11 SJ V4.0, Basic-11 V2 Date: 8/80 Pgm Worked? Y F/P/N Checked? F Doc Compl? Y R/A? R 11-270A - FODT. Key Words: Fortran, RT-11, Debug. Comments: Program is for RSX-11D/M, writeup is for RSX/RT. Undefined symbols. Op system: RT-11 V4, Fortran IV V2.5, Macro-11 V4.0 Date: 2/81 Pgm Worked? N F/P/N Checked? N Doc Compl? Y R/A? R 11-294 - DAT BAS. Key Words: Basic, Digital-to-Analog, I/O, Utility. Comments: None Op system: RT-11 SJ V4.0, Basic-11 V2 Date: 8/80 Pgm Worked? Y F/P/N Checked? F Doc Compl? Y R/A? R 11-300 - Null Device Driver. Key Words: RT-11, Driver, Handler, I/O, Macro-11, Null. Comments: Operating system dependent (V2C). Obsolete. Op system: RT-11 V2C, Macro-11 V3 or V3B Date: 8/80 Pgm Worked? N F/P/N Checked? N Doc Compl? Y R/A? A 11-306 - DAT MAN. Key Words: Basic, Business, Calculate, Data Analysis, Matrix, Trigonomentry. Comments: Updated to run under Basic V2. Op system: RT-11 SJ V4.0, Basic-11 V2 Date: 8/80 Pgm Worked? Y F/P/N Checked? F Doc Compl? Y R/A? R 11-339 - MACSP. Key Words: Macro-11, Structured Programming. Comments: Documentation hard to read. Op system: RT-11 V4.0 60 Date: 2/81 Pgm Worked? Y F/P/N Checked? F Doc Compl? Y R/A? R 11-340 - Adventure (RT_11) Key Words: Adventure, Game, Fortran, RT-11. Comments: Popular Program. Op system: RT-11 V3, V3B, Fortran V2, V2.1 Date: 1/81 Pgm Worked? Y F/P/N Checked? F Doc Compl? Y R/A? R 11-340B - Advemture (RSX) Key Words: Adventure, Game, Fortran, RSX. Comments: Converted from 11-340 (RT_11 version) to run runder RSX-11M. Op system: RSX-11M V 3.1, 3.2, F4P V3.0 Date: 1/81 Pgm Worked? Y F/P/N Checked? F Doc Compl? Y R/A? R 11-346 - PASCAL Compiler (V5.01) Key Words: Pascal, Compiler. Comments: could not read under RSX-11M V 3.2. Program may be obsolete. Op system: RSX-11M V3.2 Date: 9/80 Pgm Worked? N F/P/N Checked? N Doc Compl? N R/A? A 61 SANTA FE ENGINEERING SERVICES COMPANY A Devision of Santa Fe International Corp April 30, 1981 Mr. Chuck Watson Battelle Pacific N.W. Laboratories P.O. Box 999 Richland, WA 99352 Dear Chuck: In the last issue of the Wombat Examiner you mentioned an interest in the use of the time field of date datatypes on VAX/VMS. To that end, I am enclosing a copy of the dictionary elements we use to peruse the BAX accounting log file. This file contains date/time information encoded in this way and it is most useful to be able to extract it for the calculation of elapsed times for processes and such. There is littel comment I can make which is not better explained by the procedures themselves. The essence is to define a slew of "computed-by" variables which reduce, by modulo division, the date value into hours, minutes, and seconds. These definitions are embedded in a procedure "ACC-GO" which is invoked when Datatrieve is started. I have included a small sample of a print format using these variables. However, if I may be so indulged, perhaps a couple of several observations can be made. One is that it would be most helpful if Datatrieve had a default "startup" procedure or command file which would be invoked automatically upon entry. I have seen numerous applicatons where this would be helpful, and it seems a simple thing to do. Second, it would seem that the VAX accounting file format was not terribly well thought out. This remark especially applies to its design vis-a-vis Datatrieve. Hexadecimal value encodings, counted strings and the like account for the occasional "filler" clauses in the record definition; suchvalues are essentially uninterpretable to Datatrieve. The use of a vertical encoding means that views are required to access the differing record types. I don't wish to dwell on the issue here, only to forewarn anyone thinking of making use of this particular shceme on VAX to investigate the limitations carefully. 62 Mr. Chuck Watson April 30, 1981 Page Two Still, it is surprising to me what can be achieved with only a modest investment of time and thought. Inclosing, let me say that we all enjoy the Examiner. Keep up the fine job. Best wishes, Steven G. Duff SGF/cmh Enclosures 63 DTR> SHOW ALL Domains: INT-LOGS INT-LOGS-MAIN Records: INT-LOG Procedures: ACC-GO PRINT-INT Tables: The current dictionary is _DRAO:[SYSMGR]ACC.DIC;1 No established collections No ready domains DTR> DTR> SHOW INT-LOGS-MAIN DOMAIN INT-LOGS-MAIN USING INT-LOG ON SYS$MANAGER:ACCOUNTING.OLD ; DTR> SHOW INT-LOGS DOMAIN INT-LOGS OF INT-LOGS-MAIN USING 01 INT-LOG-REC OCCURS FOR INT-LOGS-MAIN WITH MSG-TYPE BETWEEN 1 AND 3 AND ACCOUNT NE "" 10 INT-LOG FROM INT-LOGS-MAIN . ; DTR> SHOW INT-LOG RECORD INT-LOG USING 01 INT-LOG . 10 MSG-TYPE PIC 99 USAGE IS COMP EDIT-STRING IS Z9 10 FILLER PIC XX . 10 FINAL-STAT PIC 9(9) USAGE IS COMP EDIT-STRING IS Z(8)9 . 10 FILLER PIC XXXX . 10 JOB-ID PIC 9(9) USAGE IS COMP EDIT-STRING IS ZZZ9 . 10 TERM-CLUNKS USAGE IS DATE EDIT-STRING IS DD-MMM-YY . 10 ACCOUNT PIC X(B) . 10 USERNAME PIC X(12) . 10 CPU-TIME PIC 9(9) USAGE IS COMP EDIT STRING IS Z(8)9 . 10 PAGE-FAULTS PIC 9(9) USAGE IS COMP EDIT-STRING IS Z(6)9 . 10 PGFL-PEAK PIC 9(9) USAGE IS COMP EDIT-STRING IS ZZZZ9 . 10 WS-PEAK PIC 9(9) USAGE IS COMP EDIT-STRING IS ZZZ9 . 10 BIO-COUNT PIC 9(9) USAGE IS COMP EDIT-STRING IS Z(7)9 . 10 DIO-COUNT PIC 9(9) USAGE IS COMP EDIT-STRING IS Z(7)9 . 10 VOL-MOUNT PIC 9(9) USAGE IS COMP EDIT-STRING IS Z9 . 10 LOGIN-CLUNKS USAGE IS DATE . 10 FILLER PIC XXXX . 10 JOB-NAME PIC X(8) . 10 FILLER PIC X(20) . ; DTR> SHOW ACC-GO PROCEDURE ACC-GO READY INT-LOGS DECLARE ONEDAY USAGE IS DATE. 64 ONEDAY = "18-NOV-1858" DECLARE TERM-CLOCK COMPUTED BY ((TERM-CLUNKS+0)-ONEDAY* DECLARE TERM-CLUNKS/ONEDAY)+5000000)/10000000 . DECLARE TERM-HOUR COMPUTED BY TERM-CLOCK/3600 EDIT-STRING IS Z9 . DECLARE TERM-MIN COMPUTED BY (TERM-CLOCK/60) - 60* (TERM-CLOCK/3600) EDIT-STRING IS 99 . DECLARE TERM-SEC COMPUTED BY TERM-CLOCK - 60* (TERM-CLOCK/60) EDIT-STRING IS 99 . DECLARE LOGIN-CLOCK COMPUTED BY ((LOGIN-CLUNKS+0)-ONEDAY* (LOGIN-CLUNKS/ONEDAY)+5000000)/10000000 . DECLARE LOGIN-HOUR COMPUTED BY LOGIN-CLOCK/3600 EDIT-STRING IS Z9 . DECLARE LOGIN-MIN COMPUTED BY (LOGIN-CLOCK/60) - 60* (LOGIN-CLOCK/3600) EDIT-STRING IS 99 . DECLARE LOGIN-SEC COMPUTED BY LOGIN-CLOCK - 60* (LOGIN-CLOCK/60) EDIT-STRING IS 99 . DECLARE ELAP-CLOCK COMPUTED BY TERM-CLOCK - LOGIN-CLOCK . DECLARE ELAP-HOUR COMPUTED BY ELAP-CLOCK/3600 EDIT-STRING IS Z9 . DECLARE ELAP-MIN COMPUTED BY (ELAP-CLOCK/60) - 60* (ELAP-CLOCK/3600) EDIT-STRING IS 99 . DECLARE ELAP-SEC COMPUTED BY ELAP-CLOCK - 60* (ELAP-CLOCK/60) EDIT-STRING IS 99 . END-PROCEDURE DTR> SHOW PRINT-INT PROCEDURE PRINT-INT PRINT COL 1, USERNAME ("USERNAME"/"JOB NAME"), COL 14, ACCOUNT , COL 24, LOGIN-CLUNKS ("LOGIN"/"LOGOUT") USING DD-MMM-YY , COL 34, LOGIN-HOUR (" "), COL 36, ":", COL 37, LOGIN-MIN (" "), COL 40, CPU-TIME/100.0 ("CPU SECS"/"ELAP. SECS") USING Z(7)9.9 , COL 50, PAGE-GAULTS ("FAULTS"/"PGFL PK") USING ZZZZZZZ9 , COL 60, WS-PEAK ("WSPK"/"VOLS") USING ZZZZ9 , COL 66, BIO-COUNT ("BUFF I/O"/"DIR. I/O") USING Z(8)9 , SKIP, COL 3, JOB-NAME , COL 24, TERM-CLUNKS ("LOGOUT") USING DD-MMM-YY , COL 34, TERM-HOUR (" "), COL 36, ":", COL 37, TERM-MIN (" "), COL 40, ELAP-HOUR (" ") USING 79, COL 42, ":" , COL 43, ELAP-MIN (" ") USING 99 , COL 45, ":" , COL 46, ELAP-SEC (" ") USING 99 , COL 50, PGFL-PEAK USING ZZZZZZZZ , COL 60, VOL-MOUNT USING ZZZZZ , COL 66, DIO-COUNT USING Z(8)Z END-PROCEDURE DTR> DTR> :ACC-GO DTR> :PRINT-INT OF FIRST 5 INT-LOGS SORTED BY TERM-CLUNKS 65 USERNAME LOGIN CPU SECS PGFL WKS PK BUFF I/O JOB NAME ACCOUNT ELAP SECS PEAK VOLS DIR. I/O SYSTEM 6194.00 10-APR-81 9:31 13.4 902 146 257 10-APR-81 9:35 0:04:27 48 ADAMS 6194.00 10-APR-81 8:19 13.8 1464 170 1560 10-APR-81 9:49 1:29:49 86 BUCKLEY 3111.00 10-APR-81 9:46 8.2 394 212 1218 10-APR-81 10:01 0:14:39 851 DUFF 6194.00 10-APR-81 10:01 1.4 299 112 86 10-APR-81 10:01 0:00:17 22 SYSTEM 6194.00 10-APR-81 10:32 0.3 63 62 36 10-APR-81 10:38 0:06:28 15 66 TO: FMS Users, present and prospective FROM: Judy Kessler DATE: 9 June 1981 SUBJECT: Questionaire response *************************************************** I am enclosing a pre-publication copy of an article submitted to the DMS Sig newsletter. We haven't yet set up a computerized data base, so as yet, our best means of communications is via the sig newsletter. If you do not yet belong to the sig, please join. Write to: DECUS One Iron Way, MR2-3/E55 Marlboro, Mass. 01752 and ask them to send you a form to join the DMS sig. (or use the one enclosed) See you in LA. Judy 67 *** FMS WORKING GROUP SURVEY *** Judy Kessler, Chairman During the Miami DECUS '81, we distributed survey forms to current and prospective FMS users. Our goal is to promote active interchange of knowledge in this (relatively) new product area. Here are some of the responses: Special Interest Areas: 1. Process control front end 2. Menu picking. 3. Real time system status display. 4. shared libraries and commons. 5. Accounting applications. 6. On line inquiry. 7. Transaction entry. 8. General purpose transaction package (menu driven) which performs data converstion, range checking, special validations. 9. Help forms (reference guide on-line). 10. CAI (Computer Aided Instruction). 11. Manufacturing data entry. 12. Realtime pipeline control. 13. Display generation and update. 14. Double height/double width display. 15. Banking applications MIS data entry, report writer. 16. Data entry for Datatrieve. 17. Samples of add, delete and change programs. 18. Placing FMS on a distributed processor to offload host laboratory data entry and display. Specific Questions: 1. How can I modify video attributes of a field in a displayed form at run time? 2. Does anyone have an FMS-11 front end to OMSI PASCAL? 3. When will FMS-RSTS be released? 4. How easily doe FMS move from PDP-11's to VAX's? Vice-Versa? 5. Are many commercial users using FMS for their financial applications? 6. If I use FMS, will I have an overhead problem in also using RMS? 7. How can we improve swapping time (RSX-11,IAS)? 8. Does anyone else have problems fitting FMS and/or RMS and a user program in 32K? If so, how were they solved? Please send your questions, comments and answers to: Judy Kessler Retina Foundation 20 Staniford Street Boston, Mass. 02114 I would like to take this opportunity to DENY that I am now, or ever have been, the chairman of the Retina Foundation !!! 68 A STRUCTURED ANALYSIS OF A BLIND REHABILITATION EVALUATION DATABASE USING DATATRIEVE By Michael Goldfield and Ross W. Lambert, Jr., M.D. REHABILITATIVE ENGINEERING RESEARCH AND DEVELOPMENT CENTER Hines VA Hospital Hines, Illinois for the 1981 Spring DECUS U.S. Symposium Miami Beach, Florida May 18-21, 1981 69 1.0 INTRODUCTION For many centuries, most clinical medical practice has been based on rules of thumb, and in more modern times on experimental laboratory data. Until recently, there has been little scientific evaluation of the effectiveness of clinical practice. This is especially true in the evaluation of the effectiveness of rehabilitation programs for the physically disabled. It is only now with the development of database systems and the ability of computers both to perform large numbers of statistical calculations and to compare quickly large databases that the rigorous scientific evaluation of rehabilitation programs as begun. What holds for rehabilitation in general, holds even more so for the evaluation of blind rehabilitaion. Although there are large numbers of blind rehabilitation programs serving the more than one-half million blind people in this country, there has been to date no careful evaluaton of the effectiveness of any of these programs. The first such study is now being undertaken by the Rehabilitative Engineering Research and Development Center (RER and D) of the Hines Veterans Administration Hospital (VAH). Investigators here have developed a complex set of variables and measurement techniques for this purpose. An initial database is being set up to store and organize the records for this evaluation. The records are entered into various files set up on a DEC PDP-11/70 computer usine DATATRIEVE. 1.1 OBJECTIVES The Blind Rehabilitation Database using DATATRIEVE is a preliminary system. The objectives for this initial phase are the following: 1. Information must be stored about persons participating in blind rehabilitation at the Blind Rehabilatation Center (BRC) at Hines VAH. 2. Data Entry must be done under program control that insures a high degree of data integrity. 3. The records must be in an easily accessible and modifiable form. 70 4. The records must be in a secure form, only readable by those who need to see them, only changeable by those who need to change them. Most of the information, being patient records, must be kept highly confidential. 5. Since much of the work is experimental, the system must have a large variety of retrieval features. These features must be easily changed; the addition of new variables (either composite or primitive) must be simply accomplished. 6. The retrievals have to be easy enough to be done with facility by investigators with minimal programming skills. Given the experimental nature of the research criteria, it is important that the retrievals be both interactive and easily altered without extensive changing of hard code. 7. Timely reports must be produced. 8. The records must be easily convertible to a more developed database system in the future. In our case, the plan is to convert eventually to DBMS. 1.2 DATA PROCESSING EQUIPMENT The RER and D Center has a DEC PDP-11/70 computer on which the Blind Rehabilitation Database is run. The system currently has one magabyte of memory, an RP06 diskdrive, a magtape drive, a card reader, and numerous smaller on-line storage devices. 71 2.0 GATHERING THE DATA 2.1 THE FLOW OF THE DATA The process of gatherint the data may be traced by following the data flow diagrams. Diagram 0 is the top level diagram. Each of the other diagrams 1,2 and 3/4 represent the expansion of 1 process bubble respectively in Diagram 0. The physical process is charted in Diagram 0 of the physical flow diagram. 2.2 THE FILES 2.2.1 THE LIFESTATE FILES - Lengthy interviews are conducted with the trainees at 4 points in time: t1, before the rehabilitation process has begun; t2, durint the rehabilitation process; t3, 6 months after the end of training; and, t4, 12 months after. The information from these interviews is placed in the lifestate files. A major goal of the evaluation process will be to examine changes in lifestate before and after the rehabilitation process. A positive change, after all, is the purpose of the process, and is the ultimate measure of the effectiveness of the BRC training. The lifestate files are organized hierarchically. These files each have seven main levels, each of which contains numerous subclassifications. The main levels are: A. Self Care B. Travel Independence C. Communications D. Home Care E. Financial Self=sufficiency F. Psychological Resources G. Self-Perception These categories are chosen because they form the elements of 72 the quality of life which the training program seeks to positively effect. 2.2.2 Personal Psycholgical Resources File - The personal psychological resources file is formed via information on the lifestate file at t1. It is created with a DATATRIEVE VIEW which subsets this information. 2.2.3 Social Resources File - The Social Resources File (SRF - or Family Data File) exists at 3 separate time points t1, t3, and t4. The SRF reflects the attitudes towards blindness and blind rehabilitation of members of the immediate family (particularly the spouse). This file will play a useful role in determining the effect of family attitudes on the success of the blind rehabilitation process. 2.2.4 Demographic File - The information for the demographic file is gathered at t1. It is a hierarchical file which includes information about personal data, employment, income, education, housing, age, racial and ethnic characteristics, etc. 2.2.5 Health File - The health information is gathered at time t2. It is set up in a hierarchical file which is actualy made up of 3 subfiles: A. Medical History B. Results of a general Medical Exam C. Results of an ophthalmologic exam These three subfiles are broken down separately via the DATATRIEVE VIEWS. 73 3.0 OVERVIEW OF THE BLIND REHABILITATION DATABASE. 3.1 GENERAL FUNCTIONS At present there are five general functions for the database, which are presented to the user in the first screen, shown below: Hello, You are now using the BLIND REHABILITATION DATABASE Choose 1 number from the following menu: "1" for Data Entry "2" for Record Modification "3" for Patient Inquiry "4" for General Statistics "5" for Reports Number: Upon selecting an option the operator is given screens which prompt for additional iformation to complete the preparation for funning the procedure. In most cases the first thing requested is the file name. 3.2 DATA ENTRY The first prompt is to Enter Filename(or hit ESC for HELP): 74 Hitting ESC gives a list of the possible files, then re-issues the command. The system then will prompt for the password to insure that the operator has the proper authorization for the function to be performed on the file. Entry takes place via the STORE command. Data integrity is maximized using both the DATATRIEVE edit patterns and table lookups where appropriate. some prompts are self-explanatory. Others, e.g, those that require a yes or no answer will have the possible answers in parentheses, e.g., ("y" or "n"). For all non-self-explanatory prompts, there are HELP files. currently being developed is a system by chich data will be automatically entered into the database from the coded questionaires. Our questionaires are designed to be read by a Chatsworth 4400 Optical Mark Sense Reader. This work is currently in the development phase, but will eventually replace the bulk of the manual data entry. 3.3 MODIFICATION Modification may take place by indentifying the record uniquely (usually by patient number or by specifying a group of records with a particular set of characteristics. When a group of records is specified, they may be modified globally or one at a time via the DATATRIEVE SELECT statement. 3.4 DISPLAY OF INFORMATION Information may be displayed at present by individual patient (identifiable by patient number ) or by several other keyed categories. 3.5 GENERAL STATISTICS The system will report totals and means for an assortment of variables. 75 3.6 REPORTS Several standard reports are generated. 3.7 ADDITIONAL FEATURES Many additional features and functions may be easily added. None of the standardized functions, however, in any way prohibits the operator from entering DATATRIEVE outside of program control. Such entry is most useful for special reports, complex retrievals, and the running of non-standard statistics. Since the current database is the only one of its kind, there will undoubtedly be many requests for additional types of retrievals, statistics and reports. In particular, the requirements of investigators at the BRC and at other locations will insure this. It is planned that extra features reflecting these needs will be added in the future. 76 BLIND REHABILITATION MAY 11, 1981 ----------------------------------------------------------------------------- REHABILITATIVE ENGINEERING, RESEARCH & DEVELOPMENT CENTER MICHAEL GOLDFIELD ----------------------------------------------------------------------------- LOGICAL DATA FLOW DIAGRAM O :----------: :----------: :----------: :----------: : TRAINEE : : TRAINEE : : TRAINEE : : TRAINEE : : T1 : : T2 : : T3 : : T4 : :----------: :----------: :----------: :----------: : : : : : TRAINEE- : TRAINEE- : TRAINEE- : TRAINEE : T1 DATA : T2 DATA : T3 DATA : T4 DATA : : : : V V V V :---------: :---------: :---------: :---------: : GATHER- : : GATHER- : : GATHER- : : GATHER- : .-->: T1-DATA : : T2-DATA : : T3-DATA : : T4-DATA : : : 1.0 :--. : 2.0 : : 3.0 : : 4.0 : : :---------: : :---------: :---------: :---------: : : : : : : ^ /\ ^ /\ FAM T1 : : : HEALTH : : / \ : / \ DATA : : : DATA : FAM : \ : : \ : : DEMO : : : T3 : : FAM : : : : DATA : : : : : : T4 : : : : : : : T2 LIFE : : : DATA V : : FAM : : V STATE : : : : ------ : : DATA : : _________ : : FAM : : T4 FAM : : : V : HEALTH- : : DATA : : DB FILE : : : -------- : DB FILE : : : : : : : : DEMO DB : : : : T1 LIFE : : : : FILE : : : : STATE : V : : : V : : : : ---------- : : T1 LIFESTATE ------------ : : V : T4 LIFE : : DATA T2 LIFESTATE : : -------- : STATE : V : DB FILE : : T3 LIFE : DB FILE : --------- : : : STATE : : T1 FAM DB : : : : : FILE V : V : : -------------- : ----------- : : T1 LIFESTATE : T3 FAM DB : : DB FILE : FILE : : : : : INPUT : : : : : :----------: :------------: :-----------: : FAMILY : : FAMILY : : FAMILY : : T1 : : T3 : : T4 : :__________: :____________: :___________: key: DB=DATA BASE FAM= FAMILY Tn=TIME n DEMO=DEMOGRAPHIC 77 BLIND REHABILITATION MAY 11, 1981 ----------------------------------------------------------------------------- REHABILITATIVE ENGINEERING, RESEARCH & DEVELOPMENT CENTER MICHAEL GOLDFIELD ----------------------------------------------------------------------------- LOGICAL DATA FLOW DIAGRAM 1.0 :--------: :--------: : GATHER t1 DATA : 1.5 : : : : t1 : GATHER : CODED : RECORD : INDEXED : LIFE /: LIFE : LIFESTATE : LIFE : LIFESTATE : STATE / : STATE :----------->: STATE :----------->: DB / : DATA : DATA : DATA : DATA : FILE / :--------: :--------: : / LIFESTATE DATA / / :-----------: : : : TRAINEE : : : :-----------: \ \ TRAINEE DEMO DATA \ \ \ :--------: :--------: : \ : 1.3 : : 1.4 : : \: GATHER : COMBINED : RECORD : INDEXED : /: DEMO : DEMO : DEMO : DEMO : DEMO / : DATA :---------->: DATA :----------->: DB / : : DATA : : DATA : FILE / :--------: :--------: / FAM DEMO DATA / / / :-----------: :--------: :--------: : : : : 1.1 : : 1.2 : : : FAMILY : FAM : GATHER : CODED : RECORD : INDEX : FAMILY : :------>: FAM :------->: FAM :----------->: DB : : DATA : DATA : FAM : DATA : FAM DATA : FILE :-----------: :--------: DATA :--------: : KEY: DEMO=DEMOGRAPHIC 78 BLIND REHABILITATION MAY 11, 1981 ----------------------------------------------------------------------------- REHABILITATIVE ENGINEERING, RESEARCH & DEVELOPMENT CENTER MICHAEL GOLDFIELD ----------------------------------------------------------------------------- LOGICAL DATA FLOW DIAGRAM 2.0 GATHER t2 DATA :-----------: :-----------: : 2.6 : CODED : 2.7 : : t2 : GATHER : LIFESTATE : RECORD : : LIFE .------------------>: LIFESTATE :---------->: LIFESTATE :--->: STATE : : DATA : DATA : DATA : : DB : :-----------: :___________: : FILE : : : :-----------: : : 2.3 : : : GATHER : : : GENERAL : : 7: DATA : : / :-----------:\ : / \ : / \ : / \ : GEN EXAM DATA \ : / CODED GEN DATA : / \ : / \ :------------: / \ : :/ \ : TRAINEE : :-----------: :----------: :--------: : : OPH : 2.2 : : 2.4 : : 2.5 : : :-------->: GATHER : CODED : COMBINE : COMBINED : RECORD : :------------: DATA : OPTHAL :------->: HEALTH :--------->: HEALTH : \ : MOLOGIC : OPH : DATA : HEALTH : DATA : \ : DATA : DATA :----------: DATA :--------: \ :-----------: / : \ / : HISTORICAL DATA CODED HISTORICAL : \ DATA : \ / : \ / : \ / : \ :-------------: / : \ : 2.1 : / V \: GATHER : / ------------- HEALTH : HISTORICAL : / HEALTH -------------------->: HEALTH :/ DB FILE RECORDS : DATA : :-------------: KEY: OPH = OPHTHALMOLOGIC DB = DATA BASE 79 BLIND REHABILITATION MAY 11, 1981 ----------------------------------------------------------------------------- REHABILITATIVE ENGINEERING, RESEARCH & DEVELOPMENT CENTER MICHAEL GOLDFIELD ----------------------------------------------------------------------------- LOGICAL DATA FLOW DIAGRAM 3.0 & 4.0 :-----------: :-----------: : : : : : TRAINEE : : TRAINEE : : : : : :-----------: :-----------: : : : : LIFESTATE FAMILY DATA DATA : : V V :----------- : :-----------: : 3.3 : : 3.1 : : GATHER : : GATHER : : LIFESTATE : : FAMILY : : DATA : : DATA : :------------: :-----------: : : : : CODED CODED LIFESTATE FAMILY DATA DATA : : V V :------------: :------------: : 3.4 : : 3.2 : : RECORD : : RECORD : : LIFESTATE : : FAMILY : : DATA : : DATA : :------------: :------------: : : : : INDEXED INDEXED LIFESTATE FAMILY DATA DATA : : V V ------------------ ------------------ t3 (OR t4) t3 (OR t4) LIFESTATE DB FILE FAMILY DB FILE KEY: DB = DATABASE 80 BLIND REHABILITATION MAY 11, 1981 REHABILITATIVE ENGINEERING, RESEARCH & DEVELOPMENT CENTER MICHAEL GOLDFIELD ----------------------------------------------------------------------------- PHYSICAL DATA FLOW DIAGRAM DIAGRAM O :-----------: : ENROLL : 1 : TRAINEE : :___________: t PATIENT AT HOME : i ---------------------------------------------------- m t1 : : : e : : : V 2 V 3 V 4 : :-------------: :-------------: :-------------: : : LIFESTATE : : FAMILY : : DEMOGR : : : INTERVIEW : : INTERVIEW : : INTERVIEW : : :-------------: :-------------: :-------------: : \ / : \ / : \ / : BEGIN TRAINING REHABILITATION--------------------------------------- : \ / : \ 5 / : \ :-------------: / : \ : BEGIN : / : \--->: REHABIL- :<----/ : : ITATION : V :-------------: : V 6 PATIENT AT :-------------: BLIND : HEALTH : REHABILITATION : EXAMINES : CENTER :-------------: : V 7 t2 :-------------: : LIFESTATE : : INTERVIEW : :-------------: : V 8 :-------------: : COMPLETE : : TRAINING : :-------------: ^ / \ / \ END REHABILITATION ----------------------------------------- / \ t3/t4 9 / \ 10 :-----------: :-----------: : LIFESTATE : : HOME : PATIENT : INTERVIEW : : FAMILY : AT HOME :-----------: : INTERVIEW : :-----------: 81 DATATRIEVE LIBRARY This last year, several of the SIG members have expressed an interest in starting a DATATRIEVE library. Contributions may include DTR techniques, suggestions, applications, papers, or anything which may be of intesest to anyone else. In the past such things have been published in the newsletter. There is now getting to be enough material that some sort of organization is needed. We also would like to verify that items submitted do work beforethey are piblished. Joan Hilton has volunteered to coordinate the library, but she will need some help doing the testing and verification. We will continue to publish new contributions in the newsletter as well as a list of all contributions through Joan. Since we have not finished compiling all the material from previous issues, this issue does not contain a list of contributions. But by the next issue wehope to have something for you. So if you have any applications, problem work-arounds, how-to's, etc., that you would like to share with the rest of us please send them to Joan Hilton DATATRIEVE Library Coordinator c/o DECUS, One Iron Way MR 2-3/E55 Marlboro, MA 17562 As for newsletter contributions, camera ready copy is appreciated, but almost anything legible and reproducible will be accepted. Please include your name, company, operating system and DTR version, if applicable, along with a description. Examples are also helpful for the reader's understanding. Also, anyone interested in assisting Joan, please contact her. 82 COMMAND FILE TO CREATE A NEW QUERY.DIC by Bart Lederman The following command file [1,2]QUERY.CMD, is used with the RMS DEF utility to create a new QUERY.DIC file. In our system, Datatrieve has been built to start up with a dictionary named QUERY.DIC in the users UIC, rather than a system wide dictionary (this is a QD.MAC option). If, however, a new user is added to the system, Datatrieve will not run until there is a dictionary in that UIC: also, to protect users files, users cannot write to other UICs, and generally one would not want to PIP a dictionary to another user and thus reveal all of the files and record definitions. In addition, it is helpful to have a method of generating a new dicitionary should one be accidentally corrupted or deleted. To use the command file one simpley enters the command DEF Q[1,2]QUERY (we story the command in [1,2] so everyone can access it). The first line gives only the name QUERY.DIC, so it will automatically be created in the UIC of the person issueing the command. The string definitions were derived by using the RMS DSP utility on an existing dictionary created by Datatrieve. The allocation is 200 blocks (the same as Datatrieve), and the file protection shown is that used on our system: this is RWED for system and owner, R only for other members of the same group, and no access for the world. One parculiar aspect is that if the dictionary created by this procedure is examined by the RMS DSP utility, the listing is not exactly the same as a Datatrieve created dictionary, even though the information entered in the DEF utility appears to be the same. However, Datatrieve and the dictionary compress utility both operate without any sign of trouble on these new dictionaries, so apparently the differences, if any, are insignificant. It may be noted that a bucket size of 2 is used in the dictionary, and some people may wish to try to reduce this to 1 to free pool in Datatrieve. The DEF utility will tell you that for the required record size, a bucket size of 1 is inadequate. 83 RSX-11M BL26 MULTI-USER SYSTEM GOOD MORNING 11-JUN-81 08:16 LOGGED ON TERMINAL TT6: Welcome to RSX-11M V3.1 timesharing on the Records and Development System The System is presently reserved for participating Engineering Department personnel only. >pip ti:=[1.2]query.end _________________________________________________________________ ;THE FIRST QUESTION ASKS FOR THE FILE SPECIFICATION. QUERY.DIC NO ;THE NEXT QUESTIONS DEAL WITH FILE ORGANIZATION & RECORD ATTRIBUTES IDX FIX 512 NO NO ;THE FOLLOWING QUESTIONS DEAL WITH KEYS STR (30),(0) (2),(30) YES YES STR 0 31 NO NO ;THE NEXT QUESTIONS DEAL WITH ALLOCATION AND PLACEMENT ATTRIBUTES NO NO 200 2 0 NO ;THE NEXT QUESTIONS ASK ABOUT FILL SIZES FOR KEYS ;THE FOLLOWING QUESTIONS DEAL WITH FILE PROTECTION R NONE __________________________________________________________________--- > 84 PROMPTING FOR A DOMAIN NAME USING A COMMAND FILE by Bart Lederman We have application where there are 3 domains with the same record definition, named MTLF4-SEQ, MTLF5-SEQ, and MTLF6-SEQ. It was desired to create the same reports from each of these files, using a procedure, and to make the procedure as simple (for the user) as possible. Apparently, Datatrieve does not allow prompting for a domain name or use of an assigned variable as a domain name, which meant that three procedures would have to have been created for each report, one for each domain, or a procedure which had all reports for all domains in it and could select the proper procedure in response to a user prompt would have to be written. I solved the problem outside of Datatrieve by using the Indirect Command File Processor (IND). IND is capable of asking questions, making decisions based on answers, can do loops and subroutines, write out data to another file, and other functions. The command file MTLF2.CMD shows how IND will prompt for the trunk switch number: it then creates a command file MTFSR.CMD which contains Datatrieve instructions into which IND has inserted the domain name, report file name, and report title with the proper switch number. It then invokes Datatrive with this newly created command file, and when Datatrieve is done, it purges out the old report, as can be seen in the lower half of the example. This approach results in a procedure which is very simple for the users. It also expands the range of Datatrieve, as it allows the command file to be as long and complicated as necessary to solve a particular problem without using extra pool in , and IND has several features not found in Datatrieve. Also, in RSX-11M version 3.2, a command file such as this can be named LOGIN.CMD, in which case it will be entered automatically whenever a user logs on the UIC. This can be used where it is desired for persons to use Datatrieve without having to know any RSX-11M or Datatrieve commands other than how to log onto the system: the command file will do the rest. The one possible drawback to this approach is that IND must be running (in mamory) while the command file is being processed, but it should be checkpointable while it is waiting for Datatrieve to finish. 85 >PIP TI:=MTLF2.CMD ; ; COMMAND FILE TO CREATE TRUNK LIST PART TWO ; (SORTED BY TRUNK) ; .ENABLE SUBSTITUTION .SETS SW "0" ; DEFAULT SWITCH SETTING .SETS DOM1 "MTLF" ; FIRST PART OF DOMAIN NAME .SETS DOM3 "-SEQ" ; LAST PART OF DOMAIN NAME .SETS RPT "REPORT2.TS" ; REPORT FILE NAME .ASKS SW TRUNK SWITCH <-------ASK FOR THE TRUNK SWITCH NUMBER .IF SW LT "4" .GOTO 999 ; REJECT IF ANSWER IS NOT .IF SW OT "6" .GOTO 999 ; A REAL SWITCH .OPEN MTFSR.CMD <--WRITE OUT THE FOLLOWING DATATRIEVE COMMANDS .ENABLE DATA INTO A FILE FOR LATER USE READY 'DOM1''SW''DOM3' REPORT 'DOM1''SW''DOM3'' WITH GROUP NE 999 SORTED BY TRUNK OR '1 PT''SW' SET REPORT-NAME = "TRUNK SWITCH 'SW'"/"SORTED BY TRUNK" PRINT MTLF-SEQ AT BOTTOM OF REPORT PRINT SKIP, COL 10, "TRUNKS ON SWITCH =", SPACE 3, COUNT END-REPORT .DISABLE DATA .CLOSE ; END OF DATATRIEVE COMMAND FILE DTR CMTFSR <--INVOKE DATATRIEVE WITH THE NEWLY CREATED COMMAND FILE. PIP 'PPT''SW',MTFSR.CMD/PU <--PURGE THE OLD FILE .999: ; ALL DONE / > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > >0MTLF2 >; >; COMMAND FILE TO CREATE TRUNK LIST PART TWO >; (SORTED BY TRUNK) >; >* TRUNK SWITCH [S]: 6 >DTR CMTFSR READY MTLF6-SEQ REPORT MTLF6-SEQ WITH GROUP MK 999 SORTED BY TRUNK ON REPORT2.TS6 SET REPORT-NAME = "TRUNK SWITCH 6"/"SORTED BY TRUNK" PRINT MTLF-SEQ AT BOTTOM OF REPORT PRINT SKIP, COL 10, "TRUNKS OF SWITCH =", SPACE 3, COUNT END-REPORT >PIT REPORT2.TS6,MTFSR.CMD/PU >; ALL DONE >/ >C > 86 STORING RECORD INTO DOMAINS WITH VARIABLE OCCURS by Joan Hilton and Jean Lemmon The simplest way to store into a domain with a variable occurs is to say STORE DOMAIN and let Datatrieve handle everything. This works well; if a field occurs twice, it will prompt you for two sets of the variable data and if it occurs 6 times, it will prompt you for six sets. However, if you want to control the prompting in your store procedure (lperhaps you only want to ask for certain fields, for example), it becomes more complicated. This is primarily because you cannot refer to those "variably occuring" fields individually - they can only be referenced as a group, or a list. There are at least two ways around this problem. One way uses a temporary file during the store procedure and the second way uses a REDEFINES on the variable occurs. In both examples I will use an abbreviated version of the Emp domain as an example. The record definition is the following: RECORD EMPR USING 01 EMP=REC. 03 EMP=ID PIC 9(2). 03 SS-NO PIC 9(9) EDIT-STRING IS XXX-XX-XXXX. 03 ED-NO PIC 9 VALID IF ED-NO BETWEEN 0 AND 3. 03 EDUCATION OCCURS 0 TO 3 TIMES DEPENDING ON ED-NO. 06 DEGREE PIC X(5). 06 INSTITUTION PIC X(20). 06 YEAR PIC 9(4). 87 STORING USING A TEMPORARY FILE You must first create a file which duplicates the EDUCATION portion of the EMP domain. It would look like this: DOMAIN EDTEMP USING EDTEMPR ON EDTEMP.DAT;1; RECORD EDTEMPR USING 01 EDUCATION. 03 DEGREE PIC X(5). 03 INSTITUTION PIC X(20). 03 YEAR PIC 9(4). The store procedure uses the context variable A to name the record stream as follows: PROCEDURE EMP-STORE ! Define a new, empty EDTEMP file DEFINE FILE EDTEMP KEY=YEAR((DUP, NO CHANGE), SUPERSEDE; READY EMP WRITE READY EDTEMP WRITE ! Ask how many records to store and start the loop REPEAT *."NUMBER OF RECORDS TO STORE" ! The "store A in ..." allows you to reference the newly ! entered data as A.field-name later on STORE A IN EMP USING BEGIN EMP-ID=*."EMPLOYEE ID" SS-NO=*."SOCIAL SECURITY NUMBER" ED-NO=*."NUMBER OF DEGREES" ! Use the ed-no just entered to control how many records are ! stored in the edtemp file REPEAT A.ED-NO STORE EDTEMP USING BEGIN DEGREE=*.DEGREE INSTITUTION=*.INSTITUTION YEAR=*.YEAR END ! Copy the records in the edtemp file to the education ! portion of the main file (emp) EDUCATION=EDTEMP ! Clean out edtemp for the next pass through ERASE ALL OF EDTEMP END FINISH END-PROCEDURE 88 STORING USING A REDEFINES CLAUSE IN THE RECORD DEFINITION The other possibility which gives you control over prompting is to redefine the variable occurs field as follows: RECORD EMPR USING 01 EMP-REC. 03 EMP-ID PIC 9(2). 03 SS-NO PIC 9(9) EDIT-STRING IS XXX-XX-XXXX. 03 ED-NO PIC 9 VALID IF ED-NO BETWEEN 0 AND 3. 03 EDUCATION OCCURS 0 TO 3 TIMES DEPENDING ON ED-NO. 06 DEGREE PIC X(5). 06 INSTITUTION PIC X(20). 06 YEAR PIC 9(4). 03 EDUCATION-REDEF REDEFINES EDUCATION. 06 DEGREE-1 PIC X(5). 06 INSTITUTION-1 PIC X(20). 06 YEAR-1 PIC 9(4). 06 DEGREE-2 PIC X(5). 06 INSTITUTION-2 PIC X(20). 06 YEAR-2 PIC 9(4). 06 DEGREE-3 PIC X(5). 06 INSTITUTION-3 PIC X(20). 06 YEAR-3 PIC 9(4). The procedure which allows you to control the storing of data using the above record definition follows: PROCEDURE EMP-STORE READY EMP WRITE ! Note the context variable A again STORE A IN EMP USING BEGIN EMP-ID=*.EMP-ID SS-NO=*.SS-NO ED-NO=*."NUMBER OF DEGREES" ! Store the first set of degree info if ed-no > 0 IF A.ED-NO>0 BEGIN DEGREE-1=*.DEGREE-1 INSTITUTION-1=*.INSTITUTION-1 YEAR-1=*.YEAR-1 END ! Store the second set of degree info if ed-no > 1 IF A.ED-NO>1 BEGIN DEGREE-2=*.DEGREE-2 INSTITUTION-2=*.INSTITUTION-2 YEAR-2=*.YEAR-2 END (continued on next page) 89 ! Store the third set of degree info if ed-no > 2 IF A.ED-NO>2 BEGIN DEGREE-3=*.DEGREE-3 INSTITUTION-3=*.INSTITUTION-3 YEAR-3=*.YEAR-3 END FINISH END-PROCEDURE As you can see, unless the variable occurs has a fairly low limit (i.e., it cannot occur more than three or four times), this method can be fairly cumbersome. 90 MODIFYING RECORDS IN DOMAINS WITH VARIABLE OCCURS Under most conditions, the length of a lst in a variable occurs can be changed. The rules are as follows: Sequential files: You must specify the MAX clause when defining the file to be able to increase the length of the list (the number of occurrences). Indexed files under VMS: You can always change the number of occurrences (you do not need to specify the MAX clause). Indexed files not under VMS: If you allow duplicate values for the primary key you cannot change the number of occurrences. The following examples use an abbreviated version of the Emp domain. The record definition is the following: RECORD EMPR USING 01 EMP-REC. 03 EMP-ID PIC 9(2). 03 SS-NO PIC 9(9) EDIT-STRING IS XXX-XX-XXXX. 03 ED-NO PIC 9 VALID IF ED-NO BETWEEN 0 AND 3. 03 EDUCATION OCCURS 0 TO '3 TIMES DEPENDING ON ED-NO. 06 DEGREE PIC X(5). 06 INSTITUTION PIC X(20). 06 YEAR PIC 9(4). ; You have to be a little careful when modifying records which have occurs clauses. If, for example, you say: READY EMP MODIFY FIND EMP WITH EMP-ID=5 [1 record found] MODIFY ALL Datatrieve will prompt you as follows: Enter EMP-ID: Enter SS-NO: Enter ED-NO: Enter DEGREE: Enter INSTITUTION: Enter YEAR: You will only be prompted once for the educaton fields (degree, institution and year) no matter what the value for ed-no (number of degrees) is. and, if you enter a new value for any of these fields, all the entries in that employee's record will be modified to contain 91 that value. In other words, if you modify year to be 1974, the year for all degrees listed for that employee will be modified to 1974. USING A SELECTED RECORD The simplest solution to this problem is to select the record you wish to modify as follows: READY EMP MODIFY FIND EMP WITH EMP-ID=5 [1 record found] SELECT MODIFY With this set of commands, Datatrieve will prompt you for ed-no (whatever the value of ed-no is) sets of education information (degree, institution and year). For example, if ed-no currently equals 2 for employee #5, you would be prompted as follows: Enter EMP-ID: Enter SS-NO: Enter ED-NO: Enter DEGREE: Enter INSTITUTION: Enter YEAR: Enter DEGREE: Enter INSTITUTION: Enter YEAR: If you modify ed-no (perhaps change it from 2 to 3) when prompted, Datatrieve will ask you for three sets of education information. USING A FOR STATEMENT An alternate way to handle the modify is as follows: READY EMP MODIFY FOR EMP WITH EMP-ID=*.EMP-ID MODIFY SS-NO, ED-NO, EDUCATION This will work as above, prompting you for "ed-no" sets of education information. 92 USING LISTS AS YOU WOULD USE DOMAINS OR COLLECTIONS Chapter 15 of the Datatrieve-11 User's Guide gives several good examples. To change the length of the list you can do the following (Emp must be an indexed file or a sequential file defined for MAX length) : READY EMP FIND FIRST 1 EMP PRINT No record selected, printing whole collection EMP SS ED ID NO NO DEGREE INSTITUTION YEAR 100 054-46-7489 2 HS EVANSTON H.S. 1968 BS U. OF ILLINOIS 1972 SELECT MODIFY ED-NO Enter ED-NO: 3 PRINT EMP SS ED ID NO NO DEGREE INSTITUTION YEAR 100 054-46-7489 2 HS EVANSTON H.S. 1968 BS U. OF ILLINOIS 1972 0000 FIND EDUCATION [3 record found] PRINT ALL DEGREE INSTITUTION YEAR HS EVANSTON H.S. 1968 BS U. OF ILLINOIS 1972 0000 SELECT 3 MODIFY Enter DEGREE: MBA Enter INSTITUTION: NORTHWESTERN U. Enter YEAR: 1978 PRINT FIRST 1 EMP EMP SS ED ID NO NO DEGREE INSTITUTION YEAR 100 054-46-7489 2 HS EVANSTON H.S. 1968 BS U. OF ILLINOIS 1972 MBA NORTHWESTERN U. 1978 93 WOMBAT MAGIC This Datatrieve session is an audience driven, problem solving, free wheeling, user-oriented, vocally interactive, fact finding, rumor killing, highly visual, myth dispelling, how-to-do-it, why-do-it, how-I-did-it sharing of techniques, tricks and problems. It is the chance for Wombat Magicians to show off their failures which made DATATRIEVE do the unexpected, their simple solutions which allow DATATRIEVE to do the expected, and their tricky solutions which push DATATRIEVE beyond the expected. The Wombat Magic session in Los Angeles was a great success with several entries, including several from the Dec DATATRIEVE development team. Fritz Merkle, of Ramada Inns, Inc., was judged champion Wombat Magician for his method of printing records via a switch. Fritz was awarded the prestigious "DATATRIEVE Goes Native" T-shirt. Throughout the session, a number of door prizes were given out. Winners of the set of VAX-11 information Management Architecture manuals donated by DEC were: Stuart Bernthal VAX-11 DATATRIEVE Reference Manual and Release Notes Marcia Brown Common Data Dictionary, Interactive Graphics, and the Calling Interface J. Schmid Introduction to DATATRIEVE Winners of six packs of beer werre Laurie Blair, Dave Nordby, Dave Hull, and Wade Scannel. 94 PRINTING VIA A SWITCH By Fritz Merkle DECLARE OP COMPUTED BY SWITCH VIA OPENT. DECLARE CON COMPUTED BY SWITCH VIA CONST. DECLARE DEV SWITCH VIA DEVT. PRINT. . . . , COL 30, (OP * ROOMS), COL 50, (CON * ROOMS), COL 70, (DEV * ROOMS) AT BOTTOM PRINT. . . . , TOTAL (OP * ROOMS), TOTAL (CON * ROOMS), TOTAL (DEV * ROOMS) ??? TOTAL OP TOTAL CON TOTAL DEV ROOMS HOTEL NAME OPEN CONST DEV Here 100 There 150 Somewhere 300 Total 100 150 300 Total Hotels 1 1 1 RECORD DEFINITION HOTEL-NAME PIC X(?). ROOMS PIC 9(4). SWITCH PIC X VALID IF "0","C","D". TABLES OPENT CONST DEVT "O":"1" "0":"0" "0":"0" "C":"0" "C":"1" "C":"0" "D":"0" "D":"0" "D":"1" ELSE "0" ELSE "0" ELSE "0" 95 CUSTOMIZING THE DATA DICTIONARY VIA THE START-UP FILE by Brad Morgan $DEFINE DTR$STARTUP DICT.COM [MORGAN] DICT.COM : ------------------------------------------ : : : [.COM] [.DTR] [DBMS32] DICT.COM DICT.COM DICT.COM $SET DEF [MORGAN.COM] $DTR32 DTR>SET DICTIONARY -- CDD$TOP.MORGAN.COM PRIME NUMBER PROCEDURE by Jim Starkey DEFINE DOMAIN PRIMES . . . . DEFINE RECORD PRIME-REC 01 NUMBER LONG. DEFINE FILE FOR PRIMES KEY = NUMBER DEFINE PROCEDURE PRIME READY PRIMES FOR WRITE DECLARE X LONG. DECLARE SQRT LONG. IF NOT ANY PRIMES BEGIN STORE PRIMES NUMBER = 2 STORE PRIMES NUMBER = 3 END X = MAX NUMBER OF PRIMES REPEAT BEGIN SQRT = 2; X = X + 2 REPEAT 5 SQRT = (X/SQRT + SQRT)/2 IF NOT ANY PRIMES WITH NUMBER BT 3 AND SQRT AND NUMBER EQ NUMBER + (X/NUMBER * NUMBER - X) THEN BEGIN STORE PRIMES NUMBER = X PRINT NUMBER END END 96 CROSS-FILE COMPUTED FIELD by Rick Landau OUR EXPENSE REPORTS FRONT BACK ------------------------------------- ------------------------------------- : : : : : : : : : : : : : : ------------------------------------- ------------------------------------- D : : : : : : : : : : : : : : ------------------------------------- ------------------------------------- A : : : : : : : : : : : : : : ------------------------------------- ------------------------------------- Y : : : : : : : : : : : : : : ------------------------------------- ------------------------------------- S : : : : : : : : : : : : : : ------------------------------------- ------------------------------------- : : : : : : : : : : : : : : ------------------------------------- ------------------------------------- \ USUAL JUNK BY CLASS \ MISCELLANEOUS EXPENSES \ TOTAL OF MISC EXPENSES FROM BACK-' 01 FRONT-REC. 03 DAY USAGE DATE. . . . 03 MISC COMPUTED BY TOTAL MISC-AMY OF BACK WITH DAY = FRON.DAY. 03 DAY-TOTAL COMPUTED BY (MEALS + HOTEL + AIR + CAR + MISC). MUST READY BACK FIRST! (WORKS BY ACCIDENT) TIME OF DAY by Rick Landau (For storing in audit trails, etc.) . Program runs once a minute, stores time as string in a file . DTR opens file (readies) as a one-record domain . DTR extracts string from record, finishes domain . Time string in variable . Lotsa disk accesses 97 VAX USER COUNT by Joan Hilton FIND VMS WITH " "|TERMDATE CON " "|DAY||"-"||MO DECLARE TIM QUAD.;DECLARE TM DATE. DECLARE TM DEFAULT VALUE 36000000000. TM = MO||"-"||DAY||"-81" TIM = TM REPEAT 24 BEGIN CNT = 0 FOR CURRENT WITH TERMTIM GE TIM AND LOGIN LE TIM CNT = CNT + 1 TM = TIM PRINT TM USING X(20), CNT TIM = TIM + INCR END VAX ALARM CLOCK (OR JOAN'S EXPENSIVE WATCH) by Joan Hilton PRINT "THE CURRENT TIME IS" FN$TIME("NOW") DECLARE FOO PIX X(5). FOO = *."TIME TO LEAVE (HH:MM): WHILE FN$TIME("NOW") LT FOO PRINT "GET TO WORK" PRINT FN$TIME("NOW") "TIME TO GO HOME!" VAX CPU RESPONSE MONITOR by Dave Nordby DECLARE T1 DATE DEFAULT VALUE "NOW" DECLARE T2 DATE. DECLARE DH PIC S99.;DELCARE DM PIC S99. DECLARE DS PIC S99.;DELCARE DIDO PIC S99. DECLARE CNT PIC 9(5). REPEAT 1000 BEGIN CNT = CNT + 1 END T2 = "NOW" DH = ((FN$HOUR(T2)) - (FN$HOUR(T1))) DM = ((FN$MINUTE(T2) - (FN$MINUTE(T1))) DS = (FN$SECOND(T2) - FN$SECOND(T1))) D100 = ((FN$HUNDREDTH(T2)) - (FN$HUNDREDTH(T1))) STORE VAX USING BEGIN TIME = T1 DUR = (DH * 360000) + (DM * 6000) + (DS * 100) + D100 END 98 SORTING RECORDS WITH VARIABLE LENGTH OCCURS by Bart Lederman Fixed Variable ------------------------------ -------------------------------- : : : : : : : : : KEYF : B : ------- : : KEYV : C : ------- : : : : : : : : : ------------------------------ -------------------------------- NO-DUP DUP DECLARE A PIC XXX. WHILE *."Y IF DONE" NOT CONT "Y" THEN BEGIN A = *.KEY STORE FIXED USING BEGIN KEYF = A B = *.B . . . END REPEAT *."NUMBER OF ENTRIES" STORE VARIABLE USING BEGIN KEYV = A C = *.C . . . END END (then release A) Tie together with view (for any variable with KEYV = KEYF). Any number of variable occurances. Separate protection on portions. Save pool by readying only one when needed. Should use less pool than variables with long records. 99 PROCEDURE TO MODIFY VARIABLE LENGTH OCCURS By Larry Jasmann PROCEDURE P105 MODIFY USING BEGIN IF QST CONTAINING "1" THEN MONTH = *."MONTH" IF QST CONTAINING "2" THEN MONTH DATE-POSTED = *."DATE POSTED" . . . ETC. IF QST CONTAINING 5 THEN BEGIN PRING "THIS RECORD HAS "|NUM-OPP||"APPROPRIATIONS LISTED", COL 1 "DO YOU WISH TO CHANGE # APPROPRIATIONS?" IF *."YES OR NO" CONTAINING "Y" THEN MODIFY USING NUM-APP = *."NUMBER OF APPROPRIATIONS" END FIND ALL APPS IF QST CONTAINING "S" THEN PRINT ALL CURRENT IF QST CONTAINING "J" THEN SELECT *."NUMBER OF RECORD TO MODIFY (FROM TOP)" IF QST NOT CONTAINING "S" THEN SELECT FIRST IF QST CONTAINING "S" THEN BEGIN PRINT PRINT "IS THIS THE RIGHT ONE?" IF *."YES OR NO" CONTAINING "N" THEN ABORT "TRY AGAIN" PRINT COL 25, "*** MENU ***", COL 5, "1. APPROPRIATION", SKIP COL 5, "2. AMOUNT", COL 10, "SELECT THE FIELDS WHICH YOU WISH TO MODIFY." QST1 = *."THE NUMBER WHICH YOU WISH TO MODIFY" MODIFY USING BEGIN IF QST1 CONTAINING "1" THEN APP = *."APPROPRIATION" IF QSTI CONTAINING "2" THEN AMT = *."AMOUNT" END PRINT END :P106 END-PROCEDURE; PROCEDURE P106 PRINT "DO YOU WISH TO MODIFY ANOTHER RECORD?" IF *."YES OR NO" CONTAINING "N" THEN ABORT :P105 100 NESTED PROCEDURE TO WRITE REPORT FROM MORE THAN ONE COLLECTION by Kurt Schweer SUBSTANDARD DOUBTFUL LOSS LOANS ADDED 20,000 5,000 50 LOANS REMOVED 1,000 2,000 1,000 CLASSIFIED CHAANGE 0 500 3,000 RECORD DEFINITION 01 CLASSIF-REC. 05 CHANGE-CODE PIC X(2). 05 CLASSIF-CODE PIC X(2). 05 CURRENT-BALANCE PIC 9(9). CHANGE-TABLE CLASSIF-TABLE 01:"LOANS ADDED" 01:"SUBSTANDARD" 02:"LOANS REMOVED" 02:"DOUBTFUL" 03:"CLASSIF CHANGE" 03:"LOSS" ELSE "UNKNOWN" ELSE "UNKNOWN" PROCEDURE A (PRINT "CLASSIFIED LOAN REPORT") (PRINT "SUBSTANDARD" "DOUBTFUL" "LOSS") FIND NEW IN (DOMAIN) WITH DATE = (THIS MONTH) FIND NC IN NEW WITH CHANGE-CODE = "01" :PROCEDURE B FIND NC IN NEW WITH CHANGE-CODE = "02" :PROCEDURE B FIND NC IN NEW WITH CHANGE-CODE = "03" :PROCEDURE B PROCEDURE B DECLARE SS PIC 9(11). SS = TOTAL CURRENT-BALANCE OF NC WITH CLASSIF-CODE = "01" DECLARE D PIC 9(11). D = TOTAL CURRENT-BALANCE OF NC WITH CLASSIF-CODE = "02" DECLARE L PIC 9(11). L = TOTAL CURRENT-BALANCE OF NC WITH CLASSIF-CODE = "03" :PROCEDURE C PROCEDURE C SELECT FIRST NC PRINT CHANGE-CODE VIA CHANGE-TABLE(-) USING X(14), COL 40, SS(-) USING ZZZ,ZZ9, COL 55, D(-) USING ZZZ,ZZ9, COL 70, L(-) USING ZZZ,ZZ9 (THIS SHOULD BE RUN BATCH SO THAT THE PRINT STATEMENT GOES TO HARDCOPY.) 101 PROCEDURE FOR FIND ... BEGINNING WITH "..." by Rick Landau PRINT YACHTS WITH BUILDER BEGINNING-WITH "ALB" ALBERG ALBIN . . . 03 BUILDER PIC X(16). 03 CRUD REDEFINES BUILDER 05 BUILDER-3 PIC X(3). 05 FILLER PIC X(13). . . . PRINT YACHTS WITH BUILDER-3 EQ "ALB" . STILL USES THE INDEX!! . VARIOUS LENGTHS!! PROCEDURE TO LEFT JUSTIFY A VARIABLE by Paul Samson 03 VAR PIC IS X(N). 03 VAR1 REDEFINES VAR. 05 HEAD PIC IS X. 05 TIAL PIC IS X(N-1). . . . READY DMN MODIFY DECLARE KNT USAGE IS COMP. REPEAT 1000 BEGIN KNT = COUNT OF DMN WITH HEAD = " " IF KNT = 0 THEN ABORT MODIFY USING VAR = TAIL OF DMN WITH HEAD = " " END 102 USING START-UP FILE TO VERIFY IF USER IS ALLOWED TO RUN DTR by Wayne Jones SET NO ABORT DECLARE Y PIC 9(5). DECLARE 2 PIC 9(5). READY USER-LOG WRITE Y = COUNT OF USER-LOG STORE USER-LOG USING BEGIN USERNAME = *."YOUR USER NAME" BADGE-NUMBER = *."YOUR BADGE NUMBER" START-TIME = "NOW" JOB = *."THE TASKS YOU'RE GOING TO DO" END VERIFY USING BEGIN IF USERNAME NOT IN USER-TABLE THEN ABORT IF USERNAME NE BADGE-NUMBER VIA BADGE-TABLE THEN ABORT END SET ABORT Z = COUNT OF USER-LOG IF Z GT Y THEN ABORT:"WELCOME TO VAXDTR" PRINT "SORRY. BYE." EXIT HOW TO USE VT100 SCREEN CONTROL CHARACTERS IN PROCEDURES USING EDT V2 by Art Hurst 1. Extract procedure 2. EDT procedure in change mode 3. Position cursor 4. Type "ESCAPE" and "ENTER" You will get om 5. Delete "om" 6. Type the desired control string i.e., [2J to clear screen. ([2J) = clear screen. 103 PROCEDURE TO SOLVE COMPLEX EQUATIONS by Bart Lederman PROCEDURE CALC DECLARE ERLANGS PIC 999.9 DECLARE TRUNKS PIC 999 USAGE IS INTEGER. DECLARE TRKREQ PIC 999. DECLARE I PIC 999 USAGE IS INTEGER. DECLARE BLOCK USAGE IS REAL. DECLARE TEMP1 USAGE IS REAL. DECLARE TEMP2 USAGE IS REAL. TRUNKS = 0 BLOCK = 1 ERLANGS = *.ERLANGS IF ERLANGS LE 0 THEN BEGIN TRUNKS = 0 BLOCK = 0 END WHILE BLOCK GT 0.001 BEGIN TRUNKS = TRUNKS + 1 1 + TRUNKS TEMP1 = 1 TEMP2 = 1 WHILE I GE 1 BEGIN TEMP1 + TEMP1 * I/ERLANGS IF TEMP1 LE 0.0001 THEN I = 0 TEMP2 = TEMP2 + TEMP1 1 + 1 - 1 END BLOCK = 1/TEMP2 END TRKREQ = TRUNKS PRINT ERLANGS, TRKREQ RELEASE ERLANGS RELEASE TRUNKS RELEASE I RELEASE TEMP1 RELEASE TEMP2 RELEASE BLOCK END-PROCEDURE