1 !********************************************************************************************************************* ! ! ! P R O G R A M N A M E ! ! !********************************************************************************************************************* 3 ! Program : DTRWHIZ ! Revision : V3.0 17-MAY-1984 ! Programmer : John Kaufmann ! Releaser : Gene Belch ! Patcher : ! Patch releaser: VERSION$ = "V3.0 - DTR V2.x" 11 !********************************************************************************************************************* ! ! ! C O P Y R I G H T ! ! ! ! (C) Copyright 1984 ! Digital Equipment Corporation, Maynard, Massachusetts ! ! This software is furnished under a license for use only ! on a single computer system and may be copied only with ! the inclusion of the above copyright notice. This ! software, or any other copies thereof, may not be pro- ! vided or otherwise made available to any other person ! except for use of such system and to one who agrees to ! these license terms. Title to and ownership of the ! software shall at all times remain in DIGITAL. ! ! The information in this software is subject to change ! without notice and should not be construed as a commit- ! ment by Digital Equipment Corporation. ! ! DIGITAL assumes no responsibility for the use or relia- ! bility of its software on equipment that is not sup- ! plied by DIGITAL. ! !********************************************************************************************************************* 20 !********************************************************************************************************************* ! ! ! M O D I F I C A T I O N H I S T O R Y ! ! !********************************************************************************************************************* 30 ! REV REVISION DATE REASON ! --- -------- ---- ------ ! 3.0 17-MAY-1984 Update 100 !********************************************************************************************************************* ! ! ! P R O G R A M D E S C R I P T I O N ! ! ! D T R W H I Z - A data extraction utility which ! links VAX-11 Datatrieve to a variety of spreadsheets. ! This version supports DTR V2, but not completely; ! HELP / EDIT / etc not supported. Repeating groups cause ! a problem because DTRWHIZ looks for a null line as a ! record delimiter. ! !********************************************************************************************************************* 300 !********************************************************************************************************************* ! ! ! C H A N N E L A S S I G N M E N T S ! ! ! ! CHANNEL FILE NAME MAP NAME STATUS AT ENTRY/EXIT ! ------- --------- -------- -------------------- ! 1 temp work WORK closed / closed ! 2 data output closed / closed ! 5 command input closed / closed ! 6 batch input closed / closed ! !********************************************************************************************************************* 350 !********************************************************************************************************************* ! ! ! D A T A S T A T E M E N T S ! ! ! DATA statements begin at line 10010. ! !********************************************************************************************************************* 390 !********************************************************************************************************************** ! ! ! D I M E N S I O N S T A T E M E N T S ! ! !********************************************************************************************************************** DIM MAXLEN%(100), ! Maximum length of each Field & FLDNAM$(100), ! Field Names & OUT_NAME$(100), ! Output file names & OUT_TYPE%(100), ! Output file type & FSTAT%(100), ! Current status of each field & SS_CORNER%(100,2), ! For spreadsheets, location of Top/Left corner, by field & SS_NORM_ORIENT%(100), ! For spreadsheets, orientation of field (Default/Transposed) & SS_USE_HEADING%(100), ! For spreadsheets, whether or not headings are to be used & WHIZ_CAT$(25), ! List of tools supported by DTRWHIZ & WINDOW_DISPLAY$(24) ! Working array for displaying forms 400 !********************************************************************************************************************* ! ! ! V A R I A B L E S A N D A R R A Y S U S E D ! ! ! ! ! NAME DESCRIPTION ! ---- ----------- ! ! ERL Line in which error occurred ! ERN$ Set to the name of program where ! error occurred ! ERR Set to error after error ! !********************************************************************************************************************* TRUE% = -1% ! Logical value for TRUE FALSE% = 0% ! Logical value for FALSE ESC$ = CHR$(27) ! Escape character SEP$ = CHR$(9%) ! DECALC default separator char TAB$ = CHR$(9%) ! Tab character CLEAR$ = ESC$+"[H"+ESC$+"[J" ! Clear the screen DEOL$ = ESC$+"[K" ! Delete to End Of Line REV$ = ESC$+"[7m" ! Reverse video BOLD$ = ESC$+"[1m" ! Bold - only works if AVO option is installed NORM$ = ESC$+"[0m" ! Turn off video attributes BIGT$ = ESC$+"#3" ! Double height characters - TOP half BIGB$ = ESC$+"#4" ! Double height characters - BOTTOM half WIDE$ = ESC$+"#6" ! Double width characters GON$ = ESC$+"(0" ! Turn VT100 graphics ON GOFF$ = ESC$+"(B" ! Turn VT100 graphics OFF UP$ = ESC$+"[A" ! Reverse scroll B_LINE$=GON$+STRING$(80%,113%)+GOFF$ ! A line that runs the full width of the screen MSG_LINE%=24% ! Location of the 'Message Line' XALPHANU$ = STRING$(45%,0%) + ! For XLATE Function - Alpha-Numeric characters & "-" + & "." + & CHR$(0%) + & "0123456789" + & STRING$(7%,0%) + & "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + & STRING$(4%,0%) + & "_" + & CHR$(0%) + & "abcdefghijklmnopqrstuvwxyz" XNUMBER$ = STRING$(45%,0%) + ! For XLATE Function - Numbers including minus sign and decimal point & "-" + & "." + & CHR$(0%) + & "0123456789" JUST_NUMBER$ = STRING$(48%,0%) + "0123456789" ! For XLATE Function - Just numbers XQUOTE$ = STRING$(32%,0%) ! For XLATE Function - Turn an apostrophe into accent grave XQUOTE$ = XQUOTE$ + CHR$(I%) FOR I% = 32% TO 38% XQUOTE$ = XQUOTE$ + "`" XQUOTE$ = XQUOTE$ + CHR$(J%) FOR J% = 40% TO 127% XSS_CELL$ = STRING$(48%,0%) ! For XLATE Function - Valid characters for certain spread sheet & + "0123456789" ! cell names - 'A1', 'BB27', etc & + STRING$(7%,0%) & + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" MSG_LINE$ = FNA$(MSG_LINE%,1%) ! Cursor location for beginning of the message line SS_BEGIN% = FALSE% ! TRUE if creating a SpeadSheet data file INDTR% = FALSE% ! TRUE if DATATRIEVE is currently invoked CMDFILE% = FALSE% ! TRUE if input is coming from a command file BATCH_INPUT% = FALSE% ! TRUE if input coming from a batch file MENU% = FALSE% ! TRUE if in "NODEFAULT" mode HOW_MANY_OUT% = 0% ! Number of files created OUT_TYPE_KEY% = 0% ! Used to track what kind of files have bee created SS_MAX_ROW% = 254% ! Maximum rows in a spreadsheet SS_MAX_COL% = 63% ! Maximum columns in a spreadsheet WORK_FILE$ = "DW"+NUM1$(TIME(0%))+".TMP" ! Name of intermediate file MISS_VAL$ = "N/A" ! Initial missing data value MISS_FIX$ = "-0.001" ! Initial translation for missing data FIX_MISSING% = FALSE% ! Assume no missing data translation DECalc% = 1% ! These are the names of tools supported by DTRWHIZ Visicalc% = 2% MultiPlan% = 3% WHIZ_CAT$(DECalc%) = "DECalc" WHIZ_CAT$(Visicalc%) = "Visicalc" WHIZ_CAT$(MultiPlan%) = "MultiPlan" WORK_LENGTH% = 128% ! Maximum Field length BANNER2$ = FNA$(2%,1%)+B_LINE$+FNA$(23%,1%)+B_LINE$ ! Top line of display & + FNA$(1%,1%)+BOLD$+FNWIDE$(40%,"** DTR_WHIZ "+VERSION$+" **")+NORM$ BANNER1$ = CLEAR$ + BANNER2$ 650 !********************************************************************************************************************* ! ! ! M A P S T A T E M E N T S ! ! !********************************************************************************************************************* MAP (WORK) D_LINE$=128% ! I/O Buffer for the WORKFILE !********************************************************************************************************************* ! ! D A B - D A T A T R I E V E A C C E S S B L O C K I N F O R M A T I O N ! ! This is the facility through which DATATRIEVE communicates with DTRWHIZ ! !********************************************************************************************************************* MAP (ACCESSBLOCK) WORD DAB$W_BID, LONG DAB$L_CONDITION, & LONG DAB$A_MSG_BUF,WORD DAB$W_MSG_BUF_LEN, DAB$W_MSG_LEN, & LONG DAB$A_AUX_BUF,WORD DAB$W_AUX_BUF_LEN, DAB$W_AUX_LEN, & DAB$W_IDI, DAB$W_STATE, LONG DAB$L_FLAGS, DAB$L_OPTION, & WORD DAB$W_REC_LENGTH MAP (ACCESSBLOCK) STRING DAB = 100 DECLARE INTEGER CONSTANT DTR$K_STL_CMD = 1% , & DTR$K_STL_PRMPT = 2%, & DTR$K_STL_LINE = 3%, & DTR$K_STL_MSG = 4%, & DTR$K_STL_PGET = 5%, & DTR$K_STL_PPUT = 6%, & DTR$K_STL_CONT = 7% EXTERNAL INTEGER CONSTANT DTR$_SUCCESS COMMON(BUFFERS) MSG_BUFF$ = 80%, AUX_BUFF$ = 20% 800 !********************************************************************************************************************* ! ! S U B R O U T I N E S A N D F U N C T I O N S ! !--------------------------------------------------------------- ! * FUNCTIONS * ! *************** ! ! ! ! ! LINE NAME DESCRIPTION ! ---- ---- ----------- ! ! 15100 cursor addressing ! 15200 define window ! 15300 clear window ! 15400 cursor addressing in window ! 15500 double-height display ! 15600 double-width display ! 15700 display message ! 15800 spreadsheet validity ! 15900 return cell name ! 16000 max value ! 16100 min value ! 16200 pad line ! 17000 cell decoder ! !--------------------------------------------------------------- ! * SUBROUTINES * ! *************** ! ! ! LINE DESCRIPTION ! ---- ----------- ! ! 6000 spreadsheet routine ! 6200 specify format ! 6400 format menu ! 6500 select delimiter char ! 6600 select orientation ! 6700 select headings ! 6800 select top left corner ! 6900 data file output routine ! 7000 VISICALC output ! 7050 DECALC output ! 7100 MULTIPLAN output ! 7500 spawn VMS command ! 8100 unwind command ! !********************************************************************************************************************* 1000 !********************************************************************************************************************** ! ! ! M A I N P R O G R A M L O G I C ! ! !********************************************************************************************************************** 1010 ON ERROR GOTO 9000 ! set error handler FOO% = CTRLC ! Turn on the CTRL/C Trap 1100 !********************************************************************************************************************* ! ! INITIALIZE DATATRIEVE - AND GET STARTED ! !********************************************************************************************************************* IOPTION% = 0% ! DATATRIEVE INITIALIZATION PARAMATERS & + 1% ! NO SEMICOLON AT END OF COMMAND & + 32% ! PROMPT FOR COMMAND CONTINUATION CALL DTR$INIT (DAB BY REF, 100% BY REF, MSG_BUFF$,AUX_BUFF$,IOPTION% BY REF) WHILE (DAB$W_STATE = DTR$K_STL_MSG) OR (DAB$W_STATE = DTR$K_STL_LINE) IF DAB$L_CONDITION <> DTR$_SUCCESS & THEN PRINT EDIT$(MSG_BUFF$,128%) 1110 CALL DTR$CONTINUE (DAB BY REF) NEXT INDTR% = TRUE% ! MADE IT - We're now in DATATRIEVE PRINT BANNER1$;FNWINDOW$(3%,22%);W_BOT$; 1200 !********************************************************************************************************************* ! ! HERE'S WHERE THE ACTION STARTS ! !********************************************************************************************************************* ! ! DETERMINE WHICH MESSAGE TO POST ON THE MESSAGE LINE ! !********************************************************************************************************************* IF BATCH_INPUT% & THEN PRINT FNMSG$("BATCH MODE - ALL input from Batch File"); & ELSE IF CMDFILE% & THEN PRINT FNMSG$("Input from command file"); & ELSE PRINT FNMSG$("Enter DATATRIEVE commands:"); 1220 ! ! DETERMINE WHICH PROMPT TO DISPLAY ! IF EDIT$(MSG_BUFF$,38%) = "DTR>" & THEN PRINT "DTR_WHIZ>"; & ELSE PRINT "-----"+EDIT$(MSG_BUFF$,38%); 1260 ! ! GET A COMMAND FROM WHICH EVER SOURCE IS CURRENTLY ACTIVE ! IF BATCH_INPUT% & THEN LINPUT #6%, CMD$ & \ CMD$=EDIT$(CMD$,172%) ! Get rid of leading and trailing spaces and convert to upper case & \ PRINT " ";REV$;CMD$;NORM$ ! Display command line & & ELSE IF CMDFILE% & THEN LINPUT #5%, CMD$ & \ CMD$=EDIT$(CMD$,172%) & \ PRINT " ";REV$;CMD$;NORM$ & & ELSE LINPUT CMD$ & \ CMD$=EDIT$(CMD$,172%) 1300 ! ! SPAWN A SUB-PROCESS ! IF LEFT$(CMD$,3%) = "VMS" & THEN DCL$ = SEG$(CMD$,4%,LEN(CMD$)) & \ GOSUB 7500 & \ GOTO 1200 1320 ! ! USE 'DEFAULT' MODE ! IF LEFT$(CMD$,7%)="DEFAULT" & THEN MENU% = FALSE% & \ PRINT & \ PRINT BOLD$;"Default formats will be used.";NORM$ & \ PRINT & \ GOTO 1220 1340 ! ! NO DEFAULT MODE - USE MENU'S ! IF LEFT$(CMD$,9%)="NODEFAULT" & THEN MENU% = TRUE% & \ PRINT BOLD$ & \ PRINT "Formats will be determined interactively." & \ PRINT NORM$ & \ GOTO 1220 1360 !********************************************************************************************************************* ! ! TURN ON THE 'FIX_MISSING' FLAG - ANY FIELD = 'MISS_VAL$' WILL TAKE THE VALUE = 'MISS_FIX$' ! !********************************************************************************************************************* IF LEFT$(CMD$,10%)="FIXMISSING" & THEN FIX_MISSING% = TRUE% & \ PRINT BOLD$ & \ PRINT "Fields containing - '";MISS_VAL$;"'" & \ PRINT "will be changed to - '";MISS_FIX$;"'" & \ PRINT NORM$ & \ GOTO 1220 1380 ! ! TURN OFF THE 'FIX_MISSING' FLAG ! IF LEFT$(CMD$,12%)="NOFIXMISSING" & THEN FIX_MISSING% = FALSE% & \ PRINT BOLD$ & \ PRINT "Missing data values will be left UNCHANGED" & \ PRINT NORM$ & \ GOTO 1220 1400 ! ! ESTABLISH A NEW MISSING DATA VALUE ! IF LEFT$(CMD$,7%)="MISSVAL" & THEN MISS_VAL$ = SEG$(CMD$,9%,LEN(CMD$)) & \ PRINT BOLD$ & \ PRINT "Missing data is indicated by - '";MISS_VAL$;"'" & \ PRINT NORM$ & \ GOTO 1220 1420 ! ! ESTABLISH A NEW MISSING DATA REPLACEMENT VALUE ! IF LEFT$(CMD$,7%)="MISSFIX" & THEN MISS_FIX$ = SEG$(CMD$,9%,LEN(CMD$)) & \ PRINT BOLD$ & \ PRINT "If requested (via 'FIXMISSING') " & \ PRINT "Missing data will take the value - '";MISS_FIX$;"'" & \ PRINT NORM$ & \ GOTO 1220 1440 ! ! GET OUT - CTRL/Z WORKS ALSO ! IF LEFT$(CMD$,4%)="EXIT" & THEN GO TO 9990 1450 !********************************************************************************************************************* ! ! DTR EDIT is not supported ! !********************************************************************************************************************* IF LEFT$(CMD$,4%) = "EDIT" THEN PRINT REV$ PRINT "This DATATRIEVE Function is not supported in DTRWHIZ" PRINT NORM$ GOTO 1220 END IF 1500 ! ! GET READY FOR VISICALC ! IF LEFT$(CMD$,4%) = "VISI" & THEN CMD$ = "LIST "+SEG$(CMD$,5%,LEN(CMD$)) & \ SS_BEGIN% = TRUE% & \ WHICH_SS$ = "Visicalc" & \ WHICH_SS% = Visicalc% & \ DEF_TLC$ = "" !Top left is indicated via the cursor & \ MAX_SS_ROWS% = 255% & \ MAX_SS_COLS% = 63% & \ SS_EXTREME% = 255% & \ DEF_OUTPUT$ = "VISI.WHZ" & \ IF MENU% & THEN PRINT BOLD$ & \ PRINT "Mode reset to 'DEFAULT'" & \ PRINT "Processing continues " & \ PRINT NORM$ & \ MENU% = FALSE% 1520 ! ! GET READY FOR MULTIPLAN ! IF LEFT$(CMD$,9%) = "MULTIPLAN" & THEN CMD$ = "LIST "+SEG$(CMD$,10%,LEN(CMD$)) & \ SS_BEGIN% = TRUE% & \ WHICH_SS$ = "MultiPlan" & \ WHICH_SS% = MultiPlan% & \ DEF_TLC$ = "R1C1" & \ MAX_SS_ROW% = 255% & \ MAX_SS_COL% = 63% & \ SS_EXTREME% = 255% & \ DEF_OUTPUT$ = "MULTI.WHZ" 1540 ! ! GET READY FOR DECALC ! IF LEFT$(CMD$,6%) = "DECALC" & THEN CMD$ = "LIST "+SEG$(CMD$,8%,LEN(CMD$)) & \ SS_BEGIN% = TRUE% & \ WHICH_SS$ = "DECalc" & \ WHICH_SS% = DECalc% & \ DEF_TLC$ = "" !Top left is indicated via the cursor & \ MAX_SS_ROW% = 254% & \ MAX_SS_COL% = 63% & \ SS_EXTREME% = 254% & \ DEF_OUTPUT$ = "DECALC.TAB" & \ IF MENU% & THEN PRINT BOLD$ & \ PRINT "Mode reset to 'DEFAULT'" & \ PRINT "Processing continues " & \ PRINT NORM$ & \ MENU% = FALSE% 1600 ! ! COMMAND FILE - LOOK TO THE COMMAND FILE FOR ALL INPUT, EXCEPT THE QUALIFYING STUFF WHICH FOLLOWS A 'QUASI-COMMAND' ! IF LEFT$(CMD$,1%) = "@" & THEN CMDFILE$ = SEG$(CMD$,2%,LEN(CMD$)) & \ OPEN CMDFILE$ FOR INPUT AS FILE 5% & \ CMDFILE% = TRUE% & \ PRINT FNMSG$("Input from command file"); & \ IF BATCH_INPUT% & THEN WAS_BATCH% = TRUE% & \ BATCH_INPUT% = FALSE% & \ GOTO 1220 & ELSE GOTO 1220 1620 ! ! BATCH FILE - ALL INPUT, INCLUDING QUALIFYING STUFF, COMES FROM BATCH FILE ! IF LEFT$(CMD$,5%) = "BATCH" & THEN BATCH_FILE$ = EDIT$(SEG$(CMD$,6%,LEN(CMD$)),136%) & \ OPEN BATCH_FILE$ FOR INPUT AS FILE 6% & \ BATCH_INPUT% = TRUE% & \ PRINT FNMSG$("BATCH MODE - ALL input from Batch File"); & \ IF CMDFILE% & THEN WAS_CMD% = TRUE% & \ CMDFILE% = FALSE% & \ GOTO 1220 & ELSE GOTO 1220 1640 ! ! DTRWHIZ HELP ! IF LEFT$(CMD$,4%) = "HELP" & THEN GOSUB 5000 & \ GOTO 1200 2700 ! ! Finally DATATRIEVE gets the command ! CALL DTR$COMMAND (DAB BY REF,CMD$) IF EDIT_FLG% = 1% & THEN PRINT BANNER1$;FNWINDOW$(3%,22%);W_BOT$; & \ EDIT_FLG% = 2% 2750 ! ! FOR CALLABLE DATATRIEVE - DAB$W_STATE MUST BE WITHIN BOUNDS ! IF DAB$W_STATE < 1 & OR DAB$W_STATE > 9 & THEN PRINT BOLD$;"ERROR - INVALID STATE = ";NUM1$(DAB$W_STATE) & \ PRINT "MSG BUFF = ";EDIT$(MSG_BUFF$,128%) & \ PRINT "CONDITION = ";DAB$L_CONDITION;NORM$ & \ IF DAB$L_CONDITION = DTR$_SUCCESS & THEN GOTO 1220 & ELSE PRINT REV$;"UNABLE TO CONTINUE - SORRY";NORM$ & \ GOTO 9990 2800 ! ! STALL POINTS ! ON DAB$W_STATE GOTO 1220, ! COMMAND & 2820, ! PROMPT & 2830, ! LINE & 2840, ! MESSAGE & 2850, ! PGET & 2860, ! PPUT & 2870, ! CONTINUE & 2870, ! USER DEFINED KEYWORD & 2870 ! END OF USER DEFINED KEYWORD 2820 ! ! DTR$K_STL_PRMPT - PROMPT IN MSG_BUFF$ ! PRINT EDIT$(MSG_BUFF$,128%); IF BATCH_INPUT% & THEN LINPUT #6%, VALUE$ & \ PRINT " "; REV$; VALUE$; NORM$ & ELSE LINPUT VALUE$ 2825 CALL DTR$PUT_VALUE(DAB BY REF, VALUE$ BY DESC) GOTO 2800 2830 ! ! DTR$K_STL_LINE ! ! THIS IS ALSO THE JUMPING-OFF POINT FOR THE DATA EXTRACTION ! IF SS_BEGIN% ! ARE WE GOING TO A SPREAD SHEET & THEN GOSUB 3000 & \ SS_BEGIN% = FALSE% & \ GOTO 1200 & ELSE PRINT EDIT$(MSG_BUFF$,128%) ! NOTHING SPECIAL - JUST DATATRIEVE & \ GOTO 2870 2840 ! ! DTR$K_STL_MSG - MESSAGE IN MSG_BUFF$ ! IF DAB$L_CONDITION <> DTR$_SUCCESS & THEN PRINT EDIT$(MSG_BUFF$,128%) & \ GOTO 2870 & ELSE GOTO 2870 2850 ! ! DTR$K_STL_PGET - NOT SUPPORTED ! PRINT REV$ PRINT "This DATATRIEVE Function is not supported in DTRWHIZ" PRINT NORM$ GOTO 2990 2860 ! ! DTR$K_STL_PPUT - NOT SUPPORTED ! PRINT REV$ PRINT "This DATATRIEVE Function is not supported in DTRWHIZ" PRINT NORM$ GOTO 2990 2870 ! ! DTR$K_STL_CONT ! CALL DTR$CONTINUE (DAB BY REF) GOTO 2800 2990 CALL DTR$UNWIND (DAB BY REF) GOTO 2995 2995 CALL DTR$COMMAND (DAB BY REF,"") SS_BEGIN% = FALSE% GOTO 2800 3000 !********************************************************************************************************************* ! ! EXTRACT DATA FROM DATATRIEVE and STORE IT IN AN INTERMEDIATE REPOSITORY ! ! The data comes to us via the LIST command so the format is predefined. First there is a blank line, then each ! field in the first record is displayed (ie. FIELD NAME : FIELD VALUE). At the end of the first record, there ! is another blank line and the process is repeated for each record. NOTE that there is NO blank line after the ! LAST record. ! !********************************************************************************************************************* PRINT FNMSG$("Extracting requested data elements");W_BOT$ ESTATE%=1% ! Just starting, no data extracted yet CLOSE 1% OPEN WORK_FILE$ FOR OUTPUT AS FILE 1%, ! Use a relative file to accomplish transposition & ORGANIZATION RELATIVE FIXED, & MAP WORK, & TEMPORARY IF LEN(EDIT$(MSG_BUFF$,2%))<>0% ! Expecting a BLANK LINE & THEN PRINT BOLD$; & "SERIOUS ERROR - FIRST LINE SHOULD HAVE BEEN NULL" & \ PRINT "INSTEAD IT WAS - ";EDIT$(MSG_BUFF$,128%);NORM$ & \ GOSUB 8100 & \ GOTO 3990 3030 ESTATE% = 2% ! Found the first blank line, now ready to receive data FCOUNT% = 0% ! Field Count, used for each record FTOTAL% = 0% ! Total number of fields, set at the end of the first record RCOUNT% = 0% ! Total number of records delivered by DATATRIEVE MAT FSTAT% = ZER ! Status of the fields regarding TYPE MAT MAXLEN% = ZER ! The length of each FIELD NAME 3040 CALL DTR$CONTINUE (DAB BY REF) IF DAB$W_STATE = DTR$K_STL_CMD ! Are we at the end of the data? & THEN GOTO 3300 & ELSE IF DAB$W_STATE <> DTR$K_STL_LINE ! If it is a LINE STALL, we should have data & THEN IF (DAB$W_STATE = DTR$K_STL_MSG) ! If it is a MESSAGE & AND (DAB$L_CONDITION = DTR$_SUCCESS) ! then it better be SUCCESS & THEN GOTO 3040 ! in which case we go back for another line & ELSE PRINT BOLD$; & "LOST IT! State =";DAB$W_STATE & \ PRINT "MSG_BUFF$=";EDIT$(MSG_BUFF$,128%);NORM$ & \ GOSUB 8100 ! UNWIND the CURRENT COMMAND & \ GOTO 3990 3050 LINE$=EDIT$(MSG_BUFF$,128%) ! The data is in the MESSAGE BUFFER IF LEN(LINE$)=0% ! Null line indicates end of record & THEN IF ESTATE%=2% ! Is this the end of the FIRST RECORD? & THEN GOTO 3100 ! End of FIRST RECORD & ELSE GOTO 3200 ! End of record OTHER THAN FIRST 3060 COLON%=POS(LINE$,":",1%) ! Looking for the ':' in the data line IF COLON%=0% ! It's a bummer if it isn't there & THEN PRINT BOLD$; & "':' NOT FOUND";NORM$ & \ GOSUB 8100 ! UNDWIND the CURRENT COMMAND & \ GOTO 3990 ! GET BACK TO A CLEAN STATE 3070 FCOUNT%=FCOUNT%+1% ! We're OK now FLDNAM$=EDIT$(LEFT$(LINE$,COLON%-1%),2%) ! Capture the FIELD NAME IF ESTATE%=2% ! If we're on the FIRST RECORD & THEN FLDNAM$(FCOUNT%)=FLDNAM$ ! then store the name away 3080 FLDVAL$=EDIT$(SEG$(LINE$,COLON%+1%,LEN(LINE$)),136%) ! Capture the FIELD VALUE IF FIX_MISSING% ! If we're supposed to check for DATA REPAIR & THEN IF FLDVAL$ = MISS_VAL$ ! then if it's a match & THEN FLDVAL$ = MISS_FIX$ ! then fix it 3082 IF XLATE(FLDVAL$,XNUMBER$) = FLDVAL$ ! If the FIELD VALUE looks generally numeric & THEN FOO = VAL(FLDVAL$) ! then try it out for size, BASIC will tell & \ FLDVAL$ = NUM1$(FOO) ! us if we're OK or not & \ GOTO 3088 3084 IF FSTAT%(FCOUNT%) = 0% ! Come here as well if we failed the VAL() test & THEN FSTAT%(FCOUNT%) = -1% ! field to be an ALPHA, then count it in 3088 FLDLEN%=LEN(FLDVAL$) ! Record the MAXIMUM FIELD LENGTH IF FLDLEN% > MAXLEN%(FCOUNT%) & THEN MAXLEN%(FCOUNT%) = FLDLEN% 3090 D_LINE$ = LEFT$(FLDVAL$,WORK_LENGTH%) ! Create a data record, if too long, truncate PUT #1% ! Store it away GOTO 3040 3100 !********************************************************************************************************************* ! ! FIRST TIME AT END OF THE DATATRIEVE RECORD ! ! We now know how many Fields there are ! !********************************************************************************************************************* FTOTAL% = FCOUNT% FCOUNT% = 0% ESTATE% = 3% RCOUNT% = 1% GOTO 3040 ! Go get another DATATRIEVE RECORD 3200 !********************************************************************************************************************* ! ! END OF RECORD, NOT FIRST TIME ! !********************************************************************************************************************* IF FCOUNT% <> FTOTAL% ! We better have the same number of fields & THEN PRINT BOLD$; ! each time through & "LOOKING FOR"; FTOTAL%; " FIELDS - FOUND"; FCOUNT%; NORM$ ! otherwise it's a bummer & \ GOSUB 8100 ! Unwind & \ GOTO 3990 ! Get to a clean state & ELSE RCOUNT% = RCOUNT% + 1% ! Otherwise chalk up another one \ FCOUNT% = 0% 3299 GOTO 3040 ! And back we go for another DTR RECORD 3300 !********************************************************************************************************************* ! ! FIRST PASS THROUGH THE DATA IS COMPLETE, IT'S ALL CATALOGUED AND WE'RE READY FOR ACTION ! ! Ready to re-format the data for use in whatever has been requested. ! But first, since we got here because DATATRIEVE discovered we were at the end of the data before we ! saw a null line, our record count is off by one. Add one to top it off. ! !********************************************************************************************************************* IF ESTATE%=2% !Still on first record & THEN FTOTAL%=FCOUNT% END IF ESTATE%=3% RCOUNT%=RCOUNT%+1% IF SS_BEGIN% ! If we're working on a SPREAD SHEET & THEN GOSUB 6000 ! then go deal with it & \ GOTO 3990 3990 !********************************************************************************************************************* ! ! ALL DONE CREATING THE OUTPUT FILE(s) - ROLL DOWN TO A 'CLEAN STATE' IN DATATRIEVE ! !********************************************************************************************************************* WHILE (DAB$W_STATE = DTR$K_STL_MSG) OR (DAB$W_STATE = DTR$K_STL_LINE) IF DAB$L_CONDITION <> DTR$_SUCCESS & THEN PRINT EDIT$(MSG_BUFF$,128%) 3995 CALL DTR$CONTINUE (DAB BY REF) NEXT 3999 PRINT W_BOT$ RETURN 5000 !********************************************************************************************************************* ! ! H E L P T E X T P R O C E S S O R - D T R W H I Z O N L Y ! !********************************************************************************************************************* PRINT FNMSG$("DTRWHIZ - HELP");W_BOT$ TOP_OF_HELP_PAGE% = TRUE% 5050 READ HELP_LINE$ IF LEFT$(HELP_LINE$,1%) <> "|" & THEN GOTO 5100 & ELSE TOP_OF_HELP_PAGE% = TRUE% & \ PRINT W_BOT$; & \ PRINT BOLD$;"Press for more";NORM$; & " ";BOLD$;"'T' to start again";NORM$; & " ";BOLD$;"'Q' to quit";NORM$;" "; & \ IF BATCH_INPUT% & THEN LINPUT #6%, RESP$ & \ PRINT " ";REV$;RESP$;NORM$ & ELSE LINPUT RESP$ 5060 RESP$=LEFT$(EDIT$(RESP$,40%),1%) IF RESP$ = "T" & THEN RESTORE & \ TOP_OF_HELP_PAGE% = TRUE% & \ PRINT & \ GOTO 5050 & ELSE IF RESP$ = "Q" & THEN GOTO 5190 & ELSE PRINT FNA$(BOT%-1%,1%);DEOL$ & \ GOTO 5050 5090 PRINT W_BOT$; PRINT BOLD$;"END OF HELP";NORM$; & " ";BOLD$;"Enter 'T' to start again";NORM$; & " ";BOLD$;"'Q' to quit";NORM$;" "; IF BATCH_INPUT% & THEN LINPUT #6%,RESP$ & \ PRINT " ";REV$;RESP$;NORM$ & ELSE LINPUT RESP$ 5091 RESP$=LEFT$(EDIT$(RESP$,40%),1%) IF RESP$ = "T" & THEN RESTORE & \ TOP_OF_HELP_PAGE% = TRUE% & \ PRINT & \ GOTO 5050 & ELSE GOTO 5190 5100 P% = 0% IF TOP_OF_HELP_PAGE% & THEN PRINT FNWC$(0%);W_TOP$; & \ TOP_OF_HELP_PAGE% = FALSE% 5110 P% = POS(HELP_LINE$,"{",P%) IF P% > 0% & THEN HELP_LINE$ = LEFT$(HELP_LINE$,P%-1%) + REV$ + SEG$(HELP_LINE$,P%+1%,LEN(HELP_LINE$)) & \ GOTO 5110 5120 P% = POS(HELP_LINE$,"}",P%) IF P% > 0% & THEN HELP_LINE$ = LEFT$(HELP_LINE$,P%-1%) + NORM$ + SEG$(HELP_LINE$,P%+1%,LEN(HELP_LINE$)) & \ GOTO 5120 5130 PRINT HELP_LINE$;NORM$ GOTO 5050 5190 PRINT FNA$(BOT%-1%,1%);DEOL$ RESTORE RETURN 6000 !********************************************************************************************************************* ! ! B U I L D A S P R E A D S H E E T D A T A F I L E ! !********************************************************************************************************************* PRINT FNMSG$("Converting data to "+WHICH_SS$+" format");W_BOT$ ABORT% = FALSE% IF (WHICH_SS% = DECalc%) THEN !DECALC table file RESP2$ = "" !For sub 6700 GOSUB 6700 !Use headings? SS_USE_HEADING%(J%) = SS_HEADING% FOR J% = 1% TO FTOTAL% GOSUB 6500 !table file sep char GOSUB 6900 !ouput file GOTO 6399 END IF IF (WHICH_SS% = Visicalc%) THEN !VISICALC file RESP2$ = "" !For sub 6700 GOSUB 6700 !Use headings? SS_USE_HEADING%(J%) = SS_HEADING% FOR J% = 1% TO FTOTAL% GOSUB 6900 !ouput file GOTO 6399 END IF IF MENU% & THEN GOTO 6100 & & ELSE SS_LUMP% = TRUE% & \ GOSUB 6600 ! GET ORIENTATION & \ IF ABORT% & THEN GOTO 6399 & & ELSE SS_NORM_ORIENT%(J%) = SS_ORIENT% FOR J% = 1% TO FTOTAL% & \ GOSUB 6700 ! USE HEADINGS ? & \ IF ABORT% & THEN GOTO 6000 & & ELSE SS_USE_HEADING%(J%) = SS_HEADING% FOR J% = 1% TO FTOTAL% & \ GOSUB 6800 ! GET UPPER-LEFT CORNER & \ IF ABORT% & THEN GOTO 6000 & & ELSE IF SS_ORIENT% & THEN FOR J% = 1% TO FTOTAL% ! DEFAULT ORIENTATION & \ SS_CORNER%(J%,1%) = SS_FIRST_ROW% & \ SS_CORNER%(J%,2%) = SS_FIRST_COL% + J% - 1% & \ NEXT J% & \ GOSUB 6900 ! Get output file name and do output & \ IF ABORT% & THEN GOTO 6000 ! Start again & & ELSE GOTO 6399 ! Done & & ELSE FOR J% = 1% TO FTOTAL% ! TRANSPOSED ORIENTATION & \ SS_CORNER%(J%,1%) = SS_FIRST_ROW% + J% - 1% & \ SS_CORNER%(J%,2%) = SS_FIRST_COL% & \ NEXT J% & \ GOSUB 6900 ! Get output file name and do output & \ IF ABORT% & THEN GOTO 6000 ! Start again & & ELSE GOTO 6399 ! Done 6100 !********************************************************************************************************************* ! ! M E N U S E C T I O N F O R S P R E A D S H E E T ! !********************************************************************************************************************* ABORT% = FALSE% WINDOW_DISPLAY$(1%) = " Establishing the SPREAD SHEET format" WINDOW_DISPLAY$(2%) = "" WINDOW_DISPLAY$(3%) = " Options are: A - Treat the FIELDS and RECORDS as a single" WINDOW_DISPLAY$(4%) = " group of contiguous ROWS and COLUMNS." WINDOW_DISPLAY$(5%) = "" WINDOW_DISPLAY$(6%) = " B - Specify the format for each FIELD separately." WINDOW_DISPLAY$(7%) = "" WINDOW_DISPLAY$(8%) = " Q - ABORT" WINDOW_DISPLAY$(9%) = B_LINE$ PRINT FNWINDOW$(3%,22%);FNWC$(9%); PRINT FNWINDOW$(12%,22%);W_TOP$; 6115 PRINT " Enter the desired option"; IF BATCH_INPUT% & THEN LINPUT #6%,RESP$ & \ PRINT " ";REV$;RESP$;NORM$ & ELSE LINPUT RESP$ 6116 RESP% = POS("ABQ",LEFT$(EDIT$(RESP$,34%),1%),1%) IF RESP% = 0% & THEN PRINT & \ PRINT "INVALID - Valid options are: 'A' or 'B' or 'Q'" & \ PRINT & \ GOTO 6115 6120 ON RESP% GOTO 6125, & 6200, & 6390 6125 !********************************************************************************************************************* ! ! T R E A T T H E D A T A A S A C O N T I G U O U S B L O C K ! !********************************************************************************************************************* SS_LUMP% = TRUE% GOSUB 6400 ! TOP PART OF MENU GOSUB 6600 ! GET ORIENTATION IF ABORT% & THEN GOTO 6100 & ELSE SS_NORM_ORIENT%(J%) = SS_ORIENT% FOR J% = 1% TO FTOTAL% & \ GOSUB 6700 ! USE HEADINGS ? & \ IF ABORT% & THEN GOTO 6100 & ELSE SS_USE_HEADING%(J%) = SS_HEADING% FOR J% = 1% TO FTOTAL% & \ GOSUB 6800 ! GET UPPER-LEFT CORNER & \ IF ABORT% & THEN GOTO 6100 & ELSE IF SS_ORIENT% & THEN FOR J% = 1% TO FTOTAL% ! DEFAULT ORIENTATION & \ SS_CORNER%(J%,1%) = SS_FIRST_ROW% & \ SS_CORNER%(J%,2%) = SS_FIRST_COL% + J% - 1% & \ NEXT J% & ELSE FOR J% = 1% TO FTOTAL% ! TRANSPOSED ORIENTATION & \ SS_CORNER%(J%,1%) = SS_FIRST_ROW% + J% - 1% & \ SS_CORNER%(J%,2%) = SS_FIRST_COL% & \ NEXT J% & 6150 GOSUB 6900 ! CREATE OUTPUT FILE IF ABORT% & THEN GOTO 6000 & ELSE GOTO 6399 6200 !********************************************************************************************************************* & ! & ! SPECIFY THE FORMAT INDIVIDUALLY & ! & !********************************************************************************************************************* & SS_LUMP% = FALSE% GOSUB 6400 ! TOP OF MENU FOR J_FIELD% = 1% TO FTOTAL% PRINT FNA$(11%,1%);DEOL$; PRINT FNA$(11%,10%);"For field - ";REV$;" ";FLDNAM$(J_FIELD%);" ";NORM$ GOSUB 6600 IF ABORT% & THEN GOTO 6100 & ELSE GOSUB 6700 & \ IF ABORT% & THEN GOTO 6100 & ELSE GOSUB 6800 & \ IF ABORT% & THEN GOTO 6100 & ELSE SS_NORM_ORIENT%(J_FIELD%) = SS_ORIENT% & \ SS_USE_HEADING%(J_FIELD%) = SS_HEADING% & \ SS_CORNER%(J_FIELD%,1%) = SS_FIRST_ROW% & \ SS_CORNER%(J_FIELD%,2%) = SS_FIRST_COL% & 6265 NEXT J_FIELD% GOSUB 6900 IF ABORT% & THEN GOTO 6000 & ELSE GOTO 6399 6390 ABORT% = TRUE% PRINT W_BOT$ PRINT BOLD$;WHICH_SS$;" data file creation ABORTED";NORM$ 6399 PRINT FNWINDOW$(3%,22%);W_BOT$ RETURN 6400 !********************************************************************************************************************* & ! & ! D I S P L A Y S P R E A D S H E E T F O R M A T M E N U & ! & !********************************************************************************************************************* & WINDOW_DISPLAY$(1%) = " SPREAD SHEET FORMAT CATAGORIES - Type CTRL/Z to ABORT" WINDOW_DISPLAY$(2%) = "" WINDOW_DISPLAY$(3%) = " ORIENTATION - Enter: A = NORMAL B = TRANSPOSED" WINDOW_DISPLAY$(4%) = "" WINDOW_DISPLAY$(5%) = " HEADINGS - Enter: A = USE HEADINGS B = NO HEADINGS" WINDOW_DISPLAY$(6%) = "" WINDOW_DISPLAY$(7%) = " CORNER - Enter: Location of the TOP-LEFT CORNER" WINDOW_DISPLAY$(8%) = "" WINDOW_DISPLAY$(9%) = "" WINDOW_DISPLAY$(10%) = B_LINE$ PRINT FNWINDOW$(3%,22%);FNWC$(10%); PRINT FNWINDOW$(13%,22%);W_BOT$; OPT1$ = FNA$(5%,6%)+" ORIENTATION "+ & FNA$(5%,29%)+" A "+ & FNA$(5%,48%)+" B " OPT2$ = FNA$(7%,6%)+" HEADINGS "+ & FNA$(7%,29%)+" A "+ & FNA$(7%,48%)+" B " OPT3$ = FNA$(9%,6%)+" CORNER " RETURN 6500 !********************************************************************************************************************* & ! & ! S E L E C T D E C A L C T A B L E S E P A R A T O R C H A R A C T E R & ! & !********************************************************************************************************************* & PRINT "" PRINT "" PRINT "Enter the DECalc TABLE FILE DELIMITER CHARACTER "; IF BATCH_INPUT% THEN LINPUT #6%, TEMP$ ELSE LINPUT TEMP$ END IF IF TEMP$ <> "" THEN SEP$ = LEFT$(TEMP$,1%) END IF RETURN 6600 !********************************************************************************************************************* & ! & ! S P E C I F Y S P R E A D S H E E T O R I E N T A T I O N & ! & !********************************************************************************************************************* & RESP1$ = "" RESP2$ = "" RESP3$ = "" IF MENU% & THEN PRINT REV$;OPT1$;NORM$;W_BOT$; & \ PRINT "Enter ORIENTATION choice"; & & ELSE PRINT & \ PRINT "For ORIENTATION, enter 'A' for NORMAL, 'B' for TRANSPOSED, 'H' for HELP"; & 6605 IF BATCH_INPUT% & THEN LINPUT #6%,RESP1$ & \ PRINT " ";REV$;RESP1$;NORM$ & ELSE LINPUT RESP1$ 6610 RESP1$ = EDIT$(RESP1$,38%) IF LEFT$(RESP1$,1%) = "H" & THEN PRINT & \ PRINT " With NORMAL ORIENTATION the FIELDS go across the COLUMNS while" & \ PRINT " the RECORDS go down the ROWS and the spread sheet will look" & \ PRINT " like the results of a normal DATATRIEVE PRINT command." & \ PRINT & \ PRINT " With TRANSPOSED ORIENTATION the RECORDS go across the COLUMNS" & \ PRINT " and the FIELDS go down the ROWS." & \ PRINT & \ RESP1$ = "" & \ GOTO 6600 & & ELSE C% = POS(RESP1$,",",1%) & \ IF C% > 0% & THEN RESP2$ = SEG$(RESP1$,C%+1%,LEN(RESP1$)) & \ RESP1$ = LEFT$(RESP1$,C%-1%) & \ C% = POS(RESP2$,",",1%) & \ IF C% = 0% & THEN RESP3$ = SEG$(RESP2$,C%+1%,LEN(RESP2$)) & \ RESP2$ = LEFT$(RESP2$,C%-1%) 6625 IF RESP1$ = "A" & THEN SS_ORIENT% = TRUE% & \ GOTO 6690 & & ELSE IF RESP1$ = "B" & THEN SS_ORIENT% = FALSE% & \ GOTO 6690 & & ELSE PRINT BOLD$ & \ PRINT "INVALID - Valid responses are 'A' or 'B' or 'H'" & \ PRINT NORM$ & \ GOTO 6600 6690 IF MENU% & THEN PRINT OPT1$;W_BOT$ 6699 RETURN 6700 !********************************************************************************************************************* & ! & ! U S E H E A D I N G S ? & ! & !********************************************************************************************************************* & IF MENU% & THEN PRINT REV$;OPT2$;NORM$;W_BOT$; 6705 IF LEN(RESP2$) > 0% & THEN GOTO 6713 6710 IF MENU% & THEN PRINT "Enter HEADING choice"; & & ELSE PRINT & \ PRINT "Enter 'A' to USE HEADINGS, 'B' to NOT USE HEADINGS, 'H' for HELP"; 6712 IF BATCH_INPUT% & THEN LINPUT #6%, RESP2$ & \ PRINT " ";REV$;RESP2$;NORM$ & & ELSE LINPUT RESP2$ 6713 RESP2$ = EDIT$(RESP2$,38%) IF LEFT$(RESP2$,1%) = "H" & THEN PRINT & \ PRINT " If HEADINGS are USED then the FIELD NAMES will be included in" & \ PRINT " the spread sheet as headings. For NORMAL ORIENTATION the" & \ PRINT " headings will be at the top of the columns with one blank" & \ PRINT " cell between the heading and the first record. For TRANSPOSED" & \ PRINT " ORIENTATION the headings will be in the left-most column." & \ PRINT & \ RESP2$ = "" & \ GOTO 6710 & & ELSE IF RESP2$ = "A" & THEN SS_HEADING% = TRUE% & \ GOTO 6790 & & ELSE IF RESP2$ = "B" & THEN SS_HEADING% = FALSE% & \ GOTO 6790 & & ELSE PRINT BOLD$ & \ PRINT "INVALID - Valid responses are 'A' or 'B' or 'HELP'" & \ PRINT NORM$ & \ GOTO 6710 6790 IF MENU% & THEN PRINT OPT2$;W_BOT$ 6799 RETURN 6800 !********************************************************************************************************************* & ! & ! S E L E C T T O P , L E F T C O R N E R F O R S P R E A D S H E E T & ! & ! If we're in MENU mode, then print some stuff on the menu. Also OPT3$, which is the users response, may & ! be set because he entered the three options on one line. & ! & ! If we're NOT in menu mode, then skip the menu stuff and just get the input. & ! & !********************************************************************************************************************* & IF MENU% ! We're in MENU Mode & THEN PRINT REV$; OPT3$; NORM$; W_BOT$; & \ IF LEN(RESP3$) > 0% ! This option has been entered already & THEN GOTO 6820 6812 PRINT PRINT "Enter TOP-LEFT CORNER (default = '"; DEF_TLC$; "')"; IF BATCH_INPUT% & THEN LINPUT #6%,RESP3$ & \ PRINT " ";REV$;RESP3$;NORM$ & & ELSE LINPUT RESP3$ 6813 RESP3$ = EDIT$(RESP3$,38%) IF RESP3$ = "HELP" & THEN PRINT & \ PRINT " Enter the name of the cell that is to contain the HEADING for" & \ PRINT " the FIRST FIELD or, if NO HEADINGS are used, then the cell to" & \ PRINT " contain the FIRST FIELD in the FIRST RECORD." & \ PRINT & \ PRINT " For Multiplan, cell names have the form - RmCn where 'm' is the ROW" & \ PRINT " NUMBER and 'n' is the COLUMN NUMBER (eg. R1C1, R14C4, etc.)." & \ PRINT & \ RESP3$ = "" & \ GOTO 6812 & & ELSE IF RESP3$ = "" & THEN RESP3$ = DEF_TLC$ 6820 IF SS_LUMP% & THEN CHECK$ = FNSS_CHECK$(RESP3$,FTOTAL%,RCOUNT%,SS_ORIENT%,SS_HEADING%) & & ELSE CHECK$ = FNSS_CHECK$(RESP3$,1%,RCOUNT%,SS_ORIENT%,SS_HEADING%) 6825 IF CHECK$ = "OK" & THEN IF MENU% & THEN PRINT OPT3$;W_BOT$ & \ GOTO 6899 & & ELSE GOTO 6899 & & ELSE PRINT BOLD$ & \ PRINT "ERROR - ";CHECK$ & \ PRINT "Looking for a Valid "+WHICH_SS$+" CELL NAME" & \ PRINT "Enter 'HELP' for help" & \ PRINT NORM$ & \ RESP3$ = "" & \ GOTO 6812 6899 RETURN 6900 !********************************************************************************************************************* & ! & ! G E T S P R E A D S H E E T O U T P U T F I L E N A M E & ! & !********************************************************************************************************************* & PRINT FNMSG$("Creating "+WHICH_SS$+" DATA FILE");W_BOT$ CLOSE 2% PRINT PRINT "Enter FILE NAME <";DEF_OUTPUT$;">"; IF BATCH_INPUT% & THEN LINPUT #6%,SS_NAMEF$ & \ PRINT " ";REV$;SS_NAMEF$;NORM$ & ELSE LINPUT SS_NAMEF$ 6912 SS_NAMEF$ = EDIT$(SS_NAMEF$,38%) IF LEN(SS_NAMEF$) = 0% & THEN SS_NAMEF$ = DEF_OUTPUT$ 6915 OPEN SS_NAMEF$ FOR OUTPUT AS FILE 2%, & ORGANIZATION SEQUENTIAL VARIABLE 6920 IF WHICH_SS% = DECalc% ! DECALC table format & THEN GOSUB 7050 & \ GOTO 6960 6922 IF WHICH_SS% = Visicalc% ! Visicalc 'DIF' format & THEN GOSUB 7000 & \ GOTO 6960 6923 IF WHICH_SS% = MultiPlan% ! MultiPlan "SYLK" format & THEN GOSUB 7100 & \ GOTO 6960 6960 PRINT W_BOT$ PRINT WHICH_SS$;" DATA FILE CREATED" HOW_MANY_OUT% = HOW_MANY_OUT% + 1% OUT_NAME$(HOW_MANY_OUT%) = SS_NAMEF$ OUT_TYPE%(HOW_MANY_OUT%) = WHICH_SS% OUT_TYPE_KEY% = OUT_TYPE_KEY% OR 2%^WHICH_SS% 6999 CLOSE 2% PRINT FNWINDOW$(3%,22%);W_BOT$ RETURN 7000 !******************************************************************************************************************** & ! & ! V I S I C A L C ' D I F ' F O R M A T & ! & ! VERY RUDIMENTARY - JUST LABELS AND NUMBERS & ! & !******************************************************************************************************************** & PRINT #2%,"TABLE" PRINT #2%,"0,1" PRINT #2%,'""' PRINT #2%,"VECTORS" IF (SS_USE_HEADING%(J%)) THEN PRINT #2%,"0,";NUM1$(RCOUNT%+2%) !header, 2 extra rows ELSE PRINT #2%,"0,";NUM1$(RCOUNT%) !no header END IF PRINT #2%,'""' PRINT #2%,"TUPLES" PRINT #2%,"0,";NUM1$(FTOTAL%) PRINT #2%,'""' PRINT #2%,"DATA" PRINT #2%,"0,0" PRINT #2%,'""' ! FOR J% = 1% TO FTOTAL% PRINT #2%,"-1,0" PRINT #2%,"BOT" IF (SS_USE_HEADING%(J%)) THEN PRINT #2%,"1,0" PRINT #2%,'"';FLDNAM$(J%);'"' !add field name PRINT #2%,"1,0" !and an empty row PRINT #2%,'""' END IF FOR I% = 1% TO RCOUNT% GET #1%, RECORD (I%-1%) * FTOTAL% + J% FLDVAL$ = EDIT$(D_LINE$,128%) IF FSTAT%(J%) < 0% & THEN PRINT #2%,"1,0" & \ PRINT #2%,'"';FLDVAL$;'"' & ELSE PRINT #2%,"0,";FLDVAL$ & \ PRINT #2%,"V" 7010 NEXT I% NEXT J% PRINT #2%,"-1,0" PRINT #2%,"EOD" RETURN 7050 !******************************************************************************************************************** & ! & ! D E C A L C T A B L E F O R M A T & ! & ! Create a file containing data in rectangular arrays & ! & !******************************************************************************************************************** & IF (SS_USE_HEADING%(J%)) THEN & TEMP$ = "" FOR J% = 1% TO FTOTAL% TEMP$ = TEMP$ + '"' + FLDNAM$(J%) + '"' + SEP$ NEXT J% PRINT #2%, TEMP$ PRINT #2%, "" END IF FOR I% = 1% TO RCOUNT% TEMP$ = "" FOR J% = 1% TO FTOTAL% GET #1%, RECORD (I%-1%) * FTOTAL% + J% FLDVAL$ = EDIT$(D_LINE$,128%) IF FSTAT%(J%) < 0% & THEN TEMP$ = TEMP$ + '"' + FLDVAL$ + '"' + SEP$ ELSE TEMP$ = TEMP$ + FLDVAL$ + SEP$ 7060 NEXT J% PRINT #2%, TEMP$ NEXT I% PRINT #2%, "" RETURN 7100 !******************************************************************************************************************** & ! & ! M U L T I P L A N - ' S Y L K ' F O R M A T & ! & ! Very Rudimentary & ! & !******************************************************************************************************************** & PRINT #2%,"ID;PMP" PRINT #2%,"F;DG0G10" FOR J% = 1% TO FTOTAL% IF NOT(SS_USE_HEADING%(J%)) & THEN GOTO 7110 7105 SS_R% = SS_CORNER%(J%,1%) SS_C% = SS_CORNER%(J%,2%) PRINT #2%,"C;";FNSS_CELL$(SS_R%,SS_C%);';K"';FLDNAM$(J%);'"' IF SS_NORM_ORIENT%(J%) & THEN SS_CORNER%(J%,1%) = SS_CORNER%(J%,1%)+2% & ELSE SS_CORNER%(J%,2%) = SS_CORNER%(J%,2%)+1% 7110 NEXT J% 7115 FOR I% = 1% TO RCOUNT% FOR J% = 1% TO FTOTAL% GET #1%, RECORD (I%-1%) * FTOTAL% + J% FLDVAL$ = EDIT$(D_LINE$,128%) 7120 IF SS_NORM_ORIENT%(J%) & THEN PRINT #2%, "C;";FNSS_CELL$(SS_CORNER%(J%,1%)+I%-1%,SS_CORNER%(J%,2%)); ';K'; & ELSE PRINT #2%, "C;";FNSS_CELL$(SS_CORNER%(J%,1%),SS_CORNER%(J%,2%)+I%-1%); ';K'; 7125 IF FSTAT%(J%) < 0% & THEN PRINT #2%, '"';FLDVAL$;'"' & ELSE PRINT #2%, FLDVAL$ 7130 NEXT J% 7135 NEXT I% PRINT #2%,"W;N1;A1 1" PRINT #2%,"E" 7190 RETURN 7500 !********************************************************************************************************************* & ! & ! S P A W N A S U B - P R O C E S S & ! & ! IF DCL$ = "" THEN GET OUT FOR A WHILE & ! OTHERWISE EXECUTE THE COMMAND & ! & !********************************************************************************************************************* & IF LEN(DCL$) > 0% & THEN PRINT FNMSG$("Executing a VMS command");W_BOT$; ! VMS Command included & \ CALL LIB$SPAWN(DCL$ BY DESC) ! Execute it, afterwhich control returns to DTRWHIZ & \ GOTO 7590 & ELSE PRINT FNMSG$("Going to VMS, to get back type LOGOUT");W_BOT$; ! No VMS Command & \ CALL LIB$SPAWN ! Go to VMS for a while & \ GOTO 7590 7590 PRINT PRINT PRINT FNWINDOW$(3%,22%);BANNER2$;W_BOT$ 7599 RETURN 8100 !******************************************************************************************************************** & ! & ! U N W I N D T H E C U R R E N T C O M M A N D & ! & !******************************************************************************************************************** & CALL DTR$UNWIND (DAB BY REF) CALL DTR$COMMAND (DAB BY REF, "") RETURN 9000 !******************************************************************************************************************** & ! & ! E R R O R H A N D L I N G & ! & !******************************************************************************************************************** & IF ERR = 52% ! Illegal Number (from VAL() function) & & THEN IF ERL = 3082 ! Testing a DATA FIELD to see if it is NUMERIC & THEN RESUME 3084 ! IT ISN'T numeric 9010 IF ERR = 28% ! CTRL/C Trap & & THEN IF ERL = 1260 ! Getting a DTR Command & THEN RESUME 2990 ! Treat this case like a CTRL/Z & & ELSE IF ERL = 7500 ! Presumably in the middle of SPAWING a sub-process & THEN RESUME 7590 ! Just forget about it & & ELSE RESUME 9099 ! Don't know what was happening - so QUIT 9012 IF ERR = 11% & AND ERL = 1260 & THEN IF BATCH_INPUT% & THEN PRINT BOLD$ & \ PRINT "No more commands in BATCH FILE" & \ PRINT NORM$ & \ BATCH_INPUT% = FALSE% & \ CLOSE 6% & \ IF WAS_CMD% & THEN CMD_FILE% = TRUE% & \ WAS_CMD% = FALSE% & \ RESUME 1200 & & \ ELSE RESUME 1200 & & ELSE IF CMDFILE% & THEN PRINT BOLD$ & \ PRINT "No more commands in Command File" & \ PRINT NORM$ & \ CMDFILE% = FALSE% & \ CLOSE 5% & \ IF WAS_BATCH% & THEN BATCH_INPUT% = TRUE% & \ WAS_BATCH% = FALSE% & \ RESUME 1200 & & \ ELSE RESUME 1200 & & ELSE IF EDIT$(MSG_BUFF$,38%) = "DTR>" & THEN RESUME 9099 & & ELSE RESUME 2990 9015 IF ERR = 11% & AND BATCH_INPUT% & THEN PRINT BOLD$ & \ PRINT "OUT OF DATA in BATCH FILE - ABORTING" & \ PRINT NORM$ & \ BATCH_INPUT% = FALSE% & \ CLOSE 6% & \ PRINT BANNER2$;FNWINDOW$(3%,22%);W_BOT$; & \ CALL DTR$UNWIND (DAB BY REF) & \ CALL DTR$COMMAND (DAB BY REF, "") & \ RESUME 1200 9020 ! ! ERROR OPENING A COMMAND FILE ! IF ERL = 1600 ! Opening a COMMAND File & THEN IF ERR = 1 ! Bad Directory for Device & OR ERR = 2 ! Illegal File Name & OR ERR = 5 ! Can't Find File or Account & OR ERR = 10 ! Protection Violation & OR ERR = 139 ! Invalid File Options & OR ERR = 175 ! Node Name Error & THEN PRINT BOLD$;"ERROR - ";ERT$(ERR);NORM$ & \ RESUME 1200 9022 ! ! ERROR OPENING A BATCH FILE ! IF ERL = 1620 ! Opening a BATCH File & THEN IF ERR = 1 ! Bad Directory for Device & OR ERR = 2 ! Illegal File Name & OR ERR = 5 ! Can't Find File or Account & OR ERR = 10 ! Protection Violation & OR ERR = 139 ! Invalid File Options & OR ERR = 175 ! Node Name Error & THEN PRINT BOLD$;"ERROR - ";ERT$(ERR);NORM$ & \ RESUME 1200 9025 ! ! ERROR KILLING WORK FILE ! IF ERR = 5% ! Can't Find File or Account & AND ERL = 9996 ! KILLing Work File& THEN RESUME 9997 9030 ! ! OUT OF DATA WHILE READING 'DATA' STATEMENTS (ie. HELP TEXT) ! IF ERR = 57 & AND ERL = 5050 & THEN RESUME 5090 9040 IF ERR <> 11% & THEN GOTO 9090 9042 ! ! END OF FILE ERRORS ! IF ERR = 11% ! END of FILE on Device & & THEN IF ERL = 2820 ! Looking for a VALUE (ie. '*.' prompt) & THEN RESUME 2990 ! This will ABORT, regardless of input source (eg. tty, batch, cmdfile) & & ELSE IF ERL = 5060 ! Deciding whether or not to continue with HELP & THEN RESUME 5190 ! This means he doesn't & & ELSE IF ERL = 5090 ! Deciding whether or not to start HELP again & THEN RESUME 5190 ! This means he doesn't & & ELSE IF ERL = 6020 ! Looking for spreadsheet Top, Left Corner & OR ERL = 6115 ! Looking for field treatment (ie. collectively / individually) & THEN RESUME 6390 ! ABORT the spreadsheet file creation & & ELSE IF ERL = 6605 ! Looking for spreadsheet orientation & THEN ABORT% = TRUE% ! & \ RESUME 6699 ! Set ABORT flag and get out & & ELSE IF ERL = 6712 ! Deciding whether or not to use Row Names / Column Headings & THEN ABORT% = TRUE% ! & \ RESUME 6799 ! Set ABORT Flag and get out & & ELSE IF ERL = 6812 ! Looking for Top, Left Corner for spreadsheet & THEN ABORT% = TRUE% ! & \ RESUME 6899 ! Set ABORT Flag and get out & & ELSE IF ERL = 6900 ! Looking for the Spreadsheet File Name & THEN ABORT% = TRUE% ! & \ RESUME 6999 ! Set ABORT Flag and get out & & ELSE IF ERL = 7100 ! Looking for Multiplan, Top Row, & OR ERL = 7110 ! and Left-most Column numbers & THEN ABORT% = TRUE% ! & \ RESUME 7190 ! Set ABORT Flag and get out 9090 IF ERR = 1% & THEN IF ERL = 9996 ! KILLING the Work File & THEN RESUME 9997 ! That's O.K. - Keep going & ELSE PRINT W_BOT$ ! Give up! & \ PRINT BOLD$;" Somehow you have gotten yourself into an INVALID DIRECTORY. " & \ PRINT " You must set your default to a VALID directory. " & \ PRINT NORM$ \ RESUME 9996 9095 ! ! End of the known errors, report the error ! PRINT PRINT BOLD$;"ERROR = ";NORM$;" ";NUM1$(ERR) PRINT BOLD$;" IN ";NORM$;" ";ERN$ PRINT BOLD$;"AT LINE ";NORM$;" ";NUM1$(ERL) PRINT BOLD$;" ";NORM$;" ";ERT$(ERR) 9099 ! ! If we're into DTR, then clean it up, otherwise just get out ! IF INDTR% & THEN RESUME 9990 & ELSE RESUME 9996 9990 !******************************************************************************************************************** & ! & ! A L L D O N E & ! & !******************************************************************************************************************** & CALL DTR$FINISH (DAB BY REF) 9996 CLOSE 1%,2%,3%,4%,5% PRINT MSG_LINE$;STRING$(40%,32%) PRINT FNWINDOW$(1%,24%);W_BOT$ KILL WORK_FILE$ 9997 IF HOW_MANY_OUT%=0% & THEN PRINT "No files created." & \ GOTO 32000 9998 PRINT " You created the following file(s) during this session:" PRINT PRINT " FILE NAME FILE TYPE" PRINT " ------------- ---------" FOR I% = 1% TO HOW_MANY_OUT% PRINT " ";OUT_NAME$(I%);TAB(26%);WHIZ_CAT$(OUT_TYPE%(I%)) NEXT I% 9999 GOTO 32000 10000 !******************************************************************************************************************** & ! & ! D A T A S T A T E M E N T S - F O R H E L P T E X T & ! & ! '{' / '}' used for BEGIN / END Reverse Video & ! & ! '|' = STOP HERE and WAIT for USER to HIT & ! & !******************************************************************************************************************** & 10010 DATA "DTRWHIZ - A data connectivity utility which links VAX-11 DATATRIEVE with" 10020 DATA "a variety of spreadsheet tools including DECalc, MultiPlan and Visicalc." 10030 DATA "DTRWHIZ uses CALLABLE DATATRIEVE to extract data from DATATRIEVE and" 10050 DATA "then creates an intermediate file containing the data in a format acceptable" 10060 DATA "to the utility selected to receive it. Once the intermediate file has been" 10070 DATA "created, the user exits from DTRWHIZ, invokes the selected utility and" 10080 DATA "instructs the utility to read the intermediate file. Examples for each of" 10090 DATA "the supported utilities will be presented later in this help message." 10100 DATA "" 10110 DATA "It is assumed that the DTRWHIZ user is familiar with both DATATRIEVE and" 10120 DATA "the utility for which the data are to be extracted. Through the use of" 10130 DATA "the COMMAND FILE and BATCH FILE options in DTRWHIZ, the DATATRIEVE side can" 10140 DATA "be made quite simple. These options also are described later. Simply" 10150 DATA "stated, DATATRIEVE commands can be pre-defined in a file and that file can" 10160 DATA "be invoked from within DTRWHIZ. This eliminates the need for users to" 10170 DATA "remember complex DATATRIEVE commands while enabling them to benefit from the" 10180 DATA "data manipulation capabilities of DATATRIEVE." 10190 DATA "|" 10200 DATA "{ DTRWHIZ DATA EXTRACTION SYNTAX } - How to get your data out of DATATRIEVE" 10210 DATA "" 10220 DATA "After invoking DTRWHIZ (ie. 'RUN DTRWHIZ'), the user READY's the desired" 10230 DATA "DOMAIN then issues one of the following DTRWHIZ commands followed by a" 10240 DATA "DATATRIEVE Record Selection Expression (RSE). The only restriction is that" 10250 DATA "the RSE must be valid for the DATATRIEVE 'LIST' command. (DTRWHIZ actually" 10260 DATA "uses the LIST command to extract the data prior to reformatting it.) If" 10270 DATA " represents a valid Record Selection Expression, then the format of" 10280 DATA "the DTRWHIZ extraction commands is -" 10290 DATA "" 10320 DATA " { DECALC }" 10330 DATA "" 10340 DATA " { MULTIPLAN }" 10350 DATA "" 10360 DATA " { VISICALC }" 10390 DATA "|" 10400 DATA "{ DTRWHIZ DATA EXTRACTION QUALIFIERS } - How to get your data the way you want it" 10410 DATA "" 10420 DATA "Once the extraction command has been accepted and processed, DTRWHIZ asks for -" 10430 DATA "" 10440 DATA " {ORIENTATION - NORMAL or TRANSPOSED?} Normal orientation would look" 10450 DATA " the same as the results of a DATATRIEVE 'PRINT' command, Records" 10460 DATA " become Rows, Fields become Columns. With Transposed Orientation," 10470 DATA " Fields become Rows and Records become Columns." 10480 DATA "" 10490 DATA " {USE HEADINGS?} If desired, the Field Names will be included as" 10500 DATA " Headings in the output file. For Normal Orientation, the Headings" 10510 DATA " will appear above the Columns. With Transposed Orientation, the" 10520 DATA " Field Names will occupy the First Column of Each Row." 10530 DATA "" 10540 DATA " {LOCATION WITHIN THE UTILITY?} This refers to the location of the" 10560 DATA " Top-Left Corner of the data rectangle." 10570 DATA " NOTE: For VISICALC and DECalc, the Location is determined from the" 10580 DATA " position of the cursor at the time the data is loaded into the" 10585 DATA " spreadsheet." 10590 DATA "|" 10600 DATA "{ DTRWHIZ DATA EXTRACTION QUALIFIERS } (continued)" 10610 DATA "" 10615 DATA " {OUTPUT FILE NAME?} This is the name of the file that will contain" 10620 DATA " the reformatted data. This is the file name to be referenced when" 10625 DATA " loading the data into the utility." 10630 DATA "" 10635 DATA " {DELIMITER CHARACTER?} DECalc separates data items in a table file" 10640 DATA " with a delimiter character. DECalc will need to know this character" 10645 DATA " when it processes a table file. It defaults to ." 10650 DATA "|" 10660 DATA "{ LOADING EXTRACTED DATA INTO THE UTILITIES } - How to use the data" 10670 DATA "" 10680 DATA "Each of the supported utilities has a unique approach to loading foreign" 10690 DATA "data (ie. data produced outside the utility). In the following examples" 10700 DATA "the symbol will indicate where to supply the OUTPUT FILE NAME" 10710 DATA "selected within DTRWHIZ." 10720 DATA "" 10750 DATA " { DECALC } \ST " 10760 DATA "" 10770 DATA " { MULTIPLAN } TOS (Set format to Symbolic)" 10780 DATA " TL " 10790 DATA "" 10800 DATA " { VISICALC } /S#L " 10805 DATA "|" 10810 DATA "{ DTRWHIZ COMMANDS AND FEATURES } - Beyond the basics" 10815 DATA "" 10820 DATA "The following commands are recognized by DTRWHIZ, all other commands are" 10825 DATA "passed to DATATRIEVE. These commands are described in more detail later." 10830 DATA "" 10835 DATA " { NODEFAULT } Gives the user more control over the format of the output." 10840 DATA "" 10845 DATA " { DEFAULT } Returns DTRWHIZ to the default formatting mode." 10850 DATA "" 10860 DATA " { VMS } Gives the user access to VMS Command Level from within DTRWHIZ." 10865 DATA "" 10870 DATA " { HELP } Displays this information." 10875 DATA "" 10880 DATA " { @ } Invoke a COMMAND FILE." 10885 DATA "" 10890 DATA " { BATCH } Invoke a BATCH FILE." 10895 DATA "|" 10900 DATA "{ DTRWHIZ COMMANDS AND FEATURES } (continued)" 10905 DATA "" 10910 DATA " { FIXMISSING } Allows replacement of missing data with some value." 10915 DATA "" 10920 DATA " { NOFIXMISSING } Disables FIXMISSING mode." 10925 DATA "" 10930 DATA " { MISSVAL } Indicates data to be replaced." 10935 DATA "" 10940 DATA " { MISSFIX } Specifes value to use in place of missing data." 11000 DATA "|" 11010 DATA "{ NODEFAULT MODE } Format: { DTRWHIZ> NODEFAULT }" 11020 DATA "" 11230 DATA "Under NODEFAULT MODE, the user can specify the Orientation, Use of Headings," 11240 DATA "and Location in the Spreadsheet for each Field in the individually." 11250 DATA "" 11260 DATA "This might be useful for complex spreadsheets where data are to be entered" 11270 DATA "into cells which are not contiguous." 11280 DATA "" 11290 DATA "NOTE: Visicalc and DECalc are NOT supported under NODEFAULT MODE." 11300 DATA "|" 11310 DATA "{ VMS } Format: { DTRWHIZ> VMS } or { DTRWHIZ> VMS command }" 11320 DATA "" 11330 DATA "Through this command users can enter system command mode or simply execute" 11340 DATA "a single system level command (eg. DIRECTORY, EDIT, DELETE, etc). In the" 11350 DATA "first case (ie.'VMS' alone), the user enters system level command mode and" 11360 DATA "remains there until the LOGOUT command is entered. The user is then returned" 11370 DATA "to DTRWHIZ." 11380 DATA "" 11390 DATA "In the second case (ie. 'VMS command'), the 'command' is executed as a system" 11400 DATA "level command and, upon completion of the command, is returned to DTRWHIZ." 11410 DATA "" 11420 DATA "NOTE: This feature is implemented through the use of SPAWNED SUBPROCESSES." 11430 DATA "|" 11440 DATA "{ @ } - COMMAND FILES Format: { DTRWHIZ> @filename }" 11450 DATA "" 11460 DATA "DTRWHIZ will look to the file specified for commands and will continue" 11470 DATA "reading commands from the file until the end of the file is reached. DTRWHIZ" 11480 DATA "then will return to input from the keyboard." 11490 DATA "" 11500 DATA "NOTE: DTRWHIZ will be read from the Command File ONLY when a COMMAND is" 11510 DATA " expected. Input for which the user is prompted will still be read" 11520 DATA " from the keyboard. All 'formatting' input (eg. Orientation, Use" 11530 DATA " of Headings/Row Names, and Location information) is to be entered" 11540 DATA " from the keyboard." 11550 DATA "" 11560 DATA " Also, use of the DATATRIEVE '*.' prompt for input feature from" 11570 DATA " within a Command File will cause DTRWHIZ to look to the keyboard" 11580 DATA " for the response to the prompt." 11590 DATA "|" 11600 DATA "{ BATCH } - BATCH FILES Format: { DTRWHIZ> BATCH filename }" 11610 DATA "" 11620 DATA "Like the '@filename' command, the 'BATCH filename' command causes DTRWHIZ" 11630 DATA "to read commands from the file specified except that ALL INPUT is read from" 11640 DATA "the Batch File until the end of the file has been reached. Input thereafter" 11650 DATA "is read from the keyboard." 11660 DATA "" 11670 DATA "" 11680 DATA "NOTE: A Batch File may contain other BATCH FILE commands or COMMAND FILE" 11690 DATA " commands. Command Files may contain BATCH FILE commands or other" 11700 DATA " COMMAND FILE commands as well. However, if Batch File 1 invokes" 11710 DATA " Batch File 2, control will be returned to the keyboard at the end" 11720 DATA " of Batch File 2 even if more commands remain in Batch File 1. The" 11730 DATA " same applies for COMMAND FILES." 11740 DATA "" 11750 DATA " But, if a BATCH FILE invokes a COMMAND file, control will be returned" 11760 DATA " to the BATCH FILE at the end of the COMMAND FILE. A COMMAND FILE" 11770 DATA " invoking a BATCH FILE behaves the same way. Therefore, a BATCH" 11780 DATA " FILE can invoke multiple COMMAND FILES (and vice versa)." 11790 DATA "|" 11805 DATA "{ FIXMISSING MODE } Format: { DTRWHIZ> FIXMISSING }" 11810 DATA " Format: { DTRWHIZ> MISSVAL string }" 11815 DATA " Format: { DTRWHIZ> MISSFIX string }" 11820 DATA "" 11825 DATA "Under FIXMISSING MODE, data fields which contain no entry can have a value" 11840 DATA "substituted by DTRWHIZ. When this mode is active, any entry which matches the" 11850 DATA "MISSVAL string is replaced by the MISSFIX string. These strings have default" 11860 DATA "values but can be changed by the user at any time with the MISSVAL and MISSFIX" 11870 DATA "commands." 11895 DATA "|" 11900 DATA "{ USAGE NOTES }" 11910 DATA "" 11920 DATA " * The DATATRIEVE EDIT facility is not supported." 11940 DATA "" 11950 DATA " * Continued commands are supported. However, since DTRWHIZ does not" 11960 DATA " look for a ';' to indicate the end of a command, breaking the" 11970 DATA " command line at a 'logically complete' location will cause DATATRIEVE" 11980 DATA " to execute the command rather than prompt for continuation." 15000 !********************************************************************************************************************** & ! & ! L O C A L F U N C T I O N S & ! & !********************************************************************************************************************** & 15100 !******************************************************************************************************************** & ! & ! C U R S O R A D D R E S S I N G & ! & !******************************************************************************************************************** & DEF FNA$(R%,C%)=ESC$+"["+NUM1$(R%)+";"+NUM1$(C%)+"H" 15200 !******************************************************************************************************************** & ! & ! D E F I N E W I N D O W - i e . S C R O L L R E G I O N & ! & !******************************************************************************************************************** & DEF FNWINDOW$(T%,B%) TOP%=T% BOT%=B% W_TOP$=FNA$(T%,1%) W_BOT$=FNA$(B%,1%) MAX_W_ROW%=BOT%-TOP%-2% FNWINDOW$=ESC$+"["+NUM1$(T%)+";"+NUM1$(B%)+"r" FNEND 15300 !******************************************************************************************************************** & ! & ! C L E A R C U R R E N T W I N D O W & ! & !******************************************************************************************************************** & DEF FNWC$(DISPLAY_LINES%) PRINT W_TOP$; PRINT DEOL$;WINDOW_DISPLAY$(FOO%) FOR FOO% = 1% TO DISPLAY_LINES% PRINT DEOL$ FOR FOO% = DISPLAY_LINES% + 1% TO BOT% - TOP% PRINT DEOL$;W_TOP$; FNWC$="" FNEND 15400 !******************************************************************************************************************** & ! & ! C U R S O R A D D R E S S I N G W I T H I N C U R R E N T W I N D O W & ! & !******************************************************************************************************************** & DEF FNWA$(R%,C%)=FNA$(TOP%+R%-1%,C%) 15500 !******************************************************************************************************************** & ! & ! D I S P L A Y T E X T I N D O U B L E H E I G H T / W I D T H & ! & !******************************************************************************************************************** & DEF FNBIG$(ROW%,COL%,WIDTH%,TXT$) IF COL%>0% & THEN TXTX$=TXT$ & ELSE TXTX$=STRING$((WIDTH%/2%-LEN(TXT$))/2%,32%)+TXT$ & \ TXTX$=TXTX$+STRING$(WIDTH%/2%-LEN(TXTX$),32%) 15510 FNBIG$=FNA$(ROW%,COL%)+BIGT$+TXTX$+FNA$(ROW%+1%,COL%)+BIGB$+TXTX$ FNEND 15600 !******************************************************************************************************************** & ! & ! D I S P L A Y T E X T I N D O U B L E W I D T H C H A R A C T E R S & ! & !******************************************************************************************************************** & DEF FNWIDE$(WIDTH%,TXT$) IF WIDTH%=0% & THEN TXTX$=TXT$ & ELSE IF WIDTH%<0 & THEN TXTX$=STRING$(ABS(WIDTH%)-LEN(TXT$),32%)+TXT$ & ELSE TXTX$=STRING$((WIDTH%-LEN(TXT$))/2%,32%)+TXT$ & \ TXTX$=TXTX$+STRING$(WIDTH%-LEN(TXTX$),32%) 15610 FNWIDE$=WIDE$+TXTX$ FNEND 15700 !******************************************************************************************************************** & ! & ! P U T A M E S S A G E O N T H E M E S S A G E L I N E & ! & !******************************************************************************************************************** & DEF FNMSG$(TXT$) = MSG_LINE$ + REV$ + FNWIDE$(40%,TXT$) + NORM$ + W_BOT$ 15800 !******************************************************************************************************************** & ! & ! S P R E A D S H E E T V A L I D I T Y C H E C K & ! & ! PARAM & ! TLC$ - Top Left Corner & ! FLDS% - Number of fields & ! RECS% - Number of records & ! NORM% - If TRUE then FIELDS=COL, RECORDS=ROW else Transpose & ! HEAD% - If TRUE then FIELD NAMES are included & ! SET & ! SS_FIRST_ROW% = 1,2,3 etc & ! SS_FIRST_COL% = 1,2,3... corresponds to A,B,C... & ! RETURN & ! "OK" if OK & ! AN ERROR MESSAGE if there was an error & ! ERRORS derived from PARAM's & ! BAD FORMAT for TLC$ & ! NOT ENOUGH ROWS or COLUMNS to accomodate FLDS% and/or RECS% & ! & !******************************************************************************************************************** & DEF FNSS_CHECK$(TLC$,FLDS%,RECS%,NORM%,HEAD%) SSX$ = FNSS_C_TO_N$(TLC$) IF SSX$ <> "OK" & THEN FNSS_CHECK$ = SSX$ & \ GOTO 15899 & ELSE IF NORM% & THEN SS_LAST_COL% = SS_FIRST_COL% + FLDS% - 1% & \ IF HEAD% & THEN SS_LAST_ROW% = SS_FIRST_ROW% + RECS% + 1% & ELSE SS_LAST_ROW% = SS_FIRST_ROW% + RECS% - 1% & ELSE SS_LAST_ROW% = SS_FIRST_ROW% + FLDS% - 1% & \ IF HEAD% & THEN SS_LAST_COL% = SS_FIRST_COL% + RECS% & ELSE SS_LAST_COL% = SS_FIRST_COL% + RECS% - 1% 15840 IF SS_LAST_ROW% > SS_MAX_ROW% & THEN FNSS_CHECK$ = "Too many ROWS." & \ GOTO 15899 & ELSE IF SS_LAST_COL% > SS_MAX_COL% & THEN FNSS_CHECK$ = "Too many COLUMNS." & \ GOTO 15899 & ELSE FNSS_CHECK$ = "OK" 15899 FNEND 15900 !******************************************************************************************************************** & ! & ! R E T U R N A V A L I D S P R E A D S H E E T C E L L N A M E & ! & ! For Multiplan Y1;X1 'SYLK' Format - Row;Col & ! & !******************************************************************************************************************** & DEF FNSS_CELL$(ROW%,COL%) SS_CELL$ = "" IF WHICH_SS% = MultiPlan% ! MULTIPLAN & THEN FNSS_CELL$ = "Y" + NUM1$(ROW%) + ";X" + NUM1$(COL%) & & ELSE FNSS_CELL$ = NUM1$(COL%) + "," + NUM1$(ROW%) ! Unknown Spreadsheet 15910 FNEND 16000 !******************************************************************************************************************** & ! & ! R E T U R N T H E M A X I M U M V A L U E & ! & !******************************************************************************************************************** & DEF FNMAX%(N1%,N2%) IF N1% >= N2% & THEN FNMAX% = N1% & ELSE FNMAX% = N2% 16010 FNEND 16100 !******************************************************************************************************************** & ! & ! R E T U R N T H E M I N I M U M V A L U E & ! & !******************************************************************************************************************** & DEF FNMIN%(N1%,N2%) IF N1% <= N2% & THEN FNMIN% = N1% & ELSE FNMIN% = N2% 16110 FNEND 16200 !******************************************************************************************************************** & ! & ! P A D T H E T E X T L I N E W I T H B L A N K S & ! & !******************************************************************************************************************** & DEF FNPAD$(L$,L%,JUST%) PAD$ = STRING$(L%-LEN(L$),32%) IF JUST% & THEN FNPAD$ = L$ + PAD$ & ELSE FNPAD$ = PAD$ + L$ 16210 FNEND 17000 !******************************************************************************************************************** & ! & ! S P R E A D S H E E T C E L L N A M E D E C O D E R & ! & ! PARAM & ! CELL$ - Cell name & ! & ! USED & ! WHICH_SS% & ! & ! SET & ! SS_FIRST_ROW% - Row value & ! SS_FIRST_COL% - Column value & ! & ! RETURN & ! FNSS_C_TO_N$ - "OK" if valid, otherwise an ERROR Message & ! & !******************************************************************************************************************** & DEF FNSS_C_TO_N$(CELL$) XCELL$ = EDIT$(CELL$,38%) IF XLATE(XCELL$,XSS_CELL$) <> XCELL$ & THEN FNSS_C_TO_N$ = "Invalid characters in CELL NAME." & \ GOTO 17299 & ELSE SSI% = 0% & \ SSL% = LEN(XCELL$) & \ SS_FIRST_ROW% = 0% & \ SS_FIRST_COL% = 0% & \ IF SSL% < 1% & THEN FNSS_C_TO_N$ = "No CELL NAME supplied." & \ GOTO 17299 17005 ON WHICH_SS% GOTO 17020, ! DECalc & 17040, ! Visicalc & 17050 ! Multiplan 17020 ! ! DECalc - Not implemented ! FNSS_C_TO_N$ = "DECalc cell naming not implemented" GOTO 17299 17040 ! ! Visicalc - Not implemented ! FNSS_C_TO_N$ = "Visicalc cell naming not implemented" GOTO 17299 17050 ! ! Multiplan ! SSI% = 0% SSZ% = 0% SSV% = 0% SSI% = SSI% + 1% IF SSI% > SSL% & THEN FNSS_C_TO_N$ = "INCOMPLETE cell name" & \ GOTO 17299 & & ELSE SSX% = POS("RC",SEG$(XCELL$,SSI%,SSI%),1%) & \ IF SSX% = SSZ% & THEN FNSS_C_TO_N$ = "INCOMPLETE cell name" & \ GOTO 17299 & & ELSE SSZ% = SSX% & \ IF SSZ% = 1% & THEN SSZ$ = "C" & & ELSE SSZ$ = "R" 17052 SSI% = SSI% + 1% IF SSI% > SSL% & THEN IF SSV% < 1% & THEN FNSS_C_TO_N$ = "INCOMPLETE cell name" & \ GOTO 17299 & & ELSE IF SSZ% = 2% & THEN IF SS_FIRST_ROW% < 1% & THEN FNSS_C_TO_N$ = "INCOMPLETE cell name" & \ SS_FIRST_COL% = SSV% & \ GOTO 17299 & & ELSE FNSS_C_TO_N$ = "OK" & \ SS_FIRST_COL% = SSV% & \ GOTO 17299 & & ELSE IF SS_FIRST_COL% < 1% & THEN FNSS_C_TO_N$ = "INCOMPLETE cell name" & \ SS_FIRST_ROW% = SSV% & \ GOTO 17299 & & ELSE FNSS_C_TO_N$ = "OK" & \ SS_FIRST_ROW% = SSV% & \ GOTO 17299 & & ELSE SSI$ = SEG$(XCELL$,SSI%,SSI%) & \ SSY% = POS("0123456789",SSI$,1%) - 1% & \ IF SSY% < 0% & THEN IF POS(",;:",SSI$,1%) > 0% & THEN GOTO 17052 & & ELSE IF SSI$ = SSZ$ & THEN IF SSZ% = 2% & THEN SS_FIRST_COL% = SSV% & \ SSV% = 0% & \ SSZ$ = "" & \ SSZ% = 3% - SSZ% & \ GOTO 17052 & & ELSE SS_FIRST_ROW% = SSV% & \ SSV% = 0% & \ SSZ$ = "" & \ SSZ% = 3% - SSZ% & \ GOTO 17052 & & ELSE FNSS_C_TO_N$ = "Invalid CELL NAME" & \ GOTO 17299 & & ELSE SSV% = SSV% * 10% + SSY% & \ IF SSV% > SS_EXTREME% & THEN IF SSZ% = 1% & THEN FNSS_C_TO_N$ = "ROW number TOO LARGE" & \ GOTO 17299 & & ELSE FNSS_C_TO_N$ = "COLUMN number TOO LARGE" & \ GOTO 17299 & & ELSE GOTO 17052 17299 ! ! ALL DONE ! FNEND 32000 !******************************************************************************************************************** & ! & ! T H A T ' S A L L F O L K S & ! & !******************************************************************************************************************** & PRINT "" END