hi Joachim, sharing your pain here. In fact this is a very old problem when the GDL interpreter make assumptions of what types the varilables are PRIOR to execution and over-zealously stop the script even if the problem was avoided by vartype conditions.
In my experience this gets a LOT worse when the variable in question is an array received from RETURNED_PARAMETERS, LIBRARY_GLOBAL and file operations. I see that GS themselves would give the first element of each array an arbitrary value immediately after dimensioning, so that the interpreter will pick up the vartype. However this does not work all the time. I cannot consistently work out when it works and when it doens’t – seems sporadic.
Bond Bryan Architects, Westerham, UK