"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" RUN ALL YOUR SOFTWARE FROM AN R:BASE MENU """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" PRODUCT : R:BASE VERSION : 3.1 CATEGORY : DAI SUBCATEGORY : PROGRAMMING """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" From John Henry Kuhlmann, John Henry Kuhlmann, Inc., 6140 - 93rd SE, Mercer Island, WA 98040. John's been working with R:BASE for over 10 years. Microrim's latest R:BASE 3.1 (Upgrade EXPRESS 3.1A), includes an intriguing new RETURN option on the ZIP command. The RETURN option gives you Dynamic Application Integration (DAI) to connect other software to your R:BASE application. Now you can run any software--a dBASE application program, word processing, spreadsheet, or even graphics--from inside R:BASE. For example, you can develop an application that enables a user to run an accounts payable dBASE application, mail-merge letters using Microsoft Word, generate graphs of R:BASE data using Harvard Graphics, and run worksheets using Lotus 1-2-3--all from the same R:BASE menu. You can use R:BASE as your central application, listing other software programs as choices on the R:BASE menu. The RETURN Option """"""""""""""""" ZIP RETURN allows processing to switch to another software product and then return to the same spot in your R:BASE application. The RETURN option gives you the full system memory access of ZIP ROLLOUT and the transparency of the regular ZIP command. ZIP RETURN Internal Workings """""""""""""""""""""""""""" When R:BASE encounters a ZIP RETURN during application execution, it first saves the current R:BASE environment in a temporary file. Then it closes all database and other files, drops any open cursors, exits R:BASE, and passes control to RBZIP.EXE--thus freeing up the memory that R:BASE was using. The process of passing control to RBZIP also passes the name of the temporary environment file and the remainder of the commands that follow the ZIP RETURN. Next, RBZIP executes the program named in the command line; this can be COMMAND.COM for executing batch files, or it can be any DOS .COM or .EXE program referenced directly or accessible along the DOS system path. When the called program finishes executing, R:BASE returns control to RBZIP.EXE, and RBZIP executes R:BASE with the environment file as a parameter. R:BASE reads and deletes the temporary environment file, and restores the system to it's pre-ZIP state. All this serves to place the execution of R:BASE, or of the R:BASE application, directly at the next command in sequence. R:BASE then continues to execute the commands following the ZIP RETURN command. Direct Approach """"""""""""""" Use ZIP RETURN to execute any .EXE or .COM program directly, or use it to execute a DOS batch file by using COMMAND.COM (a DOS .COM program that executes batch file statements). For example, to run the WordPerfect word processing program directly from inside R:BASE, enter this command at the R> prompt: ZIP RETURN wp When you exit from WordPerfect, you'll return to R:BASE, which will be in the same state as when you left it. It's easy to pass parameters too. Here's the syntax for running an .EXE program directly from the R> prompt: ZIP RETURN c:\path\exe_name param1 ... paramN Here are some examples: ZIP RETURN fastback ZIP RETURN c:\word\word d:\doc\region.doc ZIP RETURN c:\norton\nu Batch File Approach """"""""""""""""""" Use the batch file approach (passing control to COMMAND.COM to run a batch file) when you need to run an R:BASE 2.11 application from the R:BASE 3.1A menu or when you need to alter the DOS environment. For example, the DOS batch file can set the path, change the default drive, chain the execution of multiple programs together, and perform a myriad of other batch file functions. Here's the syntax for the batch approach: ZIP RETURN COMMAND /C filename.bat param 1 ... param n Run 2.11 Application from 3.1A """""""""""""""""""""""""""""" To run an R:BASE 2.11 application from inside R:BASE 3.1A, follow these three steps: STEP 1 ====== Ensure that you have your 2.11 database and application files and the following 2.11 program files on your computer in a directory separate from your R:BASE 3.1A files. RBASE.EXE RBASE.OVL RBASE.HLP RBASE1.MSG RBASE2.MSG DEFAULT.MSG COMMON.MSG RESTORE.CMD STNDRD.OVL These files occupy less than one megabyte of disk space. They represent the minimum needed. If you want additional R:BASE 2.11 functionality, you must add the appropriate program file. For example, to create or modify an Application EXPRESS application, you need APPEXP.HLP, APPEXP.MSG, EXPRESS1.OVL, and EXPRESS2.OVL. STEP 2 ====== Create a batch file (R211.BAT) to run R:BASE 2.11. For example, say the 2.11 program files are in the directory RB211, the 3.1A program files are in the directory R31A, and the database and application files are in the directory DBFILES. In this case, the R211.BAT file might contain these commands: @ECHO OFF PATH=C:\R211 CD \R211\dbfiles RBASE -R CD \R31A\dbfiles PATH=C:\R31A This file sets ECHO OFF to keep the commands from displaying on screen. Then it sets the path for R:BASE 2.11 and changes to the directory where the 2.11 database and application files are stored. Then it starts R:BASE 2.11 and uses the RBASE.DAT to start the application. When you exit from the 2.11 application, the next line in the batch file changes to the directory where your R:BASE 3.1A database and application files are stored, and then it resets your path to R:BASE 3.1A. STEP 3 ====== Include the following line in your 3.1A application file (or enter it at the R> prompt): ZIP RETURN COMMAND /C r211.bat The ZIP RETURN returns you to the line following the ZIP RETURN in your R:BASE 3.1A application file. You can specify a drive and directory if the batch file isn't in the current directory: ZIP RETURN COMMAND /C d:\dirname\r211.bat Putting Software on the Menu """""""""""""""""""""""""""" You can put your external software programs right on the R:BASE Applications menu by creating an .APP file, and using CODELOCK to create an .APX file. For example, you can add WordPerfect to the R:BASE Application menu by following two steps. First, use the R:BASE Editor to create a file named WP.APP containing these lines: $COMMAND WP ZIP RETURN wp RETURN Next, use CODELOCK on the application file (WP.APP) to create a procedure file (WP.APX) by following this procedure: o Start CODELOCK at the R> prompt or the operating system prompt. o Choose "Convert an ASCII application file to a binary procedure file." o Enter WP.APP as the name of the ASCII application file and WP.APX as the name of the procedure file. o Choose Exit. The R:BASE Applications menu will now include a WP option when your current directory holds the WP.APX file. Notes """"" Keep the following in mind when adding software to your R:BASE menu: o The .APX file must be in your current directory. o The second line of the .APP file must match the name of the .APP and .APX files. It's the name that appears on the R:BASE Applications menu. If you want LETTERS to appear on the menu instead of WP; name the files LETTERS.APP and LETTERS.APX, and make LETTERS the second line of .APP file. o You can include the path following the ZIP RETURN command in your .APP file for some programs if the software you want to run isn't already on your path. For example, if you keep WordPerfect on D: in a directory named WP but run R:BASE from C:, make this the third line of the .APP file: ZIP RETURN d:\wp\wp o Be sure the name of the file you specify with ZIP RETURN is the name of the program's .EXE file. o If you prefer, you can have your .APP file call a batch file that sets the path before running the application and then restores the path when you leave the application as was done to run R:BASE 2.11 from R:BASE 3.1. o R:BASE displays--in the Applications menu--the list of .APX files in the current directory. Therefore, you must be in the directory that holds a given .APX file in order to see it on the Applications menu. o ZIP RETURN opens a new world of possibilities. For example, you can unload a selected subset of data from an attached dBASE III table into an output file, invoke Microsoft Word 5.5, and then use the file as a name list to mailmerge into an existing Word letter that you selected from an R:BASE dynamic menu in the R:BASE application. Considerations """""""""""""" Here are some considerations to keep in mind when you use ZIP RETURN: o RBZIP remains memory resident during the execution of the software program you zipped to. But RBZIP only takes up a tiny amount of the available system base memory, approximately 12-15K. o When you execute ZIP RETURN, R:BASE closes all files and drops all open cursors. If you need the cursors, you must redeclare them upon return from the ZIP RETURN. o ZIP RETURN doesn't put a DOS error level value into the R:BASE error variable as does ZIP. o When ZIP RETURN returns control to an application, it can't return to the same menu selection that was chosen to invoke the ZIP RETURN command. ZIP RETURN returns to the first choice on the application's main menu. Conclusion """""""""" ZIP RETURN gives you Dynamic Application Integration. Now you can take full advantage of the capabilities and power available in other programs in your R:BASE application. DAI enables developers and users to precisely tailor an application to retain prior investments while adding new enhancements.