Text Operation Error Status (STR_ERR_STAT)
When an error occurs during execution of text operation, an error is set to the Text Operation Error Status [e: STR_ERR_STAT]. "0" in [e: STR_ERR_STAT] indicates a normal condition, and values other than "0" stored in [e: STR_ERR_STAT] indicate error states. The most recent error is stored in the Text Operation Error Status [e: STR_ERR_STAT]. The Text Operation Error Status can be set up with [SIO Port Operation/Label Settings] under the D-Script Toolbox menu. The following table lists the text operation errors.
Error Number 0/Normal
Error Number 1/Text overflow
A string of at least 256 bytes is directly included in the argument for the following functions: _strset ( ), _strlen ( ), _strcat ( ), _strmid ( ), and IO_READ_WAIT ( ).
Or, a string exceeding the data buffer size is created during execution of the _strcat ( ) or _ldcopy ( ) function.
For example,
_strcat(databuf0, databuf1)
the above function is executed when a string of 1020 bytes is stored in databuf0, and a string of 60 bytes is stored in databuf1. (A string exceeding 1024 bytes, the size of the data buffer, results in an error status.)
Error Number 2/Text conversion error
Invalid character code is given to the _hexasc2bin ( ) or _decasc2bin ( ) function.
For example,
a character code other than "0" to "9", "A" to "F", or "a" to "f" is included in the second parameter for _hexasc2bin ( ).
Error Number 3/Text extraction error
Retrieval of a character string longer than the character string specified with the "_strmid ( )" Function is attempted. Or, an offset value greater than the specified string is designated.
For example,
_strmid(databuf0, "12345678", 2, 8)
Retrieval of an 8-character string from offset 2 is attempted
The String Control Error Status cannot be used with D-Scripts and Global D-Scripts. If it is read out accidentally, "0" will be loaded.
It is stored in the Error Status during execution of each function.
To check the error [e: STR_ERR_STAT], write the following statements. You can confirm the error with the following expression.
Example expression:
if ([e:STR_ERR_STAT] <> 0) // Check error status.
{
set ([b:[#INTERNAL]LS005000]) // Set bit of error lamp.
}
endif
The processing is terminated when an error occurs and returns to the beginning of the Main function. (If the command comes while a function is running, it returns to the line that called that function.)