Feedback
Did this article resolve your question/issue?

   

Article

FORMAT string causes compiler error (22).

Information

 
TitleFORMAT string causes compiler error (22).
URL NameFORMAT-string-causes-compiler-error-22
Article Number000110864
EnvironmentProduct: OpenEdge
Version: All supported versions
OS: All supported platforms
Other:
Question/Problem Description
If in a FORMAT string, the number of digits (combination of '>'s and 9s) to the left of the decimal point is less than the number of digits to the right of the decimal point, the compiler issues the following error:

** Character number <character> of format <format string> is invalid. (22)

This has been observed in ADD FIELD statements in database definitions and DEFINE VARIABLE statements.
For example:

DEFINE VARIABLE myVar AS DECIMAL FORMAT ">>>>9.9<<<<".
compiles successfully while the following:

DEFINE VARIABLE myVar1 AS DECIMAL FORMAT ">>>9.9<<<<".
causes the compiler error listed above.
Steps to Reproduce
Clarifying Information
This has been observed as far back as Progress version 9.
Error Message** Character number <character> of format <format string> is invalid. (22)
Defect/Enhancement Number
Cause
The exact cause is not known at this time.
Resolution
None at this time.
Workaround
When creating a FORMAT string, ensure that the number of digits (combination of '>'s and '9's) to the left of the decimal point is greater than or equal to the number of digits ('<'s and 9s) to the right of the decimal point.

The following are a few examples that demonstrate the workaround:
In the first case, the number of digits (combination of '>'s and '9's) to the left of the decimal point is equal to the number of digits to the right of the decimal point. This is considered syntactically correct and does not cause a compiler error.

DEFINE VARIABLE myVar AS DECIMAL FORMAT ">>>>9.9<<<<".

In the second example the number of digits (combination of '>'s and '9's) to the left of the decimal point is less then the number of digits to the right of the decimal point. This is considered syntactically incorrect and will cause a compiler error.

DEFINE VARIABLE myVar1 AS DECIMAL FORMAT ">>>9.9<<<<".

In the third case the number of digits (combination of '>'s and '9's) to the left of the decimal point is greater than the number of digits to the right of the decimal point. This is considered syntactically correct and will not result in a compiler error.

DEFINE VARIABLE myVar2 AS DECIMAL FORMAT ">>>>>9.9<<<<".

 
Notes
Last Modified Date4/9/2018 4:04 PM
Attachment 
Files
Disclaimer The origins of the information on this site may be internal or external to Progress Software Corporation (“Progress”). Progress Software Corporation makes all reasonable efforts to verify this information. However, the information provided is for your information only. Progress Software Corporation makes no explicit or implied claims to the validity of this information.

Any sample code provided on this site is not supported under any Progress support program or service. The sample code is provided on an "AS IS" basis. Progress makes no warranties, express or implied, and disclaims all implied warranties including, without limitation, the implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample code is borne by the user. In no event shall Progress, its employees, or anyone else involved in the creation, production, or delivery of the code be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample code, even if Progress has been advised of the possibility of such damages.