Article ID 1236
Article Title DEFECT: Using exclamation point ! in DataFlex code strings
Article URL http://www.dataaccess.com/kbasepublic/KBPrint.asp?ArticleID=1236
KBase Category Visual DataFlex
Date Created 12/18/2000
Last Edit Date 06/20/2002


Article Text
PROBLEM:
There are many symptoms of this particular compiler problem, including:
- I am using an exclamation point in a string, but the string gets cut off after the exclamation point.
- I am using an exclamation point in a string, and the code after this line seems to be ignored. Even though I have a begin...end block around some code, the compiler thinks the end is missing.
- I am using an exclamation point in a string, but when I run the program, the exclamation point is replaced by some other symbol.

All of these symptoms eventually lead back to the use of an exclamation point followed by another character in a string, such as:

!X,
    where X is any alphanumeric character

EXPLANATION:
This is a Visual DataFlex/DataFlex compiler problem. The problem goes back to I-code, which is the code that native DataFlex commands are written in. You can see I-code in the FMAC file, which is the file that contains most native DataFlex code commands in DataFlex and Visual DataFlex/WebApp Server. In I-code, an exclamation point followed by a character is interpreted as a compiler variable. Unfortunately, the compiler is unable to discern when to interpret !X as a compiler variable or just a plain string character.

This issue is on our list of known defects, but it has to be dealt with delicately and tested rigorously, since fixing this particular problem could break more things than it repairs. It will be fixed at some point, but we cannot set a definitive time frame for this.

This problem does not affect exclamation points in strings at runtime, such as text in database fields, only DataFlex programming code.


SOLUTION 1:
Do not use exclamation points followed by other characters in strings in your DataFlex code. If you must use an exclamation point in a string, use it only to terminate the string, or concatenate the string from multiple strings.

EXAMPLE:

INCORRECT:
string sTmp
move "You may use these characters in this application: ABCabc!1234567890." to sTmp

CORRECT:
string sTmp
move "You may use these characters in this application: ABCabc!" to sTmp
move (append(sTmp,"1234567890.")) to sTmp

or

string sTmp
move ("You may use these characters in this application: ABCabc!" +
"1234567890.") to sTmp


SOLUTION 2:
#replace EXCLAMATION (character(33))

move (EXCLAMATION + "ABC") to sStringVariable



Links Related to this Article
DAW Knowledge Base article 1237: DEFECT: Using comments // in DataFlex code strings

Email this Article
Email this Article to a Colleague
Send Feedback on this Article to Data Access Worldwide
Copyright ©2024 Data Access Corporation. All rights reserved.

The information provided in the Data Access Technical Knowledge Base is provided "as is" without warranty of any kind. Data Access Corporation disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. In no event shall Data Access Corporation or its suppliers be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages, even if Data Access Corporation or its suppliers have been advised of the possibility of such damages. Some states do not allow the exclusion or limitation of liability for consequential or incidental damages so the foregoing limitation may not apply.