I have encountered this error while cleaning up some butt ugly code. I may sound a bit harsh, but I feel I am accurate. See my BACKGROUND section below.
I am not looking specifically for an answer so much as:
1: I welcome comments and opinions of other Cim Coders.
2: I intend to post my resolution should it be of any use to others.
3: I need a place to vent.
I came back to the Cimplicity forums because I wanted to find out the maximum size of a script and I remembered that it was certainly discussed here. Yes, it was and I even participated in the discussion - 7 years ago! See the REFERENCE.
So, as I said, I am CLEANING up code. Did I add the straw that broke the camels back? Perhaps, but as I checked, the physical byte size of all the NEW code (305,955) and comments
IS LESS THAN the physical byte size of all the code and comments in the old code. (325,744)
So the question is, did I add 'real' code -- the answer is Yes. I did two things to the old code:
1: I added 'LogStatus' commands in every existing On Error block. This results in only a small addition of code -- 44 lines, 2914 bytes
2: I elimated multidimension arrays that held string literals, replacing the references to the array element with the string literal. ( Again See BACKGROUND ) This does add a lot to the length of literal strings, but not so much as you might think to the number of literal strings. I do not have exact numbers as that is something harder to calculate.
REFERENCE:
Please see forum post "Doubts about scripting error message"
http://forums.ge-ip.com/showthread.php?t=2509
BACKGROUND:
Once again I am inheriting butt ugly code and I am forced to understand it, fix it, and if time permits even improve it.
Yes, it is butt ugly, here is why.
The entire screen contains over 490 embedded SQL statements. To make matters worse, the table names and column names are stored in string arrays. The column names are in a two dimensional array, and the table names are in three different one dimensional arrays. The code is on the screen object, and 18 button objects. Each object has it's own routine to Initialize the array elements with the actual table names and the actual column names. No attempt at consistency has been made, meaning that ColumnName(3,7) will vary from object to object. However, it must be noted that within an object ColumnName(3,7) always has one value, it never changes.
So, I have programatically coverted something like this:
ColumnName(3,1) = "ConveyorID"
...
ColumnName(3,7) = "ConveyorName"
...
sql$ = "select " + ColumnName(3,7) + ", " + ColumnName(3,1) + " from " + DataTable(3) + " where " + ColumnName(3,1) + " = " + fieldvalue
to this:
sql$ = "select ConveyorName, ConveyorID from Conveyors where ConveyorID = " + fieldvalue
I also removed the routine that intialized all the array elements and deleted the DIM statements for the arrays. In general, I should have less code?? ( And certainly more readable SQL ). So I am suprised to get the Error 76 Script is too large to compile.