When using the CAST function, it can possibly cause hard errors on the iSeries. The side effects is the job will be terminated and Query will be disconnected. The following errors are found in the ShowCase server joblog:
CPF5029 - Data mapping error (several possible) SQ76783 - 'text not available for message SQ76783 file QSQLMSG ' - Severity 00 CPF2419 - 'Message id SQ76783 not found in QSQMSG CPF9999 - Function check CPF2419 unmonitored by RSCGWYP SQL0433 'Significant digits truncated during CAST from numeric to character.'
By specifying how large the result will be, the CAST function will work.
FIELD1 is a Packed 5,2 field, which gives a format of XXX.XX.
These two expressions will generate the error: CAST(FIELD as CHAR), and CAST(FIELD as CHAR(5)).
This expression will not cause the error: CAST(FIELD as CHAR(6))
Even though the field is length 5, you must add a position for the decimal point.
Still have questions? We can help. Submit a case to Technical Support.