Adding Multiple Logic Files to an Application


This code looks like it will not compile correctly:

PROC GLOBAL

PROC APPLICATION_FF

preproc

   
errmsg("Welcome to CSPro, this is version %s",versionNumber());

The compiler may complain that versionNumber is not a function that exists. However, starting in CSPro 4.1.002, you can attach multiple logic files to an application. In this case, if versionNumber is defined in a different file, the code will compile successfully.

When compiling your code, CSPro will load any additional logic files as if the text of these files were inserted in PROC GLOBAL. This means that only things that can go in PROC GLOBAL can be declared in an external logic file, but that includes variables, arrays, and user-defined functions that you use across many applications. In the above example, I might create a file, myfunctions.app, that contains code that I use frequently. It would look like this:

function alpha versionNumber()

    versionNumber = 
"4.1.002";

end;

There is no need to write PROC GLOBAL in this external logic file. To add the file to the application, I select File -> Add Files, and then select my External Logic File:

20111209include

These files are listed in the tree in the Files window under the main logic file for your application. External logic files can be removed by selecting File -> Drop Files.

Download the above example as a batch application.