Salesforce

EXPORT statement puts out quoted string with extra double quotes.

« Go Back

Information

 
TitleEXPORT statement puts out quoted string with extra double quotes.
URL Nameexport-statement-puts-out-quoted-string-with-extra-double-quotes
Article Number000113085
EnvironmentProduct: OpenEdge
Version: All supported versions
O.S. All supported platforms
Question/Problem Description
Take the following code snippet:
 
DEFINE VARIABLE myBuffer AS CHARACTER NO-UNDO.
myBuffer = QUOTER("Hello").
OUTPUT TO "C:\quoter1.txt".
EXPORT myBuffer.
OUTPUT CLOSE.
Open the file quoter.txt with a text editor. In the file, the string Hello is written as """Hello""". Why are there three sets of double quotes and not just one?
 
Steps to Reproduce1) Run the code above.
2) Open the output file with an editor.
Clarifying Information
Error Message
Defect Number
Enhancement Number
Cause
This is expected behavior.

The output of the EXPORT statement is made to match up with the IMPORT statement. The extra double quotes are written to the file by the EXPORT statement so that when the file is read back in, the double quotes are "eaten" correctly and the result is "Hello".
Resolution
Change the code above to the following:
 
DEFINE VARIABLE myBuffer AS CHARACTER NO-UNDO.
DEFINE VARIABLE myBuffer2 AS CHARACTER NO-UNDO.

myBuffer = QUOTER("Hello").
OUTPUT TO "C:\quoter1.txt".
EXPORT myBuffer.
OUTPUT CLOSE.
INPUT FROM "C:\quoter1.txt".
IMPORT myBuffer2.
MESSAGE myBuffer2 VIEW-AS ALERT-BOX.
INPUT CLOSE.

The output of the MESSAGE STATEMENT is "Hello" and not """Hello""".
Please notice that the IMPORT statement is IMPORT and not IMPORT UNFORMATTED. IMPORT UNFORMATTED reads in """Hello""".
Workaround
Using the examples above, if "Hello" is what you want written to the file, use PUT UNFORMATTED "Hello". The output to to the file will be "Hello".
Notes
References to other Documentation:

Programming interfaces: Command and Utility Reference: QUOTER utility:
https://documentation.progress.com/output/ua/OpenEdge_latest/index.html#page/dvpin/quoter-utility.html


ABL Reference: ABL Syntax Reference: EXPORT statement:
https://documentation.progress.com/output/ua/OpenEdge_latest/index.html#page/dvref/export-statement.html


ABL Reference: ABL Syntax reference: IMPORT statement:
https://documentation.progress.com/output/ua/OpenEdge_latest/index.html#page/dvref/import-statement.html


Progress article(s):
 
 How to EXPORT a record dynamically.
Keyword Phrase
Last Modified Date11/20/2020 7:01 AM

Powered by