Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, Language Reference Manual

CONVERSION condition

Status
CONVERSION is enabled throughout the program, except within the scope of the NOCONVERSION condition prefix. You can use the ONSOURCE, ONCHAR, ONGSORCE and ONWSOURCE pseudovariables in CONVERSION ON-units to correct conversion errors.
Result
When CONVERSION is raised, the contents of the entire result field are undefined.
Cause and syntax
The CONVERSION computational condition is raised whenever an invalid conversion is attempted on character, widechar or graphic data. This attempt can be made internally or during an input/output operation. For example, the condition is raised when:

All conversions of character data are carried out character-by-character in a left-to-right sequence. The condition is raised for each invalid character. The condition is also raised if all the characters are blank, with the following exceptions:

Note that if a null string or a string of one or more blanks is assigned to a numeric variable, the CONVERSION condition will not be raised.

When an invalid character is encountered, the current action specification for the condition is executed (provided that CONVERSION is not disabled). If the action specification is an ON-unit, the invalid character can be replaced within the unit.

If the CONVERSION condition is raised and it is disabled, the program is in error.

If the CONVERSION condition is raised during conversion from graphic data to nongraphic data, the ONCHAR and ONSOURCE built-in functions do not contain valid source data. The ONGSOURCE built-in function contains the original graphic source data. The graphic conversion is retried if the ONGSOURCE pseudovariable is used in the CONVERSION ON-unit to attempt to fix the graphic data that raised the CONVERSION condition. If the ONGSOURCE pseudovariable is not used in the CONVERSION ON-unit, the ERROR condition is raised.

Read syntax diagramSkip visual syntax diagram>>-CONVERSION--------------------------------------------------><
 
Abbreviation
CONV
Implicit action
A message is printed and the ERROR condition is raised.
Normal return
If CONVERSION was raised on a character string source (not graphic source) and either ONSOURCE or ONCHAR pseudovariables are used in the ON-unit, the program retries the conversion on return from the ON-unit.

If CONVERSION was raised on a graphic source and the ONGSOURCE pseudovariable is used in the ON-unit, the program retries the conversion on return from the ON-unit.

If CONVERSION was raised on a widechar source and the ONWSOURCE pseudovariable is used in the ON-unit, the program retries the conversion on return from the ON-unit.

If the conversion error is not corrected using these pseudovariables, the program loops.

Condition codes
600-672

Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)