Before you continue on to look at the parameters that you can pass to a RUN statement, you should understand a little about how the AVM searches for procedures. When you type RUN h-CustSample.p, how does the AVM know where to look for it?
The AVM uses its own directory path list, called the Propath, which is stored as part of its initialization (progress.ini) file. When you install OpenEdge, you get a default progress.ini file in the bin subdirectory under your install directory. You can also create a local copy of this file if you want to change its contents.
If you want to look at and maintain your Propath, there's a tool to do that for you. It's one of a number of useful tools you can access from the Procedure Editor.
To access these tools from the Procedure Editor, select Tools > PRO*Tools. The PRO*Tools palette appears:
You can reposition and reshape the PRO*Tools palette. To retain the palette's new shape and position permanently:
1. Right-mouse click on the PRO*Tools palette outside the area where icons are displayed. The Menu Bar pop-up menu item appears:
2. Select the Menu Bar pop-up item. A File menu appears at the top of the palette:
Using this tool you can add more useful tools of your own to the palette. For now, however, all you need to note is that the Save Current Palette Position and Orientation toggle box lets you save these settings permanently, so that the PRO*Tools palette always comes up the way you want each time you start OpenEdge.
4. Leave the Save Current Palette Position and Orientation toggle box checked on, then click OK.
To view and edit your Propath, click the Propath icon
from the PRO*Tools palette.
The Propath Editor shows you a list of all the directories in which the AVM looks, both to find all its own executable files and other supporting files, and to find your application procedures. Here is the default Propath you get when you install the product:
As you can see, the AVM first looks in your current working directory (by default, C:\OpenEdge\WRK). This is where it expects to find any procedures you have written and are trying to compile or run. After that it looks in the gui directory under your OpenEdge install directory. This is where it expects to find the compiled r-code for all the ABL procedures that support your development and run-time environments. Remember that most of the OpenEdge development tools, including the Procedure Editor, are themselves written in ABL.
In the gui directory are a number of procedure libraries, each with a .pl filename extension. These are collections of many .r files, gathered together into individual operating system files. The adecomm.pl file, for example, is a library of many dozens of procedures that are common to the development tools, called the Application Development Environment (ADE). It's more efficient to store them in a single library because it takes up less space on your disk and it's faster to search.
Following these procedure library files is the install directory itself. This holds a few startup files as well as the original versions of the sports2000 database and other sample databases shipped with the OpenEdge products.
Next is the bin directory. This is where all the executable files are located, including all the supporting procedures for compiling and running your application, which are not written in ABL. Finally, there are a couple of directories that support building a custom OpenEdge executable.
Do not modify any of the directories below the current directory. If you try to, the AVM resets the Propath, because it recognizes that the tools will stop running if it can't find all the pieces it needs. But you can add directories above, below, or in place of your current working directory. For example, if you save your r-code into a different directory using the SAVE INTO option on the COMPILE statement, then you must add this directory to your Propath.
When you COMPILE or RUN a procedure, you can specify a partial pathname for it relative to some directory that is in your Propath. For example, if you save something called NextProc.p into a subdirectory called morecode, you can run it using this statement:
RUN morecode/NextProc.p.
Note: You should always use forward slashes in your ABL code, even though the DOS and Windows standard is backslashes. The AVM does the necessary conversions to make the statement work on a PC, but if some of your ABL code is written for another platform, such as UNIX, then it requires the forward slashes.
You can modify your Propath by using the Add, Modify, and Remove buttons in the Propath Editor.
If the AVM is having difficulty locating a procedure that you've written, or if you have different versions of a procedure in different directories you can check to see how the AVM searches for a particular procedure.
To verify which file the AVM finds:
1. In the Propath Editor, click the Search button. The Propath File Search dialog box appears:
2. Enter the name of the procedure, including the relative pathname if that's part of your RUN statement. Also include the same filename extension you are using in your code.
3. Click the Search button. the AVM displays all the versions of that file it can find, in the order in which it uses them. Thus the one at the top of the list is always the one the AVM tries to execute. In this example, the display confirms that when you run h-CustSample.p, it chooses the .r file (if there is one) in preference to the source procedure:
If you save your r-code to a different directory (or set of directories) than you use for the source procedures, remember to construct your Propath in such a way that the r-code is found first if it is there, but that the source procedures are also found, at least when you are in development mode, without requiring a special relative pathname in your code to locate them.
In the OpenEdge install directories, for example, all the compiled ABL procedures are under the gui directory. The corresponding source procedures are in an equivalent directory tree, but under an src directory. If you were to add the src directory to your Propath, then the AVM could locate source procedures to compile and execute on the fly as needed. If you were to place the src directory above the gui directory in your Propath, then the AVM would use all the source procedures and compile them on the fly because it finds them first. This would slow down your program execution dramatically. This is just an example of how, as you develop complex applications, you must be careful to arrange your Propath so that the AVM can find the procedures it needs efficiently, without doing a lot of unnecessary searching or running uncompiled procedures.