A-Shell supports thirteen levels of nested ++INCLUDEs. This is primarily useful to allow modular include files to themselves include all of the necessary modules they require, thus relieving the programmer from having to include the entire network of dependent modules in the main source file. Nesting does introduce two complications worth further discussion: how to avoid including the same module twice (see One Time ++INCLUDE), and how to keep track of the hierarchy of nested includes, particularly when it comes to locating the module containing an error flagged by the compiler.
To help you visualize the hierarchy of ++INCLUDE processing, the compiler normally (absent the /S switch) lists the included file names as it processes them, indenting to indicate the level, e.g.:
.compil sqltest4/x:2
Phase 1 - Initial work memory is 16944 bytes
Copying from ASHELL.DEF[907,16]
Copying from FNSQLSTATE.BSI
Copying from FNEXTCH.BSI[907,10]
?Syntax error (++40) - this is an error
Copying from FNSQLATR.BSI
...
The above example illustrates two levels of ++INCLUDE processing. The files SOSLIB:ashell.def and fnsqlstate.bsi are included directly from the main program at the first level, and the file fnextch.bsi is included from within fnsqlstate.bsi at the second level, which we can tell based on the fact that it is indented. The standard error message does not directly indicate which file the error occurred in, but it outputs a "+" in front of the line number for each level of ++INCLUDE nesting. Thus, the "(++40)" tells us that the error was in a module nested two levels below the main program, which could only be fnextch.bsi in this example.
Another option would be to use the COMPIL Background switch, which causes the compiler to output a <prog>.lst file containing details for each error, including the module file name.
Another useful function is offered by the COMPIL List File (LF) switch, which creates a consolidated List File containing all of the ++INCLUDEd modules. The file is designed mainly to use as a cross reference for linking runtime errors to the original source code, but could be used as an aid to studying all the parts of the program in one listing.
Yet another option would be to use The A-Shell Editor, a multi-file program editor capable of identifying all of the included modules associated with the main source and jumping between them as needed.
See Also
• The A-Shell forum discussion " Managing nested ++INCLUDEs."