Local Char WITMREF(20)
But like almost everything in X3, the length of an alphanumeric data type can be personalized. Also, it might change between versions of the software. If at some point in the future the length of the ITM data type changes to a value greater than 20, the above code will break.
So you might think of giving the variable a crazy upper limit:
Local Char WITMREF(200)
This will work for all practical purpoces, but it is a waste of resource, especially when you have a better alternative. This alternative comes in the form of the GLON variables.
The GLON variables are global variables maintained internally by X3. The name of each one starts with GLON and ends with the abbreviation of the corresponding alphanumeric data type. So for the ITM data type the corresponding GLON variable is GLONITM. The value of each GLON variable is the length of the corresponding data type. This value is updated on data type validation, so even if you customize your data type lengths or they change between versions, the GLON variable is guaranteed to hold the correct value.
And here is the proper way to define an ITM data type variable:
Local Char WITMREF(GLONITM)
Replacing ITM with another data type abbreviation, this will work for all other alphanumeric data types as well.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.