THE WOMBAT EXAMINER February 1981 Vol. 3 No. 1 INDEX From Digital Equipment, Australia ...................1 POTENTIAL PROBLEM ..................................2 Pre-Symposium Workshop .............................3 DECUS Spring '81 ...................................7 DATATRIEVE-11 V2.0 Patch ...........................8 DECUS Fall '80 Notes ...............................9 What's New in DATATRIEVE-11 V2.0 ...................13 DATES in DATATRIEVE V2.0 ..........................23 Conversion to DTR-11 DATE datatype ................29 Screen Formatting Using DATATRIEVE ................30 Processing FORTRAN Sequential Files w/ DTR .........36 Letters Requesting Help ...........................44 For FORTRAN and DTR users on the VAX ..............46 IMPORTANT NAMES AND ADDRESSES: Chairman: Newsletter: Chuck Watson Kathy Tamer Batelle Department of Anesthesiology Pacific NW Laboratories UTHSCH P.O. Box 999 6431 Fannin Richland, WA 99352 Houston, TX 77030 FTS: 444-2227 (713) 792-5566 (509) 376-2227 Questions: Joan Hilton Beth Carter Leigh H. Smith G. D. Searle Bridgeport-Textron M/S 2500 P.O. Box 1045 200 Precision Rd. Xerox Corp. Skokie, IL 60076 Horsham, PA 19044 300 N. Halstead (312) 982-7485 (215) 674-2700 Pasadena, CA (213)351-2351 x1820 COVER - If you don't understand our cover, type DTR>HELP WOMBAT. The photograph on this cover was reprinted by permision of the Lane Publishing Co. from the November, 1980 issue of SUNSET magazine. The art work is a product of the graphics group at Battelle Northwest. 1 From an unidentified supporter in the Sydney, Australia Office of Digital Equipment: -WOMBAT PICTURE INSERTED HERE- Sky eye spots wombats' work By Michael Laurence THE hairy-nosed wombat has been blamed for eating large amounts of vegetation on the Nullarbor Plain near the Great Australian Bight. Images from the Landsat satellite 900 kilometres above the Earth suggest that the wombats, thought to be a grass-eater, may have a liking for desert shrubs. The wombats' warrens may have a diameter of 20 to 30 metres, too small to be seen individually from space. But grouped into colonies they show up as small white dots on the Landsat images. Graziers are angry and say the viability of their land is in danger if the wombat population is not controlled, but conservationists point out that the hairy-nosed wombat is a threatened species. Members of the land-use research division of the CSIRO began to suspect the wombat when they noticed the pale soil and subsoil of the plain in the Landsat images, suggesting the vegetation had been eaten. Dr. E. Loeffler and Mr. C. Margules, of the division, say it is unlikely that the damage was caused by sheep or rabbits. Rabbits had been kept in check by myxomatosis and damage had not occurrred in some areas where there were sheep but no wombats. The South australian hairy-nosed wombat is one of four distinct species of the marsupial. Like the others it is nocturnal and digs burrows in which it shelters during the day. Its distinctive feature is its soft furry coat. 2 DECUS DIGITAL EQUIPMENT COMPUTER USERS SOCIETY ONE IRON WAY, MARLBORO, MASSACHUSETTS 01752 TEL.(617)467-4100/TWX 710-3470212 TELEX 948457 December, 1980 TO: DECUS U.S. Leadership FROM: Judy Arsenault POTENTIAL PROBLEM I am writing to inform you and your LUG/SIG membership of a potential problem. I have received a phone call from the RSTS SIG Chairman, Bruce Gaarder, informing me of a situation that could be very damaging for all parties. It seems that a number of RSTS users have been receiving phone calls from individuals stating they are Digital employees and requesting to call into their systems to pull off data. One member who received a call immediately phoned the DEC office to verify. He was then informed at that time, that no such call had been made from DEC. If you do receive a similar call please make sure you verify by contacting your nearest DEC office. Obtain the Digital number from the phone book or directory assistance. It is too easy to give a false number and have the receiving end answer with "Digital Equipment". 3 PRE SYMPOSIUM WORKSHOP There has been considerable interest expressed in a workshop for advanced DATATRIEVE users. We tried to host a pre symposium session in San Diego, but were thwarted by lack of computer access. We have support from DEC (see letter from John Anderson to Paula Morin) for hardware at Miami. We also have volunteers in the Miami area who can provide dial-up access to DATATRIEVE. Therefore, we are proceeding with plans for a pre symposium workshop Sunday, May 17, in Miami Beach. Dave Nordby has accepted responsibility of WORKSHOP COORDINATOR. He prepared the following course description. COURSE DESCRIPTION This will be an advanced workshop for those who have had experience with DATATRIEVE V2. The workshop is to include the new features of 2.0, and will provide hands-on experience with example problems for the participants. Users who were involved with the testing of 2.0 will help participants using the new features. To derive the greatest benefit from the workshop, participants should have experience in developing systems under 1.1 or 2.0. This experience should include defining records, domains, files, and procedures (including edit strings and comp fields), as well as use of the report writer (including sorting, sections, and totals). If the participants is not familiar with these features, the workshop will be of limited value, since the one-day schedule is very tight and will allow little or no time for review of DATATRIEVE basics. The number of participants is being limited to allow small groups to work together. It is important that application be made early, since acceptance to the workshop will be granted in the order that applications are received. It may become necessary to restrict participation to one person per institution if we find that there are more requests than can be accommodated. So, if you are a present user, and want to learn how to use all the neat new features such as variables, views, and tables, come to Miami a day early. 4 TOPICS TO BE COVERED; Extract Define Dictionary Editing domain and record definitions DefineP Tables - creating and printing via Input validation with boolian with tables Computed by fields Date data type Variables local global virtual T format Concatenation For loops Sum ADT (Application Design Tool) Hierarchies in single domain fixed occurs variable occurs Views of multiple domains restricted view of single domain Show fields Any 5 LETTER REGARDING HARDWARE AT SYMPOSIUM ***************** * * * 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: PAULA MORIN MR2-3/E55 DATE: 22 September 80 D. NORDBY FROM: John Anderson C. WATSON DEPT: Commercial Products Management EXT: 264-7783 LOC/MAIL STOP: MK1-2/DO3 SUBJECT: DATATRIEVE SEMINAR PRIOR TO MIAMI DECUS I want to express my support for a one day DATATRIEVE Seminar the day before the Spring DECUS Symposium in Miami. The DATATRIEVE SIG, in the person of Dave Nordby has developed a comprehensive seminar that will be worthwhile to a large segment of our user base. To conduct the seminar they will need access to a VAX (with DATATRIEVE V2.0) and 8-10 terminals for the two days preceeding the Spring DECUS, and a room in which to conduct it (estimate 100 people). This seminar was tentatively scheduled for Fall DECUS but was cancelled due to a lack of equipment. As SIG counterpart and DATATRIEVE Product Manager I firmly support this seminar. Please accept this memo as a formal request to pursue: - Arranging to have a VAX (with 8-10 terminal) available to the seminar people for the two days before the symposium. NOTE: EXCLUSIVE access is not required as long as the system is up and has acceptable response to the DATATRIEVE users. - arrange a meeting room capable of seating 150 people for their use on the same two days. The terminals do not have to be in that room but it is desirable. Please acknowlege receipt of this memo and let me know if you need additional information to proceed. Thank you for your time and consideration. :eg 6 HOW TO SIGN UP If the pre-symposium tutorial workshop is approved by the DECUS symposium committee in early February, an announcement will be included in the Preliminary Program which all DECUS members will receive. An application form will be part of the Preliminary Program. We expect that the fee for this workshop will be less than $100 plus the additional night's lodging. If you wish to attend the tutorial, send in the form (and the fee) to the DECUS office as soon as possible. If you would like to encourage dave, please send him an estimate of the number of participants from your site that will attend. He can make good use of this information prior to the official regristration through the DECUS office. (Do not send Dave any money ... ) Dave may be reached at: Dave Nordby G.D. Searle PO Box 5110 Chicago, IL 60680 (312) 982 7427 A few experienced users are still needed to assist with the workshop. Dave needs to know who you are. 7 DECUS Spring '81 If all goes well, the following announcement will appear in the preliminary program for the Spring symposium. (It is contingent on use of computer hardware in the meeting room. We feel that a WOMBAT MAGIC session without live demonstrations would be next to useless. Therefore, we are pushing the powers that be as hard as possible to come up with a viable setting for group access to on-line DATATRIEVE.) WOMBAT MAGIC this DATATRIEVE session is an audience driven, problem solving, free wheeling, user oriented, vocally interactive, open ended, 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 will only be presented if on-line access to DATATRIEVE is available. Users with problems and WOMBAT EXAMINERS with solutions will be able to DEMONSTRATE them on the screen. Two major areas will be covered: HELP ME HELP ADVANCED ME Plan ahead. Bring your failures which made DATATRIEVE do the unexpected. Bring your simple solutions which allow DATATREIVE to do the expected. Bring your tricky solutions which push DATATRIEVE beyond the expected. A PRIZE will be awarded the participant judged the most interesting. (Employees of DIGITAL and their families are not elegible for the prize ... but they may act as judges.) 8 DATATRIEVE-11 V2.0 Patch MODIFY CAN CORRUPT DATA Following is a patch for DATATRIEVE-11 V2.0 which was published in the November, 1980 Software Dispatch. The diagnosed problem which is corrected by this patch involves the POSSIBLE CORRUPTION OF DATA WHEN USING A MODIFY. Problem: When an alternate keyed field is part of the record selection criteria for a MODIFY, records not associated with the record selection criteria might be changed. In some cases, records that don't match the rse are modified: in other cases, records that match the rse are not modified. Solution: Install the patch below using the patching procedure specific to the operating system used. Note that the following patch code should have the title of DTR005.MAC, and the checksum of the patch is 005755. .TITLE RU (modification of alternate key problem) .IDENT /V02.01/ .PSECT RU RU=, .=RU+1534 NOP NOP .END 9 WOMBAT EXAMINER - FEBRUARY '81 DATATRIEVE NOTES Eleanor N. Corr Director of Data Processing Keystone Junior College LaPlume, PA 18440 DATATRIEVE SIG OPENING SESSION - Tuesday, November 4th Chuck Watson presided over this opening session which was attended by approximately 120 persons. steering committee members, and several Digital personnel were introduced. "Help me" sessions in the campgrounds were explained and a sign-up sheet was made available for volunteers to help. Of those in attendance: 3/4 had not attended a DTR session previously, though most have been using DTR. 1/3 have been using DTR longer than two years. 1/3 have been using DTR 1-2 years 1/3 are new to DTR or not yet using it. A good get-acquainted session as well as a chance to belabor the "wish list". INTRODUCTION TO DATATRIEVE - Wedsnesday, November 5th A whopping number totaling 261 attended this session in the grand San Diego Room. Chuck Watson got things started. Then we all - heard Jim Starkey do his thing - reviewed the DTR product - enhancements to DTR were explained by DEC personnel - questions were answered 10 WOMBAT EXAMINER - FEBRUARY '81 DECUS FALL '80 DATATRIEVE NOTES Campgrounds were scheduled for Wednesday and Thursday 10-12 a.m. and 1-3 p.m.; but you could go over to the Committee Room (campground) most anytime and find bodies relating, trying to solve each others problems. DATATRIEVE 1.1 - WHAT'S NEW IN VERSION 2.0? An impressive 238 people attended this session with some willing to stand. Anne Duncan, of DEC, provided us with an introduction to V2.0 of DATATRIEVE. Following a review of its new features, a question/answer period gave us an opportunity to find out how many of our "wishes" have been granted - thus far. SCREEN FORMATTING USING DATATRIEVE Pat Synder, of the Food and Drug Administration in Rockville, Maryland, provided a good presentation using transparencies to describe a technique for formatting a CRT screen using DATATRIEVE. Examples were given in VT52 and VT100 modes. 109 people at this session - learning how to use the "print" command with escape sequences and direct cursor addressing. DATATRIEVE 1.1 OPTIMIZATION Anne Duncan reviewed, for the 91 attendees, the optimization techniques for DTR 1.1 and discussed Version 2.0. Information provided on slides shown by Anne will be included in the next SIG newsletter. A few of the many points we found of particular interest: - DTR V2.0 tasks very heavily overlayed - pool is part of the DTR task - if we follow the suggested use of DTR taks, we should not experience "pool exhausted". 11 WOMBAT EXAMINER - FEBRUARY '81 DECUS FALL '80 DATATRIEVE NOTES - DEC does not support "finds" within loops - only "for". - DTR V2.0 has patches already!! Because of the many requests for DEC training in the use of DTR, Anne will ask edicational user services about its possibility. DATATRIEVE SIG WRAPUP Our last session, chaired by Chuck Watson, was attended by 76 persons. The "wish list" (numbering 46) was evaluated by Jim Starkey, et.al. (he said there would be a maintenance release for DTR V1.1). The chairman provided the following summary comments: - the sessions were well attended (150-250) - DEC personnel attended and provided support - enthusiasm was generally exhibited by all - campgrounds were well covered - and attended. - it was a useful DECUS meeting for all DATATRIEVE users. also received a short pep talk about getting involved. We need more contributors, presentors at symposiums. The committee would like to know what kind of sessions we didn't get to hear (what did you come for that wasn't provided?). A big hand for Pat Synder, symposia coordinator, who did a great job! We were told: - What to expect in Miami (pannel discussions) - They were looking for ideas for papers, presentations. Dave Nordby told us that: the Miami symposium was being held from Mon. thru Thurs. - The conventions center and hotels are not together - There is a possibility of combination workshops/demonstrations being the format. Ideas were encouraged from the floor. John Anderson - Product rep from DEC queried the participants regarding the type of user in attendance (first timers vs. old hands) so that he 12 WOMBAT EXAMINER - FEBRUARY '81 DECUS FALL '80 DATATRIEVE NOTES could have some idea on how to provide education and how advances. He will announce the strategy of training by DEC at the Miami symposium. As a token of appreciation, Jim Kelly presented Jim Starkey with a poster - which reads: "Don't be ashamed of what you are - By the way, what are you?" In conclusion, remember: 1 clunk = 1/10 millionth of a second! 13 WHAT'S NEW IN DATATRIEVE V2.0 Anne Duncan, DIGITAL SOFTWARE REQUIREMENTS RSTS/E V7.0 RSX-11M V3.2 RSX-11M-PLUS V1.0 IAS V3.0 VMS V2.0 NEW DOCUMENTATION . PRIMER . USER'S GUIDE . RELEASE NOTES . INSTALLATION GUIDE NEW FEATURES DBMS-11 Interface . Interface to DBMS-11 V1.0 . Domain references one record type . Extensions to RSE: -Within clause to access members of a set -Owner clause to access owner of a set . All DATATRIEVE commands allowed except store and erase. Data Hierarchies . Defines a repeating group of data (a list) . Occurs clause on record definition - fixed number of occurences - variable number of occurences . Specify for a single domain . Specify for view . Inner print list . Boolean expression ANY 14 RECORD FAMILY-REC 01 FAMILY. 03 PARENTS. 06 FATHER PIC X(10). 06 MOTHER PIC X(10). 03 NUMBER-KIDS PIC 99 EDIT-STRING IS Z9 03 KIDS OCCURS 0 TO 10 TIMES DEPENDING ON NUMBER-KIDS. 06 EACH-KID. 09 KID-NAME PIC X(10) QUERY-NAME IS KID. 09 AGE PIC 99 EDIT-STRING IS Z9. ; DTR> READY FAMILIES DTR> FIND FAMILIES WITH ANY KIDS [13 records found] DTR> FIND FAMILIES WITH NOT ANY KIDS [1 record found] DTR> PRINT ALL NUMBER KID FATHER MOTHER KIDS NAME AGE ROB DIDI 0 15 WHAT'S NEW IN DATATRIEVE V2.0 Anne Duncan, DIGITAL NEW FEATURES (cont'd) Views . Artificial domains . May use value-based relationships across files . May be hierarchical . May subset fields . May subset records . Acts like other domains DOMAIN KETCHES OF YACHTS BY 01 KETCH OCCURS FOR YACHTS WITH RIG EQ "KETCH". 03 TYPE FROM YACHTS. 03 LOA FROM YACHTS. 03 PRICE FROM YACHTS. ; DOMAIN SIALBOATS OF YACHTS, OWNERS BY 01 SAILBOAT OCCURS FOR YACHTS. 03 BOAT FROM YACHTS. 03 SKIPPERS OCCURS FOR OWNERS WITH TYPE EQ BOAT.TYPE. 05 NAME FROM OWNERS. ; Tables . Dictionary object . May be edited using edit command . Reference automatically loads table . Use for input validation . Use for printing associated values TABLE RIG-TABLE "SLOOP" : "ONE MAST", "KETCH" : "TWO MASTS, BIG ONE IN FRONT", "YAWL" : "SIMILAR TO KETCH", "M/S" : "SAILS AND BIG MOTOR", ELSE "SOMETHING ELSE" END-TABLE 16 WHAT'S NEW IN DATATRIEVE V2.0 Anne Duncan, DIGITAL DTR PRINT RIG, RIG VIA RIG-TABLE USING X(35) RIG RIG KETCH TWO MASTS, BIG ONE IN FRONT DATE Datatype . USAGE IS DATE . VAX/VMS Standard format - 4-word boundary - word boundary aligned . Almost any form input . Flexible output format . Operations: sort, comparison, elapsed days . Knows "TODAY" DTR DECLARE DATE-IN USAGE DATE. DTR DATE-IN = "TODAY" DTR PRINT DATE-IN DATE IN 8-Sep-80 DTR PRINT DATE-IN USING W(9) Variables . Declare statement . May be Global . May be local . May be any datatype DTR DELCARE DATE-OUT USAGE DATE. DTR DATE-OUT = "SEP 12, 1980" 17 WHAT'S NEW IN DATATRIEVE V2.0 Anne Duncan, DIGITAL "COMPUTED BY" Fields . "COMPUTED BY" clause on field definition . Computed on reference (uses no file storage) . Elementary field . May be a variable DTR DECLARE ELAPSED-DAYS COMPUTED BY DATE-OUT - DATE-IN. DTR PRINT ELAPSED-DAYS USING 999 ELAPSED DAYS 004 NEW FEATURES (cont'd) Enhanced Data Entry Verification . Valid if clause on field definition . Verify with literal or table entry . Reprompting when: - Invalid data - Truncation : 06 LENGTH-OVER-ALL PIC XXX VALID IF LOA BETWEEN 15 AND 50 : 06 PRICE PIC 99999 VALID IF PRICE > DISP*1.3 OR PRICE EQ 0 Text Formatting . New EDIT-STRING character "T" . Use to print text . Scrolls text across multiple lines . Left justfies output DTR PRINT TEXT TEXT THIS IS THE FIRST PART OF THE TEXT EXAMPLE. IT WILL HELP TO PRINT TEXT. 18 WHAT'S NEW IN DATATRIEVE V2.0 Anne Duncan, DIGITAL DTR>PRINT TEXT USING T(30) TEXT THIS IS THE FIRST PART OF THE TEXT EXAMPLE. IT WILL HELP TO PRINT TEXT. DTR PRINT TEXT USING T(50) TEXT THIS IS THE FIRST PART OF THE TEXT EXAMPLE. IT WILL HELP TO PRINT TEXT. NEW FEATURES (cont'd) Additional EDIT-STRING Capabilities . " - " to insert hyphens . Ability to print dates as: - alpha or numeric day - alpha or numeric month - julian day - year - or various combinations DTR>DECLARE SSN PIC X(9). DTR>SSN=123456789 DTR>PRINT SSN USING XXX-XX-XXXX SSN 123-45-6789 DTR>PRINT SSN USING MMMBDD,BYYYY DATE IN Sep 8, 1980 19 WHAT'S NEW IN DATATRIEVE V2.0 Anne Duncan, DIGITAL Data Dictionary Maintenance . DEFINE DICTIONARY command - creates empty dictionary - sets it as current . EXTRACT command - Copy dictionary items to RMS files - Adds delete and define commands - Use as indirect command file . EDIT ADVANCED command - Allows editing of domain and record definitions DTR>DEFINE DICTIONARY SY: DTR>SHOW DICTIONARY The current dictionary is SY:(311,350)QUERY.DIC;2 DTR>EXTRACT ON YACHT.CMD YACHTS, YACHT, RIG-TABLE DELETE YACHTS; DEFINE DOMAIN YACHTS : DELETE YACHT; DEFINE RECORD YACHT : DELETE RIG-TABLE, DEFINE TABLE RIG-TABLE : DTR>EDIT YACHT ADVANCED ADT . Dialog with user . Helps create domain, record, and file definition . Create RMS file . Use indirect command file as input to DTR DTR>ADT Do you want help? (yes or no) : NO Do you want detailed questions? (YES or NO) : YES What do you want to name this domain? : 20 WHAT'S NEW IN DATATRIEVE V2.0 Anne Duncan, DIGITAL NEW FEATURES . SUM Statement - totals numeric fields in collection . SHOW FIELDS - Displays field name and type for readied domains . New concatenation operator - Deletes trailing spaces from first operator . Allocation major-minor clause - Use on record definition - Compatible with VAX/11 COBOL . New Report formatter - Creates nicer looking reports - Not completely compatible with V1.1 . Additional protection for execution - Need " E " privilege to record ADDITIONAL INSTALLATION OPTIONS . Dictionary default protection - (*,*) - (GROUP,*) V2.0 default - (GROUP,PRG) V1.1 default . Date input default - Month/day V2.0 default - Day/month . Page width size - 80 V2.0 default - 132 V1.1 default . Enable or disable ADT RESTRICTIONS REMOVED . 5000 records in collection . 16 total statements in RW . Scaling for floating point numbers . Full 18-digit arithmetic DATATRIEVE-11 V2.0 SO, IT'S GREAT; WHEN CAN I GET IT? NOW+++ 21 DTR> FIND FIRST 6 YACHTS [6 records found] DTR> SUM 1 BY BUILDER MANUFACTURER ALBERG 1 ALBIN 3 AMERICAN 2 6 DTR> SUM PRICE USING $$$$,$$$ BY BUILDER MANUFACTURER PRICE ALBERG $36,951 ALBIN $64,000 AMERICAN $28,790 $129,741 DTR>SHOW FIELDS YACHTS BOAT TYPE [Indexed field] MANUFACTURER (BUILDER) [Character string, indexed key] MODEL [Character string, indexed key] : Global variables: ELAPSED-DAYS [Computed value] DATE-OUT [Date] DATE-IN [Date] DTR> PRINT BUILDER : MODEL ALBERG 37 MK II DTR> PRINT BUILDER : : MODEL ALBERG37 MK II DTR> PRINT BUILDER : : ", " :MODEL ALBERG, 37 MK II 22 DATATRIEVE-11 V2.0 NEW FEATURES DEBUGGING AIDS o OPEN COMMAND o CLOSE COMMAND o SHOW SPACE DTR> OPEN YACHT,CMD DTR> CLOSE DTR> SHOW SPACE ***Current Memory Usage*** Allocated Used Free # of Fragments RMS pool 4800 4280 520 2 Small block pool 256 256 0 0 Sort pool l5360 0 15360 0 Total 20416 4536 15880 2 23 DATATRIEVE V2 DATES Chuck Watson Battelle Northwest Battelle Blvd. Richland, Washington 99352 (509) 376 2227 (FTS) 444 2227 The following suggestions for working with dates were inspired by Anne Duncan's optimization talk at the San Diego DECUS meeting. Dates are stored as binary numbers of "clunks" in eight-bytes under the USAGE DATE clause, where a clunk is 100 nanoseconds, and time is measured beginning at midnight on November 17, 1858. This is in conformance with the VAX method of storing dates, but is more precision than most of us need. In fact, for many applicatons, the traditional method of storing YYMMDD in one work via PIC 9(6) USAGE COMP may be more useful. I know that I will think about disk space a long time before I expand my existing 40 to 100 thousand record files by 3 words per record. However, there are some advantages to the USAGE DATE format. DATATRIEVE understands that the difference between two dates is to be expressed in elapsed days. Thus you can use the following syntax: 01 FOO-REC. 02 some fields 02 DAY1 USAGE DATE. 02 DAY2 USAGE DATE. 02 other fields ; Assume a record is found and selected: DTR> PRINT DAY1,DAY2 DAY1 DAY2 10-Nov-80 20-Nov-80 One can then subtract two dates, DTR> PRINT DAY2 - DAY1 10 DTR> PRINT DAY1 - DAY2 -10 Thus, one can compute elapsed days between events. 24 However, you may not be able to use the computed elapsed days in some cases. For example, DTR> PRINT 5 * (DAY2 - DAY1) will result in an error message, Overflow during multiplication if you have not installed PATCH 7 (november 1980) and, DTR> DECLARE FOO PIC 9999 USAGE COMP. DTR> FOO = DAY2 - DAY1 will result in an error message, Overflow during scaling of dividend. Execution failed because of a known bug - watch for a PATCH on this one, while, DTR> DECLARE FOO PIC 9(5). DTR> FOO = DAY2 - DAY1 will work correctly. If you try something obviously illegal such as: DTR> IF DAY2 - DAY1 = 10 PRINT "10 DAYS" you get an error message when the minus sign is encountered because expressions are illegal on the left of expressions. To test for dates ten days apart, do it this way: DTR> DECLARE TEN PIC 99. DTR> TEN = 10 DTR> IF TEN EQ DAY2 - DAY1 PRINT "YES" YES Other relational expressions are also possible: DTR> IF DAY2 LT DAY1 PRINT "YES" ELSE PRINT "NO" NO DTR> IF DAY2 EQ DAY1 PRINT "YES" ELSE PRINT "NO" NO DTR> IF DAY2 GT DAY1 PRINT "YES" ELSE PRINT "NO" YES 25 Now, what happens when one tries other mathematical opperations on these dates? Remember, dates are stored in clunks, and DATATRIEVE takes special pains to express differences between dates to the nearest whole day. The following illogical operations illustrate the futility of attempting to mathematically manipulate date fields. DTR> PRINT DAY1 USING 9(18) 038493792000000000 DTR> PRINT DAY2 + DAY1 *********** DTR> PRINT DAY2 + DAY1 USING 9(18) 076996224000000000 DTR> PRINT DAY2 + DAY1 USING DD-MM-YYYY 13-Nov-2102 Well, no one would try to add two dates anyway! What about attempting to add 10 days to another date? DTR> PRINT DAY1 + 10 ************ DTR> PRINT DAY1 + 10 USING 9(18) 038493792000000010 DTR> PRINT DAY1 + 10 USING DD-MMM-YY 10-Nov-80 Note that the 10 added (correctly) to the insignificant time portion of the date clunks has no effect on the DAY. What about multiplication and division? DTR> PRINT DAY1 / DAY2 USING 9.99999999 0.99977559 DTR> PRINT DAY2 / DAY1 USING 9.99999999 1.00022445 DTR> PRINT DAY2 * DAY1 USING 9(24) Overflow during multiplication Execution failed As you can see, dates should be treated as numbers only with the utmost care. 26 ONE DAY AT A TIME We can take advantage of the fact that dates are stored to the nearest whole day by creating variables equal to the number of clunks in a given number of days. This depends on the value for one day: 0.001 clunks per nanosecond X 1,000,000,000 nanoseconds per second X 60 seconds per minute X 60 minutes per hour X 24 hours per day or 864,000,000,000 clunks per day. We can now ADD a multiple of (positive or negative) days to a date. For example, to find the date 20 days either before or after DAY2, use the following: DTR> DECLARE ONE-DAY PIC 9(18) USAGE COMP. DTR> DECLARE FOO PIC 9(18) USAGE COMP. DTR> ONE-DAY = 864000000000 DTR> FOO = -20 * ONE-DAY DTR> !NOTE THE MINUS SIGN! DTR> PRINT DAY2 + FOO USING DD-MMM-YY 31-Oct-80 DTR> !NOTE THE EDIT STRING! DTR> FOO = 20 * ONE-DAY DTR> PRINT DAY2 + FOO USING DD-MMM-YY 10-Dec-80 AN EXAMPLE The following procedure will cause DATATRIEVE to print your very own WOMBAT CALENDAR, showing the days of the week throughout the year. It will require two pages of full size computer paper. I know this is stupid, but it illustrates the concept of date addition rather well. DTR> DEFINE PROCEDURE WOMBAT-CALENDAR DFN> SET COLUMNS-PAGE = 132 DFN> DECLARE DAY USAGE DATE. DFN> DECLARE ONE-DAY PIC 9(18) USAGE COMP. DFN> ONE-DAY= 864000000000 DFN> DAY = *.FIRST-SUNDAY-OF-YEAR DFN> HELP WOMBAT DFN> PRINT SKIP, DAY("YEAR") USING YYYY, SKIP DFN> REPEAT 52 BEGIN DFN> PRINT DAY(-) USING MMMMMMMMMBBWWWBDD ," ", DFN> DAY + ONE-DAY USING WWWBDD ," ", DFN> DAY + ONE-DAY * 2 USING WWWBDD ," ", DFN> DAY + ONE-DAY * 3 USING WWWBDD ," ", DFN> DAY + ONE-DAY * 4 USING WWWBDD ," ", DFN> DAY + ONE-DAY * 5 USING WWWBDD ," ", DFN> DAY + ONE-DAY * 6 USING WWWBDD DFN> DAY = DAY + ONE-DAY * 7 DFN> END DFN> END PROCEDURE 27 TODAY A slightly documented feature of DTR V2 is "TODAY" as a method of associating the system date with a DATE data type in DATATRIEVE. It can be thought of as a method of obtaining a constant rather than as a constant itself. "TODAY" is only the current date when associated with a date data type. In response to a prompt, it is used without quote marks, but it is used with quotes in statements and commands. DTR> DECLARE FOO USAGE DATE. DTR> FOO = *.DAY Enter DAY: "TODAY" Conversion error from date string "TODAY" Re-enter DAY: TODAY DTR> !NOTE LACK OF QUOTE MARKS! DTR> PRINT FOO (-) 10-Nov-80 or DTR> DECLARE FOO USAGE DATE. DTR> FOO = TODAY Field "TODAY" is undefined or used out of context DTR> FOO = "TODAY" DTR> !NOTE THE QUOTE MARKES!!! DTR> PRINT FOO (-) 10-Nov-80 It can also be used in a PRINT statement with appropriate use of edit-strings. DTR> PRINT "TODAY" TODAY DTR> PRINT "TODAY" USING DD-MMM-YY 10-Nov-80 We have seen that TODAY will be the system date when it is associated with a date data type via USAGE DATE or an EDIT STRING. It may also be indirectly associated with a date data type if "TODAY" is on the right side of the expression. DTR> IF FOO = "TODAY" PRINT "EAT A ROCK" EAT A ROCK but DTR> IF "TODAY" = FOO PRINT "EAT A ROCK" Expected field name, encountered ""TODAY"" 28 NOW One would like to have a similar facility to convert both the system date and the system time to a DATATRIEVE date. This is on the wish list, and when implemented, we expect that it will be in the form of "NOW". I gather that this is under serious consideration for the native mode version on the VAX, but will probably have to wait for version 3 of DTR-11. DTR-11 V2 does not support translation of clunks into time of day. The problem is complicated because DATATRIEVE is running out of unique edit-string characters (M is used for month, so what character should be used to indicate minutes?). And, since "NOW" is not supported, the time portion of dates stored by DATATRIEVE are set to zero. USING DATES OUTSIDE OF DATATRIEVE If a user program generates dates in clunks with more resolution than the nearest whole day, how does one display or use that accuracy in DATATRIEVE? And, for that matter, how does one generate 4 word binary numbers in a user program? These are probably questions of interest to VAX users. Since I have no experience on the VAX, I will leave them to the readers. The best answers will be published in the next issue. Anne Duncan submitted the information on the following page. I hope someone will publish an example of how they used her suggestions. 29 SUBMITTED BY ANNE DUNCAN, DEC CONVERSION TO DATATRIEVE-11 DATE DATATYPE OR HOW TO TRANSLATE A DATE TO CLUNKS To store a date in Datatrieve-11 date datatype format from another language, use the GETTIM module from the Datatrieve library. It can be extracted from the library and included in the linking (task building) of the program in the other language. GETTIM is written in MACRO and uses the following interface: Enter by : JMP $GTTM2 R0 must point to a quad-word (8 bytes) where the clunks for the given date will be returned. R1 through R5 will be destroyed. All data is passed to this routine on the stack in the following order: Pushed 1st: return PC 0 0 0 0 0 0 day month Pushed last: year since 1900 This routine is correct from November 17, 1858 through February 28, 2100 inclusive (it erroneously assumes the year 2100 is a leap year). It handles all intermediate leap years correctly. 30-A SCREEN FORMATTING USING DATATRIEVE Patricia A. Snyder Food and Drug Administration Bureau of Radiological Health Rockville, Maryland ABSTRACT This paper describes some techniques for formating flexible and varied CRT displays, using "escape" sequences and the DATATRIEVE "print" statement. Both VT-and VT-100 sequences are discussed. INTRODUCTION The Bureau of Radiological Health is part of the Food and Drug Administration which is in turn part of the United states Public Health Services. The mission of the Bureau is to assure the safe and effective use of radiation, and to control unnecessary exposure to it. With that end in mind, the Bureau has programs which include: - support of research on the health effects of radiation exposure - development of standards for radiation use and exposure - control of radiation in electronic products. The system under discussion is one which serves the Division of Electronic Products. This Division functions in the third area mentioned above, the control of radiation in electronic products. The groups served by this system are concerned with radiation dosimetry, and are responsible for the calibration, repair, and shipping of instruments for radiation measurement to FDA regional offices, other government agencies, and state and local governments. It is for the purpose of tracking location, calibration and repair records of these instruments that DATATRIEVE is used. The system is a PDP 11/40, currently running RSX-11M V3.1 and DTR1.1. There are two main files on the system; the Inventory File which contains approximately two thousand records, one for each piece of equipment, and the Address File, containing about two-hundred records, one for each office to which we ship. Both files are indexed; the Inventory File has eight keys and the Address File has one. The two files are related; a field called address code is the pointer between them. The examples cited below relate to those files. Reasons for Using These Techniques There are several areas in which the DATATRIEVE 'print' statement is less than adequate for displaying a full screen of information. First, the 'print' command terminates, in most cases, with two carriage returns, making it difficult to display information on consecutive lines unless it is in a palin column-by-column format. Second, if information has been placed on a line by a previous 'print' command, the "COL nn' designation is a 'print' command will erase it. Third, use of screen formatting techniques makes it possible to display more information on a single screen than is possible with conventional 'print' commands, and to easily display information from more than one file. Figure 1 is a screen composed of information from two files and uses multiple 'print' commands. Finally, these 30-B techniques make it possible to use some of the special VT-100 features which are not otherwise available through DATATRIEVE. INSTRUMENT: 00252 MODEL: V570 SERIAL: 689 PURCHASE DATE: 0/00/00 TRANSACTION DATE: 8/16/79 TODAY'S DATE: 7/22/80 USAGE CALIBRATIONS SHIPPING INFORMATION OWNER: R1 TOTAL NUMBER: 0 SHIPPER: UPS USER: R1 LOG NUMBER: 329 USE: NEXT DATE: 8/16/79 ASSOCIATED EQUIPMENT INSTRUMENT IS NOW IN THE FIELD CHAMBERS: 00248 M633 173 00249 M228 X689 ADDRESS: 00250 M326 X938 00251 M70-5 382 JON FERRUOLO DIV OF OCCUPATIONAL HEALTH 206 CANNON BLDG 75 DAVIS ST PROVIDENCE, RI 02908 (401) 277-2438 FIGURE 1. A full screen display using formatting techniques with information from two files How to Use Screen Formatting Techniques The screen formatting commands under discussion are 'escape sequences' that is, they are made up of the 'escape' character (octal 033) and one or more following characters. The 'escape' character causes a fixed number of following characters to be interpreted as commands rather than displayed at the terminal. The number of characters so interpreted is determined by the command involved and by the type of terminal. The escapse sequences used are shown in Figure 2.a. for the VT-52 and 2.b. for the VT-100. Note that in general VT-52 commands use ASCII representations of octal numbers, while VT-100 commands use decimal numbers. Figure 2.a. COMMON SCREEN FORMATTING COMMANDS - VT-52 MODE COMMAND MEANING ESC(octal 033) This character forms the beginning of the screen formatting sequence. ESC A Cursor up 1 position ESC B Cursor down 1 position ESC C Cursor right 1 position ESC D Cursor left 1 position 31-A Figure 2a. Continued ESC H Cursor "home"(row 1, column 1) ESC J Clear screen from cursor to end of screen. ESCY a,b Place cursor at row a column b; where a is the ASCII representation of octal 040 thru 067 (SP thru 7) and b is the ASCII representation of octal 040 thru 157 (SP thru o). ESCY8 b Move cursor horizontally only to column b, where b is the ASCII representation of octal 040 thru 157 (SP thru o). Figure 2.b. COMMON SCREEN FORMATTING COMMANDS - VT-100 MODE COMMAND MEANING ESC (octal 033 These two characters form the beginning of most 133) screen formatting commands. ESC NA (where Move the cursor up N positions. If N is omitted, N is a decimal it defaults to 1. integer) ESC NB Move the cursor down N positions. ESC NC Move the cursor right N positions. ESC ND Move the cursor left N positions. ESC N;NH Move the cursor to row N column N. Either of these parameters defaults to 1. Thus ESC H moves the cursor to "home" position. ESC K or ESC OK Erase from cursor to end of line. ESC 1K Erase from beginning of line to cursor. ESC 2K Erase entire line containing cursor. ESC J or ESC 0J Erase from cursor to end of screen. ESC 1J Erase from beginning of screen to cursor. ESC 2J Erase entire screen NOTE: This command does not "home" the cursor. ESC#3 Change the cursor line to double height - top half. ESC#4 Change the cursor line to double height - bottom half. ESC#5 Change the cursor line to single width - single height. ESC#6 Change the cursor line to double width - single height. 31-B Entering the escape character causes problems on most terminals; in our experience it cannot be entered directly into a 'print' statement in an interactive 'DATATRIEVE' session. All of our DATATRIEVE procedures are built using indirect command files, so the 'escape' charater was simply installed in the indirect command file. [Syntax error--flushing input] DTR> PRINT "AAAAA" AAAAA DTR> PRINT " Unterminated quoted string [Syntax error--flushing input] DTR Figure 3. Entering an escape character in an interactive DATATRIEVE session DTR Z EDI TEST.CMD [CREATING NEW FILE] INPUT .ENABLE GLOBAL .ENABLE SUBSTITUTION .SETS ESC " " .SETS UP "'ESC'A" *ED [EXIT] PIP TI:=TEST.CMD .ENABLE CLOBAL .ENABLE SUBSTITUTION .SETS ESC " . .SETS UP "'ESC'A" Figure 4. Entering an "ESC" character directly from a terminal Since the 'escape' character does not seem to be directly typable on any of our terminals (vt-52, vt-100, la-36), and the status of NOESCSEQ did not seem to matter, a very short Fortran program was written to create a one line indirect command file containing the statement ".SETS ESC "(octal 033)". This may also be done using assembler language or any other language that provides for octal constants. 31-C Figure 5. FORTRAN program to create an indirect command file containing "ESC" BYTE ESC,QUOTE DATA ESC,QUOTE/"033,'"'/ CALL ASSIGN (2,'ESC.CMD',7) CALL FDBSET (2,'NEW') WRITE (2,001) QUOTE,ESC,QUOTE 001 FORMAT ('.SETS ESC ',3A1) CALL CLOSE(2) STOP END After the file is created, it may be expanded using EDI or EDT. The 'escape'character can be propagated throughout the procedure using the substitution feature of the indirect command file. In Figure 6.a., line 1 .ENABLE GLOBAL provides for symbol substitution to all levels of indirect command files invoked by this one. Line 2 provides for the substitution of any string for any symbol beginning and ending in single quotes. (See RSX-11M Operator's Procedures or MCR Operations for more details on indirect command file processing.) Line 3 names the temporary file which will be created for execution by DATATRIEVE. Line 4 executes a command file at our installation which sets UIC's and identifies certain terminals. Figure 6a. Beginning of indirect command file for screen formatting-VT52 .ENABLE GLOBAL .ENABLE SUBSTITUTION .SETS F "SCREEN3" .IFNDF $DEFER @GLOBAL .SETS ESC " " .SETS UP "'ESC'A" .SETS DOWN "'ESC'B" .SETS LEFT "'ESC'D" .SETS RIGHT "'ESC'C" .SETS HOME "'ESC'H" .SETS CLEAR "'HOME''ESC'J" .SETS ADDR "'ESC'Y" .SETS COLUMN "'ESC'Y8" 32-A FIGURE 6B. Beginning of indirect command file for screen formatting -VT100 .ENABLE GLOBAL .ENABLE SUBSTITUTION .SETS F "SCREEN3" .IFNDF $DEFER @GLOBAL .SETS ESC " " .SETS BESC "'ESC'[" .SETS UP "'BESC'A" .SETS DOWN "'BESC'B" .SETS LEFT "'BESC'D" .SETS RIGHT "'BESC'C" .SETS HOME "'BESC'H" .SETS CLEAR "'HOME''BESC'J" Line 5 is the line written by the FORTRAN program (Figure 5). At this point, everything that is absolutely necessary up to the beginning of the procedure file is present; however the next eight lines provide symbols for the common cursor movements, thus simplifying the coding of the DATATRIEVE procedure. Figure 6.b. shows a similar sequence in VT-100 mode. Note that the 'ADDR' and 'COLUMN' commands are not present; this is handled more directly in VT-100 mode using parameters in the cursor home and cursor right commands (Figure 2.b.). Next, the actual DATATRIEVE statements are added to the indirect command file. Figure 7a. A Complete indirect command file for very simple screen formatting - VT52 .ENABLE GLOBAL .ENABLE SUBSTITUTION .SETS F "SCREEN3" .IFNDF $DEFER @GLOBAL .SETS ESC " " .SETS UP "'ESC'A" .SETS DOWN "'ESC'B" .SETS LEFT "'ESC'D" .SETS RIGHT "'ESC'C" .SETS HOME "'ESC'H" .SETS CLEAR "'HOME''ESC'J" .SETS ADDR "'ESC'Y" .SETS COLUMN "'ESC'YB" .OPEN 'F''$DTR' .IFF $DEFER .DATA SET DICTIONARY '$UIC'INVENTORY .ENABLE DATA DELETE SCREEN3; DEFINE PROCEDURE SCREEN3 FIND DC IN CURRENT WITH EI EQ CURRENT.EI SELECT FIRST 32-B IF ET EQ "I" THEN FIND DT IN INVENTORY WITH AI=DC.EI ELSE IF ET EQ "T" THEN FIND DT IN INVENTORY WITH ATK=CD.EI ELSE FIND DT IN CONTROL WITH EI NE EI FIND DA IN ADDRESSES WITH AC EQ DC.AC FIND DC SELECT FIRST PRINT "'HOME'","'CLEAR'" PRINT "'UP''UP'","'COLUMN'9ASSOCIATED CHAMBERS:", "'UP''UP''UP'" FOR ALL OF DT PRINT "'COLUMN'Q",EI(-) RELEASE DA,DC,DT END-PROCEDURE; DEFINEP SCREEN3 1,UIC,[211*],"RWMEC" DEFINEP SCREEN3 2,UIC,[1,*]-"RWMEC" DEFINEP SCREEN3 3,UIC,[*,*],"R" DELETEP SCREEN3 4 .DISABLE DATA .ENABLE SUBSTITUTION .CLOSE .IFF $DEFER DTR 'F''$DTR' .IFF $DEFER PIP 'F''$DTR';*/DE Figure 7b. A complete indirect command file for very simple screen formatting - VT100 .ENABLE GLOBAL .ENABLE SUBSTITUTION .SETS F "SCREEN3" .IFNDF $DEFER @GLOBAL .SETS ESC " " .SETS BESC "'ESC'[" .SETS UP "'BESC'A" .SETS DOWN "'BESC'B" .SETS LEFT "'BESC'D" .SETS RIGHT "'BESC'C" .SETS HOME "'BESC'H" .SETS CLEAR "'BESC'2J" .OPEN 'F''$DTR' .IFF $DEFER .DATA SET DICTIONARY '$UIC'INVENTORY .ENABLE DATA DELETE SCREEN3-VT100; DEFINE PROCEDURE SCREEN3-VT100 FIND DC IN CURRENT WITH EI EQ CURRENT.EI 32-C Figure 7b. Continued SELECT FIRST IF ET EQ "I" THEN FIND DT IN INVENTORY WITH AI=DC.EI ELSE IF ET EQ "T" THEN FIND DT IN INVENTORY WITH ATK=DC.EI ELSE FIND DT IN CONTROL WITH EI NE EI FIND DA IN ADDRESSES WITH AC EQ DC.AC FIND DC SELECT FIRST PRINT "'HOME''CLEAR'" PRINT COL 02,"INSTRUMENT",EI(-) PRINT "'BESC'2A'BESC'3;26HASSOCIATED CHAMBERS:", "'BESC'2A" FOR ALL DT PRINT "'BESC'50C",EI(-) RELEASE DA,DC,DT END-PROCEDURE; DEFINEP SCREEN3-VT100 1,UIC,[211,*],"RWMEC" DEFINEP SCREEN3-VT100 2,UIC,[1,*],"RWMEC" DEFINEP SCREEN3-VT100 3,UIC,[*,*],"R" DELETEP SCREEN3-VT100 4 .DISABLE DATA .ENABLE SUBSTITUTION .CLOSE .IFF $DEFER DTR 'F''$DTR' .IFF $DEFER PIP 'F''$DTR';*/DE In Figure 7.a., the first 13 lines function as previously discussed. Line 14 creates the file named in line 3 above. Line 15 sets the proper DATATRIEVE dictionary. The DATA and .ENABLE DATA commands, (lines 15 and 16) cause the code to be written to the file created in line 14. The next 21 lines are DATATRIEVE statements which are also written to the .DTR file from line 14. Note the use of string substitution for the cursor control commands. The last 5 lines close the temporary file, execute DATATRIEVE to place this procedure in the DATATRIEVE dictionary, and delete the temporary file which contains the DATATRIEVE commands. Thus the procedure is created and catalogued simply by executing the main indirect command file ( XXX.CMD, where XXX is the name of the file shown in Figure 7.a.). Figure 7.b. shows the same procedure in VT-100 mode. Figure 8a. Indirect command file to produce a full screen format - VT52 mode .ENABLE GLOBAL .ENABLE SUBSTITUTION .SETS F "DISPLAY" .IFNDF $DEFER @GLOBAL .SETS ESC " " .SETS UP "'ESC'A" .SETS DOWN "'ESC'B" .SETS LEFT "'ESC'D" .SETS RIGHT "'ESC'C" .SETS LEFT "'ESC'D" .SETS HOME "'ESC'H" .SETS CLEAR "'HOME''ESC'J" .SETS ADDR "'ESC'Y" .SETS COLUMN "'ESC'YB" .OPEN 'F''$DTR' 32-D .IFF $DEFER .DATA SET DICTIONARY '$UIC'INVENTORY .ENABLE DATA DELETE DISPLAY: DEFINE PROCEDURE DISPLAY FIND DC IN CURRENT WITH EI EQ CURRENT.EI SELECT FIRST IF ET EQ "I" THEN FIND DT IN INVENTORY WITH AI=DC.EI ELSE IF ET EQ "T" THEN FIND DT IN INVENTORY WITH ATK=DC.EI ELSE FIND DT IN CONTROL WITH EI NE EI FIND DA IN ADDRESSES WITH AC EQ DC.AC FIND DC SELECT FIRST IF ET EQ "C" THEN PRINT "'CLEAR'", COL 02,"'UP'CHAMBER:",EI(-), SPACE 5,"MODEL:",MODEL(-), SPACE 1,"SERIAL:",SERIAL(-) ELSE IF ET EQ "I" THEN PRINT "'CLEAR'", COL 02,"'UP'INSTRUMENT:",EI(-), SPACE 5,"MODEL:",MODEL(-), SPACE 1,"SERIAL:",SERIAL(-) ELSE IF ET EQ "T" THEN PRINT "'CLEAR'", COL 02,"'UP'TEST KIT:",EI(-), SPACE 5,"MODEL:",MODEL(-), SPACE 1,"SERIAL:",SERIAL(-) ELSE IF ET EQ "X" THEN PRINT "'CLEAR'", COL 02,"'UP'CONTROL RECORD:",EI(-) ELSE PRINT "'CLEAR'", COL 02,"'UP'INVALID EQUIPMENT TYPE:",EI(-), COL 40,"TYPE:",ET(-) IF (ET EQ "C" OR ET EQ "I" OR ET EQ "T") AND FDA NE " " THEN PRINT SPACE 0, COL 01,"'ADDR' FDA NUMBER:",FDA(-), COL 01,"'ADDR;# " ELSE IF ET EQ "I" THEN PRINT SPACE 0, COL 01,"'ADDR'# 'UP'" ELSE IF ET NE "I" THEN PRINT SPACE 0, COL 01,"'ADDR"! " IF ET EQ "C" OR ET EQ "I" OR ET EQ "T" THEN PRINT SPACE 0. "'COLUMN'R'UP''UP''UP'", "PURCHASE DATE:",SPACE 5, PD-YMD.MONTH(-) USING Z9. 33-A Figure 8a. Continued SPACE 0,"/",SPACE 0, PD-YMD.DAY(-), SPACE 0,"/",SPACE 0, PD-YMD.YEAR(-), "'DOWN''DOWN'" IF ET EQ "C" OR ET EQ "I" OR ET EQ "T" THEN PRINT SPACE 0, "'COLUMN'R'UP''UP''UP'", "TRANSACTION DATE:".SPACE 2, LTD-YMD.MONTH(-) USING Z9, SPACE 0,"/",SPACE 0, LTD-YMD.DAY(-), SPACE 0,"/",SPACE 0, LTD-YMD.YEAR(-), "'DOWN''DOWN'" IF (ET EQ "C" OR ET EQ "I" OR ET EQ "T") AND RD NE 0 THEN PRINT SPACE 0. "'COLUMN'R'UP''UP''UP'", "RECALL DATE:",SPACE 7, RD-YMD.MONTH(-) USING Z9. SPACE 0,"/",SPACE 0, RD-YMD.DAY(-), SPACE 0,"/",SPACE 0, RD-YMD.YEAR(-), "'DOWN''DOWN'" PRINT SPACE 0, "'COLUMN'R'UP''UP''UP'", "TODAY''S DATE",SPACE 7, CONTROL.LTD-YMD.MONTH(-) USING Z9, SPACE 0,"/",SPACE 0, CONTROL.LTD-YMD.DAY(-), SPACE 0,"/",SPACE 0, CONTROL.LTD-YMD.YEAR(-) IF ET EQ "C" OR ET EQ "I" THEN BEGIN PRINT "'ADDR'& " PRINT "'COLUMN'!USAGE" PRINT "'COLUMN'! OWNER:",SPACE 9,OWNER(-) PRINT "'COLUMN'! USER:",SPACE 10,USER(-) IF SU EQ " " AND PU NE " " THEN PRINT "'COLUMN'! USE:",SPACE 11,PU(-) IF SU NE " " THEN PRINT "'COLUMN'! PRIMARY USE:",SPACE 3,PU(-) IF SU NE " " THEN PRINT "'COLUMN'! SECONDARY SUE:",SU(-) PRINT "'ADDR'& " PRINT "'COLUMN' TOTAL NUMBER:",NOC(-) IF NOC GT 0 AND ET EQ "C" THEN PRINT "'COLUMN' LATEST:",CF(-),SPACE 0,"-",SPACE 0,CN(-) IF MOC GT 0 AND ET EQ "I" THEN PRINT "'COLUMN' LATEST:",SPACE 4,CN(-) IF NOC GT 0 THEN PRINT "'COLUMN' DATE:",SPACE 4, CD-YMD.MONTH(-) USING Z9, SPACE 0,"/",SPACE 0, CD-YMD.DAY(-), SPACE 0,"/",SPACE 0, CD-YMD.YEAR(-) END 33-B IF ET EQ "T" THEN BEGIN PRINT "'ADDR'& " PRINT "'COLUMN'5USAGE" PRINT "'COLUMN'5 OWNER:",SPACE 9,OWNER(-) PRINT "'COLUMN'5 USER:",SPACE 10,USER(-) IF SU EQ " " AND PU NE " " THEN PRINT "'COLUMN'5 USER:",SPACE 11,PU(-) IF SU NE " " THEN PRINT "'COLUMN'5 PRIMARY USE:",SPACE 3,PU(-) IF SU NE " " THEN PRINT "'COLUMN'5 SECONDARY USE:",SU(-) END IF SLN NE O AND (ET EQ "C" OR ET EQ "I" OR ET EQ "T") THEN BEGIN PRINT "'ADDR'& " PRINT "'COLUMN'ZSHIPPING INFORMATION" PRINT "'COLUMN'Z SHIPPER:",SPACE 6,SHIPPER(-) PRINT "'COLUMN'Z LOG NUMBER:",SLN(-) PRINT "'COLUMN'Z DATE:",SPACE 4, SD-YMO.MONTH(-) USING Z9 SPACE O,"/",SPACE O. SD-YMD.DAY(-), SPACE 0,"/",SPACE 0, SD-YMD.YEAR(-) END IF ET EQ "C" AND STATION EQ O THEN PRINT "'ADDR'-Q", "CHAMBER IS NOW IN THE FIELD" IF ET EQ "C" AND STATION NE O THEN PRINT "'ADDR'-Q". "CHAMBER IS NOW AT STATION",STATION(-) IF ET EQ "I" AND STATION EQ O THEN PRINT "'ADDR'-N", "INSTRUMENT IS NOW IN THE FIELD" IF ET EQ "I" AND STATION NE O THEN PRINT "'ADDR'-N", "INSTRUMENT IS NOW AT STATION".STATION(-) IF ET EQ "T" AND STATION EQ O THEN PRINT "'ADDR'-P", "TEST KIT IS NOW IN THE FIELD" IF ET EQ "T" AND STATION NE O THEN PRINT "'ADDR'-P", "TEST KIT IS NOW AT STATION",STATION(-) IF ET EQ "C" AND NOW GT O THEN PRINT "'COLUMN'Q'UP'", "CHAMBER HAS HAD",SPACE O,NOR(-),"REPAIRS" IF ET EQ "I" AND NOR GT O THEN PRINT "'COLUMN'N'UP'", "INSTRUMENT HAS HAD",SPACE O,NOR(-),"REPAIRS" IF ET EQ "T" AND NOR GT O THEN PRINT "'COLUMN'P'UP'", "TEST KIT HAS HAD",SPACE O,NOR(-),"REPAIRS" IF ET EQ "I" AND CHAMBERS NE COUNT OF DT THEN PRINT "'COLUMN'N'UP'", "INSTRUMENT HAS INCORRECT'DOWN''COLUMN' NUMBER OF CHAMBERS" IF ET EQ "C" OR ET EQ "I" OR ET EQ "T" THEN IF CONTROL.EI NE COUNT OF DA THEN FOR DA BEGIN PRINT "'COLUMN'QADDRESSEE:" PRINT "'COLUMN'R",NAME(-) IF L1 NE " " THEN PRINT "'COLUMN'R",L1(-) IF L2 NE " " THEN PRINT "'COLUMN'R",L2(-) IF L3 NE " " THEN PRINT "'COLUMN'R",L3(-) IF L4 NE " " THEN PRINT "'COLUMN'R",L4(-) PRINT "'COLUMN'Y",ZIP(-) PRINT "'COLUMN'S(",SPACE O,AREA(-),SPACE O,")", -NUMBER USING 999-9999, "'COLUMN'A'UP''UP'" END 33-C Figure 8a. Continued IF ET EQ "C" OR ET EQ "I" OR ET EQ "T" THEN IF AI NE O OR ATK NE Q OR CONTROL.EI NE COUNT OF DT THEN BEGIN PRINT "'ADDR', " PRINT "'COLUMN'!ASSOCIATED EQUIPMENT" IF AI NE O THEN PRINT "'COLUMN'! INSTRUMENT: ",AI(-) IF ATK NE O THEN PRINT "'COLUMN'! TEST KIT: ",ATK(-) IF ET EQ "I" AND CONTROL.EI NE COUNT OF DT THEN PRINT "'COLUMN'! CHAMBERS:'UP''UP''UP'" IF ET EQ "T" AND CONTROL.EI NE COUNT OF DT THEN PRINT "'COLUMN'! INSTRUMENTS:'UP''UP''UP'" END IF CONTROL.EI GE (COUNT OF DT)-8 THEN BEGIN FOR FIRST 8 DT PRINT "'COLUMN'O'DOWN'",EI(-),SPACE 4,MODEL(-),SERIAL(-),"'UP'" END ELSE BEGIN FOR FIRST 7 DT PRINT "'COLUMN'O'DOWN'",EI(_),SPACE 4,MODEL(-),SERIAL(-),"'UP'" PRINT "'COLUMN'5'DOWN'",(COUNT OF DT)-7,"MORE'COLUMN'2...AND'UP'" END PRINT "'UP''UP'" RELEASE DA,DC,DT END-PROCEDURE: DEFINEP DISPLAY 1,UIC,[211,*],"RWMEC" DEFINEP DISPLAY 2,UIC,[1,*],"RWMEC" DEFINEP DISPLAY 3,UIC,[*'*],"R" DELETEP DISPLAY 4 .DISABLE DATA .ENABLE SUBSTITUTION .CLOSE .IFF $DEFER DTR 'F''$DTR' .IFF $DEFER PIP 'F''$DTR;*/DE Figure 8b. Indirect command file to produce a full screen format - VT100 mode .ENABLE GLOBAL .ENABLE SUBSTITUTION .SETS F "DISPLAY" .IFNDF $DEFER @GLOBAL .SETS ESC " " .SETS BESC "'ESC'[" .SETS UP "'BESC'A" .SETS DOWN "'BESC'B" .SETS LEFT "'BESC'D" .SETS RIGHT "'BESC'C" .SETS HOME "'BESC'H" .SETS CLEAR "'HOME''BESC'J" .OPEN 'F''$DTR' .IFF $DEFER .DATA SET DICTIONARY '$UIC'INVENTORY .ENABLE DATA DELETE DISP-VT100; DEFINE PROCEDURE DISP-VT100 FIND DC IN CURRENT WITH EI EQ CURRENT.EI 33-D SELECT FIRST IF ET EQ "I" THEN FIND DT IN INVENTORY WITH AI=DC.EI ELSE IF ET EQ "T" THEN FIND DT IN INVENTORY WITH ATK=CD.EI ELSE FIND DT IN CONTROL WITH EI NE EI FIND DA IN ADDRESSES WITH AC EQ DC.AC FIND DC SELECT FIRST IF ET EQ "C" THEN PRINT "'CLEAR'", COL 02,"'UP'CHAMBER:",EI(-), SPACE 5,"MODEL:",MODEL(-), SPACE 1,"SERIAL:",SERIAL(-) ELSE IF ET EQ "I" THEN PRINT "'CLEAR'", COL 02,"'UP'INSTRUMENT:",EI(-), SPACE 5,"MODEL:",MODEL(-), SPACE 1,"SERIAL:",SERIAL(-) ELSE IF ET EQ "T" THEN PRINT "'CLEAR'", COL 02,"'UP'TEST KIT:",EI(-), SPACE 5,"MODEL:",MODEL(-), SPACE 1,"SERIAL:",SERIAL(-) ELSE IF ET EQ "X" THEN PRINT "'CLEAR'", COL 02,"'UP'CONTROL RECORD:",EI(-) ELSE PRINT "'CLEAR'", COL 02,"'UP'INVALID EQUIPMENT TYPE:",EI(-), COL 40,"TYPE:",ET(-) IF (ET EQ "C" OR ET EQ "I" OR ET EQ "T") AND FDA NE " " THEN PRINT SPACE 0, COL 01,"'BESC'1;60HFDA NUMBER:"FDA(-), COL 01,"'BESC'4;1H" ELSE IF ET EQ "I" THEN PRINT SPACE O, COL 01,"'BESC'4;1H'UP'" ELSE IF ET NE "I" THEN PRINT SPACE O, COL 01,"'BESC'2;1H" IF ET EQ "C" ET EQ "I" OR ET E "T" THEN PRINT SPACE O, "'BESC'51C'UP''UP''UP'", "PURCHASE DATE:",SPACE 5, PD-YMD.MONTH(-) USING Z9, SPACE 0,"/",SPACE 0, PD-YMD.DAY(-), SPACE 0,"/",SPACE 0, PD-YMD.YEAR(-) "'DOWN''DOWN'" IF ET EQ "C" OR ET EQ "I" OR ET EQ "T" THEN PRINT SPACE O, "'BESC'51C'UP''UP''UP'", "TRANSACTION DATE::,SPACE 2, LTD-YMD.MONTH(-) USING Z9, SPACE 0,"/",SPACE 0, LTD-YMD.DAY(-), SPACE 0,"/",SPACE 0, LTD-YMD.YEAR(-) "'DOWN''DOWN IF (ET EQ "C" OR ET EQ "I" OR ET EQ "T") AND RD NE 0 THEN PRINT SPACE 0, "'BESC'51C'UP''UP''UP'", "RECALL DATE:",SPACE 7, RD-YMD.MONTH(-) USING Z9, SPACE 0,"/",SPACE 0, 34-A Figure 8b. Continued RD-YMD.DAY(-), SPACE 0,"/",SPACE 0, RD-YMD.YEAR(-), "'DOWN''DOWN'" PRINT SPACE 0, "'BESC'51C'UP''UP''UP'", "TODAY''S DATE",SPACE 7, CONTROL.LTD-YMD.MONTH(-) USING Z9, SPACE 0,"/",SPACE 0, CONTROL.LTD-YMD.DAY(-), SPACE 0,"/",SPACE 0, CONTROL.LTD-YMD.YEAR(-) IF ET EQ "C" OR ET EQ "I" THEN BEGIN PRINT "'BESC'7;1H" PRINT "'BESC'1CUSAGE" PRINT "'BESC'1C OWNER:",SPACE 9,OWNER(-) PRINT "'BESC'1C USER:",SPACE 10,USER(-) IF SU EQ " " AND PU NE " " THEN PRINT "'BESC'1C USE:",SPACE 11,PU(-) IF SU NE " " THEN PRINT "'BESC'1C PRIMARY USE:",SPACE 3,PU(-) IF SU NE " " THEN PRINT "'BESC'1C SECONDARY USE:",(-) PRINT "'BESC'7;1H" PRINT "'BESC'31CCALIBRATIONS" PRINT "'BESC'31C TOTAL NUMBER:",NOC(-) IF NOC GT 0 AND ET EQ "C" THEN PRINT "'BESC'31C LATEST:",CF(-),SPACE 0,"-",SPACE 0,CN(-) IF NOC GT 0 AND ET EQ "I" THEN PRINT "'BESC'31C LATEST:",SPACE 4,CN(-) IF NOC GT 0 THEN PRINT "'BESC'31C DATE:",SPACE 4, CD-YMD.MONTH(-) USING Z9, SPACE 0,"/",SPACE 0, CD-YMD.DAY(-), SPACE 0,"/",SPACE 0, CD-YMD.YEAR(-) END IF ET EQ "T" THEN BEGIN PRINT "'BESC'7;1H" PRINT "'BESC'22CUSAGE" PRINT "'BESC'22C OWNER:",SPACE 9,OWNER(-) PRINT "'BESC'22C USER:",SPACE 10,USER(-) IF SU EQ " " AND PU NE " " THEN PRINT "'BESC'22C USE:",SPACE 11,PU(-) IF SU NE " " THEN PRINT "'BESC'22C PRIMARY USE:",SPACE 3,PU(-) IF SU NE " " THEN PRINT "'BESC'22C SECONDARY USE:",(-) END IF SLN NE 0 AND (ET EQ "C" OR ET EQ "I" OR ET EQ "T") THEN BEGIN PRINT "'BESC'7;1H" PRINT "'BESC'59CSHIPPING INFORMATION" PRINT "'BESC'59C SHIPPER:",SPACE 6,SHIPPER(-) PRINT "'BESC'59C LOG NUMBER:",SLN(-) PRINT "'BESC'59C DATE:",SPACE 4, SD-YMD.MONTH(-), USING Z9, SPACE 0,"/",SPACE 0, SD-YMD.DAY(-), SPACE 0,"/",SPACE 0, SD-YMD.YEAR(-) END 34-B IF ET EQ "C" AND STATION EQ 0 THEN PRINT "'BESC'14;50H", "CHAMBER IS NOW IN THE FIELD" IF ET EQ "C" AND STATION NE 0 THEN PRINT "'BESC'14;50H, "CHAMBER IS NOW AT STATION".STATION(-) IF ET EQ "I" AND STATION EQ 0THEN PRINT "'BESC'14;47H", "INSTRUMENT IS NOW IN THE FIELD" IF ET EQ "I" AND STATION NE 0 THEN PRINT "'BESC'14;47H", "INSTRUMENT IS NOW AT STATION",STATION(-) IF ET EQ "T" AND STATION EQ 0 THEN PRINT "'BESC'14;49H", "TEST KIT IS NOW IN THE FIELD" IF ET EQ "T" AND STATION NE 0 THEN PRINT "'BESC'14;49H", "TEST KIT IS NOW AT STATION",STATION(-) IF ET EQ "C" AND NOR GT 0 THEN PRINT "'BESC'50C'UP'", "CHANBER HAS HAD",SPACE 0,NOR(-),"REPAIRS" IF ET EQ "I" AND NOR GT 0 THEN PRINT "'BESC'46C'UP'", "INSTRUMENT HAS HAD',SPACE 0,NOR(-),"REPAIRS" IF ET EQ "T" AND NOR GT 0 THEN PRINT "'BESC'49C'UP,", "TEST KIT HAS HAD", SPACE 0,NOR(-),"REPAIRS" IF ET EQ "I" AND CHAMBERS NE COUNT OF DT THEN PRINT "'BESC'47C'UP'", "INSTRUMENT HAS INCORRECT'DOWN''BESC'61CNUMBER OF CHAMBERS" IF ET EQ "C" OR ET EQ "I" OR ET EQ "T" THEN IF CONTROL.EI NE COUNT OF DA THEN FOR DA BEGIN PRINT "'BESC'48CADDRESSEE:" PRINT "'BESC'52C",NAME(-) IF L1 NE " " THEN PRINT "'BESC'52C",L1(-) IF L2 NE " " THEN PRINT "'BESC'52C",L2(-) IF L3 NE " " THEN PRINT "'BESC'52C",L3(-) IF L4 NE " " THEN PRINT "'BESC'52C",L4(-) PRINT "'BESC'58C",ZIP(-) PRINT "'BESC'52C(",SPACE O,AREA(-),SPACE O,")", -NUMBER USING 999-9999, "'BESC'34C'UP''UP'" END IF ET EQ "C" OR ET EQ "I" OR ET EQ "T" THEN IF AE NE 0 OR ATK NE 0 OR CONTROL.EI NE COUNT OF DT THEN BEGIN PRINT "'BESC'13:1H " PRINT "'BESC'1CASSOCIATED EQUIPMENT" IF AI NE 0 THEN PRINT "'BESC'1C INSTRUMENT: ",AI(-) IF ATK NE 0 THEN PRINT "'BESC'1C TEST KIT: ",ATK(-) IF ET EQ "I" AND CONTROL.EI NE COUNT OF DT THEN PRINT "'BESC'1C CHAMBERS:"'UP''UP''UP'" IF ET EQ "T" AND CONTROL.EI NE COUNT OF DT THEN PRINT "'BESC'1C INSTRUMENTS:'UP''UP''UP'" END IF CONTROL.EI GE (COUNT OF DT)-8 THEN BEGIN FOR FIRST 8 DT PRINT "'BESC'17C'DOWN'",EI(-),SPACE 4,MODEL(-),SERIAL(-),"'UP'" END ELSE BEGIN FOR FIRST 7 DT PRINT "BESC'17C'DOWN'",EI(-),SPACE 4,MODEL(-),SERIAL(-),"'UP'" PRINT "'BESC'22C'DOWN'",(COUNT OF DT)-7,"MORE'BESC'19C...AND'UP'" END PRINT "'UP''UP'" RELEASE DA,DC,DT END-PROCEDURE: 34-C Figure 8b. Continued DEFINEP DISP-VT100 1,UIC,[211.*],"RWMEC" DEFINEP DISP-VT100 2,UIC,[1.*],"RWMEC" DEFINEP DISP-VT100 3,UIC,[*,*],"R" DELETEP DISP-VT100 4 .DISABLE DATA .ENABLE SUBSTITUTION .CLOSE .IFF $DEFER DTR @'F''$DTR' .FF $DEFER PIP 'F''$DTR';*/DE Figures 8.a. and 8.b. show the procedures which created the screen shown in Figure 1, in VT-52 and VT-100 modes respectively. Information is displayed from 2 collections made from 2 different files. Use of most of the cursor control sequences is illustrated. Figure 9 Command file to create a screen using a VT100 special feature .ENABLE GLOBAL .ENABLE SUBSTITUTION .SETS F "SCREEN5" .IFNDF $DEFER @GLOBAL .SETS ESC " " .SETS BESC "'ESC' " .SETS UP "'BESC'A" .SETS DOWN "'BESC'B" .SETS LEFT "'BESC'D" .SETS RIGHT "'BESC'C" .SETS HOME "'BESC'H" .SETS CLEAR "'HOME''BESC'J" .OPEN 'F''$DTR' .IFF $DEFER .DATA SET DICTIONARY '$UIC'INVENTORY .ENABLE DATA DELETE SCREEN6-VT100; DEFINE PROCEDURE SCREEN6-VT100 FIND ADDR IN ADDRESSES WITH AC=*.ADDRESS-CODE SELECT FIND INS IN INVENTORY WITH ET="I" AND AC=ADDR.AC' PRINT "'BESC'H'BESC'J" PRINT "'BESC'2A" PRINT "'BESC'6CINSTRUMENTS AT THIS LOCATION'ESC'#3", "'BESC'4;7HINSTRUMENTS AT THIS LOCATION'ESC#4" PRINT "'BESC'8;3HADDRESS'ESE'#3'BESC'12CID'BESC'8CSERIAL', "BESC'9;3HADDRESS'ESC'#4'BESC'12CID'BESC'8CSERIAL" FOR ADDR BEGIN IF L1 NE " " THEN PRINT L1(-) IF L2 NE " " THEN PRINT L2(-) IF L3 NE " " THEN PRINT L3(-) IF L4 NE " " THEN PRINT L4(-) PRINT "'BESC'7C",ZIP(-) PRINT "'BESC'1C(",SPACE Q,AREA(-),SPACE 0,")", -NUMBER(-) USING 999-9999 END 34-D PRINT "'BESC'9;1H" FOR INS BEGIN PRINT "'BESC'40C",EI(-),"'BESC'15C",SERIAL(-) END PRINT "'BESC'58" END-PROCEDURE; DEFINEP SCREEN6-VT100 1,UIC,[211,*],"RWMEC" DEFINEP SCREEN6-VT100 2,UIC,[1,*],"RWMEC" DEFINEP SCREEN6-VT100 3,UIC,[*,*],"R" DEFINEP SCREEN6-VT1004 . .DISABLE DATA .ENABLE SUBSTITUTION .CLOSE .IFF $DEFER DTR @'F''$DTR' .IFF $DEFER PIP 'F''$DTR';/DE Figure 9 shows an indirect command file which creates a DATATRIEVE Procedure to utilize a VT-f100 special feature which creates double height double width characters. Note that unlike other VT-100 escape sequences, these begin with ESC # (033 043) rather than ESC . The screen created by this procedure is shown in Figure 10. INSTRUMENTS AT THIS LOCATION ADDRESS ID SERIAL RADIATION CONTROL PROGRAM 00098 354 l409 SMITH TOWER B-17-9 00160 617 SEATTLE, WA 00278 1443 98104 00675 1424 (901) 999-9999 01112 117343 01113 119420 04185 1559 00003 1421 Figure 10. A screen utilizing a VT100 special feature 35-A Figures 11 and 12 show a formatted data entry screen and the procedure which created it. Figure 11. A formatted data entry screen I N V E N T O R Y D A T A E N T R Y PROCEED AS PROMPTED...... Enter EI: 9050 Enter AC: 4R11 Enter MODEL: MDH Enter SERIAL: 3405 Enter OWNER: MPB Enter FDA-NUMBER: 12345 Enter USE: NEXT Enter SHIPPING DATE: 801007 DTR>- Figure 12. An indirect command file for a data entry screen .ENABLE GLOBAL .ENABLE SUBSTITUTION .SETS F "CRS" .SETS ESC " " .SETS UP "'ESC'A" .SETS DOWN "'ESC'B" .SETS LEFT "'ESC'D" .SETS RIGHT "'ESC'C" .SETS HOME "'ESC'H" .SETS CLEAR "'HOME''ESC'J" .SETS ADDR "'ESC'Y" .SETS COLUMN"'ESC'Y8" .IFNDF $DEFER @GLOBAL .OPEN 'F''$DTR' .IFF $DEFER .DATA SET DICTIONARY '$UIC'INVENTORY .ENABLE DATA 35-B DELETE CURSOR-STORE: DEFINE PROCEDURE CURSOR-STORE READY INVENTORY SHARED WRITE PRINT "'CLEAR'" PRINT COL 30,"I N V E N T O R Y" PRINT COL 30,"D A T A E N T R Y" PRINT "'DOWN''DOWN'" PRINT "PROCEED AS PROMPTED........." PRINT "'ADDR"**" STORE INVENTORY USING EI-*.EI THEN AC=*.AC THEN MODEL=*.MODEL THEN SERIAL=*.SERIAL THEN OWNER=*.OWNER THEN FDA-NUMBER=*.FDA-NUMBER THEN USE=*.USE THEN SHIPPING DATE=*.SHIPPING DATE END-PROCEDURE; DEFINEP CURSOR-STORE 1,UIC,[211,*],"RWMEC" (etc.) CONCLUSION Use of the above screen formatting and cursor manipulation techniques enhances the capabilities of the DATATRIEVE 'print' command. The examples given are by no means exhaustive, but simply attempt to provide ideas whereby others may develop their own applications. REFERENCES DEC Scope Users' Manual. Maynard, Massachusetts: Digital Equipment Corporation (1977). RSX-11M Operator's Procedures Manual. Maynard, Massachusetts: Digital Equipment Corporation (1977) VT-100 User Guide. Maynard, Massachusetts: Digital Equipment Corporation (1979). VT-100 Programming Reference Card. Maynard, Massachusetts: Digital Equipment Corporation (1979) 36 PROCESSING FORTRAN SEQUENTIAL (FCS) FILES USING DATATRIEVE November 1980 James M. McIntyre Battelle Northwest Laboratories Richland, Washington Some FORTRAN produced data files present problems to DATATRIEVE. If the file is formatted, one encounters problems with decimal points unless the DTR record definition uses PIC X, and math in DATATRIEVE can be complicated with PIC X fields. If the file is unformatted, the decimal points are no problem, but records longer than 126 bytes require special processing before they are accessable by DATATRIEVE. An understanding of the record structure of each file type is crucial before an attempt at creating a DATATRIEVE record definition is made. DATATRIEVE is used to process RMS-11 files. A fixed record length RMS-11 sequential file contains records of the same size and requires no RMS-11 overhead. Variable record length RMs-11 files may contain records of any length, up to a maximum stored as a file attribute. For each record, RMS-11 37 maintains a record-length field specifying the number of data bytes in the record. The size of this byte is a two-byte binary count that does not include the two bytes for the field. Each DATATRIEVE record definition for RMS-11 files contain a PICTURE string for each field (see YACHT record definition below). DEFINE RECORD YACHT USING 01 BOAT. 03 TYPE. 06 MANUFACTURER PIC X(10) QUERY-NAME IS BUILDER 06 MODEL PIC X(10). 03 SPECIFICATIONS QUERY-NAME SPECS. 06 RIG PIC X(10) VALID IF RIG EQ "SLOOP", "KETCH","MS","YAWL". 06 LENGTH-OVER-ALL PIC XXX VALID IF LOA BETWEEN 15 AND 50 QUERY-NAME IS LOA. 06 DISPLACEMENT PIC 99999 QUERY-HEADER IS "WEIGHT" EDIT-STRING IS ZZ,ZZ9 QUERY-NAME IS DISP. 06 BEAM PIC 99. 06 PRICE PIC 99999 VALID IF PRICE>DISP*1.3 OR PRICE EQ 0 EDIT-STRING IS $$$,$$$. ; 38 FORTRAN FORMATTED FILES FORTRAN sequential files are created by FCS-11, and as a result, differ in format from RMS-11 sequential files. A formatted FCS-11 file looks very much like an RMS-11 varying length sequential file. This type of file can contain records of any length, up to a maximum of 132 bytes (unless a MAXBUF option is otherwise specified). For each record, FCS-11 maintains a record-length field specifying the number of data bytes in the record. The size of this field is a two-byte binary count that does not include the two bytes for the field. Creating the DATATRIEVE record definition that corresponds to a formatted file requires treating each field as a character string and using the appropriate EDIT-STRING to display the values correctly. For example, assume a formatted file was created with a FORTRAN output statement as follows: WRITE 91,1000) A,B,C,I,M 1000 FORMAT (A2,F7.2,F3.1,12,14) The corresponding DATATRIEVE record definition would look like: DEFINE RECORD FORMAT USING 01 FORMAT-REC. 2 A PIC XX. 39 2 B PIC X(7) EDIT-STRING 9999.99. 2 C PIC XXX EDIT-STRING 9.9. 2 I PIC XX EDIT-STRING 99. 2 M PIC X(4) EDIT-STRING 9999. ; A word of caution is required! When printing the sum of two fields, an USING clause is needed in order to display the digits to the right of the decimal. For example: PRINT B+C USING 9999.99 Also, when using DATATRIEVE to STORE a record in a formated file, you must enter integer values following the format of the EDIT-STRING. For example, if the EDIT-STRING is 9999 and you wish to STORE a 3, then the value must be entered as 0003. If you fail to do this then DATATRIEVE will left justify the integer value in its field and will result in a strange number when printing the field. 40 FORTRAN UNFORMATTED FILES Unformatted sequetial files differ in format from formatted files. The records in an unformatted file are stored in buffers, with a maximum buffer size of 126 bytes. Each buffer contains a two-byte binary count field and a two-byte segment control field. The count field contains the length of the buffer that excludes the two bytes for the count field but includes the two bytes for the segment control field. The segment control field contains a code to indicate if the buffer is: CODE MEANING 1 the first buffer but not the last 3 the first and last buffer 0 not the first and not the last buffer 2 the last buffer for the record. You may use DATATRIEVE to process records from an unformatted file provided that each record is 126 bytes or less (including overhead). A record greater than 126 bytes will pose problems becuase RMS-11 does not understand the segment control field, and cannot append the buffers for each record. Creating the DATATRIEVE record definition that corresponds to an unformatted file with each record being 126 bytes or less (including the overhead) requires treating each field as a character, integer, real, etc., where appropriate. For example, assume an unformatted file was created with a FORTRAN output statement as follows: 41 WRITE (1) A,B,C,I,M where A=2 characters B=REAL*4 (99.99) C=REAL*4 (9.9) I=INTEGER*2 (99) and M=INTEGER*2 (9999). The corresponding DATATRIEVE record definition would look like the following: DEFINE RECORD UNFORMATTED USING 01 UNFORMATTED-REC. 2 SEGMENT USAGE INTEGER EDIT-STRING 9. 2 A PIC XX. 2 B USAGE REAL EDIT-STRING 99.99. 2 C USAGE REAL EDIT-STRING 9.9. 2 I USAGE INTEGER EDIT-STRING 99. 2 M USAGE INTEGER EDIT-STRING 9999. ; The SEGMENT field contains the segment control value which will always be a '3' for records with a length of 126 bytes or less (including overhead). To preserve the record structure of an unformatted file when adding a new record 42 via DATATRIEVE, you must assign a value of '3' to the SEGMENT field. It should be noted that in formatted files, the ASCII equivalent of the values are stored, whereas in unformatted files, the binary equivalent of the values are stored. This should clarify the reasoning behind the differences between the two example DATATRIEVE record definitions shown above. To use DATATRIEVE to process records from an unformatted file with record lengths greater than 126 bytes (including overhead), you must convert the unformatted file into a formatted file with a FORTRAN program. However, you can convert an unformatted file into a FORMATTED BINARY file by using the following FORTRAN program shown below: PROGRAM DTRCNV C------ PROGRAMMER: JAMES M. MCINTYRE C------ BATTELLE NORTWEST LABORATORIES C------ BOX 999 C------ RICHLAND, WA 99352 C------ (509) 375-2350 C------ MACHINE: PDP 11/70 WITH IAS C------ FORTRAN IV-PLUS C------ DESCRIPTION: THIS PROGRAM WILL CONVERT AN UNFORMATTED C------ BINARY FILE INTO A FIXED FORMAT BINARY FILE. C------ THE FORMATTED FILE CAN THEN BE HANDLED DIRECTLY C------ BY DATATRIEVE. THIS PROGRAM WILL CONVERT RECORDS UP C------ TO A MAXIMUM OF 500 BYTES, BUT CAN BE MODIFIED TO HANDLE C------ LARGER RECORDS. BYTE A(500),FILIN(40),FILOUT(40) C------ PROMPT FOR NAMES OF INPUT AND OUTPUT FILES. TYPE 1000 1000 FORMAT (' UNFORMATTED INPUT FILE NAME ? ',$) ACCEPT 2000, FILIN 2000 FORMAT (40A1) 43 FILING(40)=0 TYPE 3000 3000 FORMAT (' FORMATTED OUTPUT FILE NAME ? ',$) ACCEPT 2000, FILOUT FILOUT(40)=0 OPEN (UNIT=1,NAME=FILIN,TYPE='OLD',FORM='FORMATTED',DISP='SAVE') OPEN (UNIT=2,NAME=FILOUT,TYPE='NEW',FORM='FORMATTED',DISP='SAVE') C------ NOW READ IN BUFFER(S) FROM UNFORMATTED FILE AND APPEND ALL C------ BUFFER(S) FOR ONE RECORD TOGETHER AND WRITE THE APPENDED C------ BUFFER(S) TO THE FORMATTED FILE... C------ NOTE: NBYTES = THE LENGTH OF THE BUFFER NSEG = SEGMENT CONTROL BYTE WHERE 3 INDICATES THE 1ST -LAST BUFFER 1 INDICATES THE 1ST BUT NOT LAST BUFFER 0 INDICATES THE BUFFER IS NOT 1ST -NOT LAST 2 INDICATES THE LAST BUFFER NUM=1 NUM1=0 10 READ (1,4000,END=5000) NBYTES,NSEG,(A(J),J=NUM,NBYTES+NUM1-2) NUM=NUM+NBYTES-2 NUM1=NUM1+NBYTES-2 IF (NSEG .EQ. 3) GOTO 20 IF (NSEG .EQ. 1) GOTO 10 IF (NSEG .EQ. 0) GOTO 10 20 WRITE (2,4500) (A(J),J=1,NUM1) NUM=1 NUM1=0 GOTO 10 4000 FORMAT (Q,A2,2(250A1)) 4500 FORMAT (2(250A1)) 5000 CONTINUE CLOSE (UNIT=1) CLOSE (UNIT=2) STOP END This program will correctly append the buffers for each record from an unformatted file and write the resulting record to the formatted file while preserving the binary represnetation of the values. The DATATRIEVE record description for the formatted binary file follows the same rules for the unformatted file except you do not need the SEGMENT field. 44 Champion Papers Knightsbridge Champion International Corporation Hamilton, Ohio 45020 Technical Library Knightsbridge Dr. Hamilton, Ohio 45020 9/10/80 Chuck Watson Battelle Northwest Battelle Blvd. Richland, WA 99352 Dear Chuck: I am a newly accepted member of DECUS (#134972), and we have recently installed a PDP/11 system in our R7D Labs at this location. I have also submitted my name for membership in the DATATRIEVE-11 SIG. I have been asked to look into the feasability of using the PDP/11 for indexing and interactive retrieval of internal reports. I would appreciate very much any names you might be able to supply, and/or information on available software, program documentation, etc. Thanks very much for your time, and I hope to have the opportunity of meeting you in the future. Most sincerely, Paul F. Bryant Technical Librarian (513) 868-4578 45 CENTRO DE INFORMATICA Santiago, Sept. 22, 1980 C.I.-030 Mr. Chuck Watson Battelle Northwest Battelle Blvd. Richland, Wa. 99352 U. S. A. Ref.: DATATRIEVE-11 Dear Mr. Watson: I would like to have some information regarding DATATRIEVE-11 on technical matters as well as the comments received from the users. We request the above because our Digital software supplier does not have enough information as to make an economic evaluation against the convenience of getting this package. Awaiting your reply, we remain, Very truly yours, Rafael Mardones Saint-Jean 46 Editor, Datatrieve newsletter c/o DECUS One Iron Way MR2-3/E55 Marlboro MA17562 The enclosed material is probably of interest to all Datatrieve users on the VAX that also use Fortran. Bad luck I am not able to set aside the time to adapt it for PDP-11 but when Fortran 77 comes on the 11 it should not be to difficult to do so. I will submitt it to the Decus library when it has been upgraded to handle Fortran version 2 and datatrieve version 2(where I am ap present not sure if I will support all features of the hirarchial data structures ) If anyone wants to access it before then two ways are possible: l)it will be on the 1983 European Vax sig tape. 2)write a letter to me and I might send a floppy. THANK YOU for the WOMBAT EXAMINER. I have just received vol2 no 1 (the first I have seen). Its great. /Lars Palme/ Hassle 5-43183 Molndal Sweden 47 The HASSLE DTRFOR Package Version 1 June, 1980 DTRFOR GENERAL This package is meant to help the FORTRAN programmer to access files mapped for datatrieve. It is not meant as a replacement for datatrieve. The following is a description of the intended implementation. Not all by far is implemented at present. NOTE Those features or entrypoints marked % are not yet implemented. Points marked (77) are restrictions that probably will dissapear with FORTRAN version 2. 1.0 The record and domain compiler. The datatrieve definitions that are to be made available to FORTRAN must be in a command file. This file is then run through DTRDEF that produces a FORTRAN source code containing the necessary definitions. This is compiled and linked with your program in the normal manner. 2.0 The subroutines 2.1 General All arguments in the subroutines are character or integer. All global symbols starting in DTR$ are reserved by the package. The ISAM routines and the DISPLAY open routine are also pulled in by the package from HOTSLIB. Routines can be called in any logical order. 2.2 Files Files can be ISAM or sequential but THEY MUST BE OF FIXED RECORD LENGTH. Non isam files are opened as direct access files. 48 DTRFOR GENERAL 2.3 Return All routines return a standard system status code as the return value. se DTR$ERROR below. 2.4 Field names All field names mapped for the record in the DATATRIEVE recorddefinitions can be used including redifinition names. The special name "**" can be used to refer to the whole record. 2.5 Domains The domain names are those given in the datatrieve definitions. In DEFINE any unique character string can be used as domain name but the special domain "*" may has a special relevance. In contrast to other domains this will be redefined if used repetitevely and not produce a "Multiple domain error". The concept of FORTRAN unit numbers is used analogous to the DATATRIEVE domain concept. On a lun is opened a domain and the lun number is then used to refer to the domain. The lun can be any free lun number except 5 or 6. The maximum no of domains that be used simultaneously is a compilation option but is set to 10 in the standard version. 2.6 Current record. The FIND and GET operations establish a current record that can be updated or erased(ISAM file only). a record created by PUT or modified by MODIFY but written to file (see Hold off flag) can be deleted by a special call to ERASE and will then not be written to file. 2.7 Hold off flag To allow for the updating of several fields in a record there is defined a hold off flag. If this is zero on call to PUT or to MODIFY the record is not written to file but cept in core. Such a record will be written to file under the following 49 DTRFOR GENERAL circumstances: A new current record is created by calling GET or FIND A call to put with field equal to the whole recordsize is seen A close is performed on the current channel. 2.8 Field types The fields are typed as follows: 9 Numeric field (only 9 in DTR) 8 Alfanumeric 99 numeric with decimals(V or S seen BEWARE) <0 Group at level abs(type) 0-3 Corresponding COMP fields 2.9 Specific routines 2.9.1 DTR$READY - STATUS=DTR$READY(LUN,DOMAIN,MODE,RSIZ) LUN INTEGER Unit to perform io on Any fortran unit except 5 or 6 At most 10 may be used at once DOMAIN CHARACTER DTR domain name tabled by DTRDEF May be sequential or indexed but only 1 indexed file can be open at one time (77) MODE CHARACTER Access mode 'R'=read only 'w'=write 'A'=append RSIZ INTEGER Record size(output) An empty record filled with spaces or "0" is created. The legal combinations of operations and access modes are: (S=sequential files I=indexed) GET MOD PUT ERASE R ok no no no W ok ok ok I A no no ok no 50 DTRFOR Specific routines 2.9.2 DTR$GET STATUS=DTR$GET(LUN,MODE,FIELD, ANSWER, TYPE, SIZE, KEY, KEY-V,RECORD) LUN INTEGER Unit opened by READY MODE INTEGER 1=rewind file 0=Next record -1=Another field in same record FIELD CHARACTER Field name as per DTR ANSWER CHARACTER Return field TYPE INTEGER Type codes as above SIZE INTEGER Field size(output) KEY CHARACTER Key field name for compares KEY-V CHARACTER Value to compare with If KEY is non blank when mode=1 so is conditional accesses set up. The Named field is compared to KEY-V and the record only return if they correspond. If KEY names an index in the file so are the accesses done in index mode. The field is filled with spaces or zeroes if it is too short. RECORD INTEGER Record no for sequential files. Output on GET operations. If non-zero on calling it represents a record to retrieve. Using this the program can establish a collection of records. 2.9.4 DTR$CLOSE - STATUS=DTR$CLOSE(LUN) Release a lun from the DTR system. Closes the file. LUN = 0 can be used to release all domains. 51 DTRFOR Specific routines 2.9.5 DTR$MODIFY - STATUS=DTR$MODIFY(LUN,FIELD,VALUE,WRITE-FLAG) LUN INTEGER Unit number FIELD CHARACTER Field name to update VALUE CHARACTER To put in field, Filled as for the KEY field in GET if too short. FLAG INTEGER 0=do not write record now (written on CLOSE or GET) 1=write now There must be a current record to modify. 2.9.6 DIR$PUT - STATUS=DTR$PUT(LUN,FIELD,VALUE,WRITE-FLAG) all arguments as for MODIFY. 2.9.7 DTR$COPY - STATUS=DTR$COPY(LUN1,LUN2,WRITE-FLAG) This is equivalent to the sequence: STATUS=DTR$GET(LUN1,-1,"**",A,T,S," ","",R) IF(,NOT,STATUS)THEN GOTO ERROR STATUS-DTR$PUT(LUN2,"**",A(1:S),WRITE-FLAG) But much shorter and faster (only 1 move of the record) 2.9.8 DTR$ERASE - A) LUN>0 Only on ISAM files. There must be current record to erase. STATUS=DTR$ERASE(LUN) B)LUN<0 Erase a record that has been created by PUT or MODIFY but not written to file. Cannot give an error. STATUS=DTR$ERASE(-LUN) STATUS always returnd success 52 DRTFOR Specific routines 2.9.9 DTR$DEFINE - Often it is necessary to have a scratch file to work in. STATUS=DTR$DEFINE(DOMAIN,RECORD,FILE,TYPE,LUN) DOMAIN CHARACTER The name of the new domain. NB this definition is execute only and not saved. Name must be unique RECORD CHARACTER The name of the record to use.Must be defined by DTRDEF FILE CHARACTER File name for the new domain TYPE 'OLD' File must excist 'NEW' Created LUN a lun number A free lun number to open the file on if type ='NEW'. Else not used 2.9.10 DTR$RECORD - To use DTR$DEFINE the record name must be known. Sometimes that is difficult RECORD=DTR$RECORD(DOMAIN) will return the record name or blank if there is no such domain. RECORD,DTR$RECORD and DOMAIN must all be character variables. 2.9.11 DTR$ERROR - The DTRFOR status codes are in standard system format and can be tested as such. They will later be put into the system message file. at present so can the error text be retrieved by the DTR$ERROR function. CHARACTER*80 DTR$ERROR I=DTR$XXX( PRINT ()DTR$ERROR(I) will print the error message. If DTR$ERROR does not recognize the error it will can SYS$GETMSG to try if it is a system error code. 53 DTRFOR Specific routies Summary of entry points. STATUS=DTR$READY(LUN,DOMAIN,MODE,RSIZ) STATUS=DTR$GET(LUN,MODE,FIELD,ANSWER,TYPE,SIZE,KEY,KEY-V,RECORD) STATUS=DTR$FIND(LUN,MODE,KEY,KEY,V,RECORD) STATUS=DTR$CLOSE(LUN) STATUS=DTR$MODIFY(LUN,FIELD,VALUE,WRITE-FLAG) STATUS=DTR$PUT(LUN,FIELD,VALUE,WRITE-FLAG) STATUS=DTR$COPY(LUN1,LUN2,WRITE-FLAG) STATUS=DTR$ERASE(LUN) STATUS=DTR$DEFINE(DOMAIN,RECORD,FILE,TYPE,LUN) STATUS=DTR$(DOMAIN,RECORD,FILE,TYPE,LUN) RECORD=DTR$RECORD(DOMAIN) 3.0 Internals 3.1 Sizes and reconfiguring - TBS 3.1.1 Data areas - TBS 3.1.2 Parameters in parameter file - TBS 3.2 Error handling The errors passed to the caller are in standard system format some being DTRFOR specific errors (constructed with facility = FACILITY see parameters above) Internally the DTRFOR specific numbers are given in DTR$$ERROR These numbers are converted by a call to this subroutine into system error codes. The internal subroutines have one of two types of names depending on the type of error code they transmitt: DTR$-name The status code returned is the normal system status error code. DTR$$name The return is a nonstandard error code: Can be one of two types: 1 The return code is the internal error code and 0 is returned as OK. 2 The return is a value of some sort (eg DTR$$FIELD returns the number of a field) and 0 is returned for error.