Natural for Mainframes Version 8.2.6 for Mainframes
 —  Programming Guide  —

Text Notation

In an INPUT, DISPLAY, WRITE, WRITE TITLE or WRITE TRAILER statement, you can use text notation to define a text to be used in conjunction with such a statement.

This document covers the following topics:


Defining a Text to Be Used with a Statement - the 'text' Notation

The text to be used with the statement (for example, a prompting message) must be enclosed in either apostrophes (') or quotation marks ("). Do not confuse double apostrophes ('') with a quotation mark (").

Text enclosed in quotation marks can be converted automatically from lower-case letters to upper case. To switch off automatic conversion, change the settings in the editor profile.

The text itself may be 1 to 72 characters and must not be continued from one line to the next.

Text elements may be concatenated by using a hyphen.

Examples:

DEFINE DATA LOCAL
1 #A(A10)
END-DEFINE

INPUT 'Input XYZ' (CD=BL) #A
WRITE '=' #A
WRITE 'Write1 ' - 'Write2 ' - 'Write3' (CD=RE)
END

Using Apostrophes as Part of a Text String

The following applies, if (Translate Quotation Marks) is set to ON. This is the default setting.

If you want an apostrophe to be part of a text string that is enclosed in apostrophes, you must write this as double apostrophes ('') or as a quotation mark ("). Either notation will be output as a single apostrophe.

If you want an apostrophe to be part of a text string that is enclosed in quotation marks, you write this as a single apostrophe.

Examples of Apostrophe:

#FIELDA = 'O''CONNOR'
#FIELDA = 'O"CONNOR'
#FIELDA = "O'CONNOR"

In all three cases, the result will be:

O'CONNOR

Using Quotation Marks as Part of a Text String

The following applies, if the Natural profile parameter TQ (Translate Quotation Marks) or the keyword subparameter TQMARK of the Natural profile parameter CMPO is set to OFF. The default setting is ON.

If you want a quotation mark to be part of a text string that is enclosed in single apostrophes, write a quotation mark.

If you want a quotation mark to be part of a text string that is enclosed in quotation marks, write double quotation marks ("").

Example of Quotation Mark:

#FIELDA = 'O"CONNOR'
#FIELDA = "O""CONNOR"

In both cases, the result will be:

O"CONNOR

Top of page

Defining a Character to Be Displayed n Times before a Field Value - the 'c'(n) Notation

If a single character is to be output several times as text, you use the following notation:

'c'(n)

As c you specify the character, and as n the number of times the character is to be generated. The maximum value for n is 249.

Example:

WRITE '*'(3)

Instead of apostrophes before and after the character c you can also use quotation marks.

Top of page