The COBOL language provides some "figurative constants" like ZEROS SPACES, HIGH-VALUES, etc., that can be convenient to use.
There's something I've never understood about this.
What is the purpose of the figurative constant QUOTE or QUOTES, which corresponds to one or more times the character " .
What was the intention of the creators of the COBOL language regarding this topic ?
Does anyone know ?
Has anyone ever used it ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I dont know it for sure but maybe in the early days of COBOL there was no possibility for masking the character " itself like \" or "" like in other languages?
Personally I found this code more readable with the usage of QUOTE instead of using the character " six more times:
Yesm have used quote/s although not often and have used zero/s, spaces often and even high-values.
That said the 'quote" is restricted to double quote so you have do some thing else for the singleton. i.e., "'" for for qquote use ' " ' horses for courses etc.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
A point that I forgot to mention was figurative values like zero, space, quote, high-values etc, when used a compiler generates ONE character for them while doing a :
move 0 to x multiple times create a new variable for 0 used, each time and this is a benefit of reducing ram usage for the program.
Of course the above could vary depending on the compiler and if it is a multiple pass compiler - I do not beleave that GC is of this bred that do a clean up exercise before code gen.
I could be wrong though :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Also: many compilers allow to replace the meaning of QUOTE; as far as I know all default to ", but OC/GC, MF, IBM and others have options like the APOST (or QUOTE) directives to toggle that, GnuCOBOL additionally provides -fsingle-quote / -fno-single-quote (default).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Going back to IBM 1401 or perhaps even earlier, single quote was the standard. I'm not sure the double quote even existed in some print chains. Around the time of IBM COBOL II or COBOL/MVS, the IBM COBOL compilers allowed you to use either single quotes or double quotes to indicate a literal text string, as long as it ended with same type of character as the beginning. So this would be perfectly valid in modern IBM COBOL:
INSPECT ITEM CONVERTING
"ABCD" TO "XYZX" AFTER '"' BEFORE "#"
INSPECT ITEM CONVERTING
'ABCD' TO 'XYZX' AFTER "'" BEFORE "#"
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
For OS-VS both are allowed via the compiler option APOST.
For the IBM 7094 it is a single as per :
C28-6391-0_v13_7094-COBOL.pdf
Vince
Now I could go and look at ICL/ICT manuals for 1900, 1500 and 1300
series but I have now gotten bored with it all :)
Vince
On 10/03/2026 06:07, Arnold Trembley wrote:
Going back to IBM 1401 or perhaps even earlier, single quote was the
standard. I'm not sure the double quote even existed in some print
chains. Around the time of IBM COBOL II or COBOL/MVS, the IBM COBOL
compilers allowed you to use either single quotes or double quotes to
indicate a literal text string, as long as it ended with same type of
character as the beginning. So this would be perfectly valid in modern
IBM COBOL:
INSPECT ITEM CONVERTING
"ABCD" TO "XYZX" AFTER '"' BEFORE "#"
INSPECT ITEM CONVERTING
'ABCD' TO 'XYZX' AFTER "'" BEFORE "#"
For that you will have to go back to the original specs dated around 1958/9 and as amended 1960 BUT I am going on very old memory here - Mine.
The 1401 was one of the first to implement Cobol on bulk sales m/f kit - I have'major' revised manuals dated 1964 so clearly well before that plus Leo 3 that predates that by a lot as it was the first programmable computer offered for sale pre-1960 and I seem to recall with Cobol but I no longer have the manuals for it as there is only one of them in the UK still running (or was).
Some where on my system there are other manuals but for the moment cannot find them but I do have to go through some 5+ TB of file areas etc.
Life is too short :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The COBOL language provides some "figurative constants" like
ZEROS SPACES, HIGH-VALUES, etc., that can be convenient to use.There's something I've never understood about this.
What is the purpose of the figurative constant
QUOTEorQUOTES, which corresponds to one or more times the character".What was the intention of the creators of the COBOL language regarding this topic ?
Does anyone know ?
Has anyone ever used it ?
I dont know it for sure but maybe in the early days of COBOL there was no possibility for masking the character " itself like \" or "" like in other languages?
Personally I found this code more readable with the usage of QUOTE instead of using the character " six more times:
Output:
But this is just my try for an explanation :-)
Yesm have used quote/s although not often and have used zero/s, spaces often and even high-values.
That said the 'quote" is restricted to double quote so you have do some thing else for the singleton. i.e., "'" for for qquote use ' " ' horses for courses etc.
A point that I forgot to mention was figurative values like zero, space, quote, high-values etc, when used a compiler generates ONE character for them while doing a :
move 0 to x multiple times create a new variable for 0 used, each time and this is a benefit of reducing ram usage for the program.
Of course the above could vary depending on the compiler and if it is a multiple pass compiler - I do not beleave that GC is of this bred that do a clean up exercise before code gen.
I could be wrong though :)
GnuCOBOL caches all literals :-)
The general example given is that this is mostly about readability - compare the following:
Also: many compilers allow to replace the meaning of QUOTE; as far as I know all default to
", but OC/GC, MF, IBM and others have options like theAPOST(orQUOTE) directives to toggle that, GnuCOBOL additionally provides-fsingle-quote/-fno-single-quote(default).Going back to IBM 1401 or perhaps even earlier, single quote was the standard. I'm not sure the double quote even existed in some print chains. Around the time of IBM COBOL II or COBOL/MVS, the IBM COBOL compilers allowed you to use either single quotes or double quotes to indicate a literal text string, as long as it ended with same type of character as the beginning. So this would be perfectly valid in modern IBM COBOL:
INSPECT ITEM CONVERTING
"ABCD" TO "XYZX" AFTER '"' BEFORE "#"
INSPECT ITEM CONVERTING
'ABCD' TO 'XYZX' AFTER "'" BEFORE "#"
On IBM ANSI Cobol as for the 1401 it uses a double quote i.e., "
As defined in manual :
GC28-6396-6_IBM_OS_Full_American_National_Standard_COBOL_Apr76.pdf
For OS-VS both are allowed via the compiler option APOST.
For the IBM 7094 it is a single as per :
C28-6391-0_v13_7094-COBOL.pdf
Vince
Now I could go and look at ICL/ICT manuals for 1900, 1500 and 1300
series but I have now gotten bored with it all :)
Vince
On 10/03/2026 06:07, Arnold Trembley wrote:
I thought that it originated in the same way as decimal point is comma.
For that you will have to go back to the original specs dated around 1958/9 and as amended 1960 BUT I am going on very old memory here - Mine.
The 1401 was one of the first to implement Cobol on bulk sales m/f kit - I have'major' revised manuals dated 1964 so clearly well before that plus Leo 3 that predates that by a lot as it was the first programmable computer offered for sale pre-1960 and I seem to recall with Cobol but I no longer have the manuals for it as there is only one of them in the UK still running (or was).
Some where on my system there are other manuals but for the moment cannot find them but I do have to go through some 5+ TB of file areas etc.
Life is too short :)