Class Source Code (.cls) vs. Run-time Code (.r) Reference Order

KMoody

Member
If I reference a static class within a program (example: "x:methodname();"), why would Progress reference the source code of a class (X.CLS) instead of its run-time code (X.R)?

Here's my situation:

I have the following PROPATH in my dev environment:

Code:
PROPATH=.,P:\APPS\dev,C:\src\dev,P:\APPS\live,C:\src\live

I store all of my source code (.cls, .p) in "src" directories and my run-time code (.r) in "APPS" directories.

I have two versions of a class called X.CLS . There's a revised version of X.CLS in C:\src\dev and an old version of X.CLS in C:\src\live. However, I have only compiled the old version of X.CLS into P:\APPS\live as X.R.

In other words, the contents of the folders look like this:
  • P:\APPS\dev
    • (Empty)
  • C:\src\dev
    • X.CLS (Version 2)
  • P:\APPS\live
    • X.R (Version 1)
  • C:\src\live
    • X.CLS (Version 1)

When I start up Progress using the PROPATH above, the program references the version of X.CLS in C:\src\dev instead of its run-time code X.R in P:\APPS\live.

It seems to do this because X.CLS is in the first directory in the PROPATH. However, Progress doesn't do that with .p source files unless they're explicitly called in the code (example: "run program.p").
 

Stefan

Well-Known Member
I would find it strange if it did not do what you are seeing.

A .p and a .cls are both source files. When a .p is run, each propath entry is first searched for a .p, if this does not exist then for a .r, move to next propath entry. With class files you do not indicate if you want the compiled or uncompiled version, you just indicate the class, so the behavior is IMHO comparable to running .p sources.

See also Progress KB - How does Progress search for compiled ( .r ) and uncompiled ( .p ) code in the PROPATH?
 

KMoody

Member
Thanks, Stefan.

So what happens when a program executes "RUN X" (no .r or .p)? In this case, Progress in my environment never runs the .p; it only looks for .r files in the PROPATH. That's why I'm surprised to see Progress reference source code instead of run-time code at all when I reference classes.
 

Stefan

Well-Known Member
When no .r / .p is specified on the run statement you are running an internal procedure - ie a procedure defined within the .p.

Although the documentation indicates that a .r can also be run if the internal procedure does not exist:

When running an external procedure, it is good practice to specify the name of the source file in the RUN statement. For example, to run r-exit.p you specify the following:

RUN r-exit.p

When you specify a suffix or file extension (such as .p), the AVM first tries replacing that suffix or extension with .r and searches the first directory on your PROPATH for a file with that name. If the r-code file is not found, then it reverts to the original suffix and searches for a source file with that name. If the source file is not found in the first PROPATH directory, then the AVM searches for an r-code file and then a source file in each subsequent directory on your PROPATH until a file is found.

If you specify the .r suffix in the RUN statement, then the AVM searches only for an r-code file in each directory on your PROPATH. If you omit the extension, then the AVM first adds a .r to the name you specify and searches the first directory for an r-code file with that name. If none is found, then the AVM searches for a source file with no suffix or extension.

All madness as far as I'm concerned.
 
Last edited:
Top