Omit Cannot be nested - work around

Most of the time when I want to nest conditional OMITs and/or COMPILES it works as desired.
However sometimes the compiler complains about it.

Note: you do have to be careful to make sure that the 1st argument (the terminator string), is NOT a substring of an another OMIT/COMPILE

The HELP for OMIT says

The compiler reads and parses source/include files by blocks. If the end of an OMIT/COMPILE block (terminator string) is found in the current block, the compiler either with skip the text up to terminator or will continue to parse the file - depending on whether you are using OMIT or COMPILE and what condition. If the terminator string is found within the current block and parsing is continuing, nested OMIT/COMPILE statements are allowed. If the terminator string is not found, nested OMIT/COMPILE statement in this block is not allowed.

In summary, nesting of OMIT/COMPILE statements is dependent on the current compiler block. Use of conditions in OMIT/COMPILE statements and possibility to define complex conditions as EQUATEs are allowed to avoid excessive nesting of OMIT/COMPILE statements.

So what is a block of code?
To me this means that the compiler reads X bytes of code at a time from your source
I’m not sure what the value is for X - it’s probably a “round number” like 4K, 8K, or 16K
But I guess it doesn’t really matter.

So today I tried something new when I hit “Omit cannot be nested” problem
I added a comments above the code where I was nesting omits
to move the nesting omit/compiles to another block of code.

I still had the error when I compiled
So I added more comments, and compiled again
and kept repeating the process until I got a clean compile.
In this case, I added about 2500 characters in the comments


the nesting was added in 2015

/— Clarion 10.11632 beta 3 — February 27, 2015 ----- Fixes/Changes/Features–/


FEATURE: Compiler: support of nested OMIT/COMPILE blocks

but as you note it is somewhat limited.

that was a BIG comment you added.

I really wish this issue could be resolved
Recently I’ve been adding a lot of OMIT/COMPILEs and I’m having to use the work around multiple times a day

@also - do you have any ideas ?

The new CLW compiler scanner with support of nested OMIT/COMPILE directives and other enhancement and fixes was released to the code base in 2013 as a part of C9. SuRF accidentally killed made changes on creating a new SVN branch. This mistake was not found until the next phase of the work on the compiler (implementing USTRINGs, 64-bit integers, etc.). So, I guess, the compiler in future C11.2 or C12 likely will support nested OMITs/COMPILEs.