Welcome to myCobol.ovh Monday, 29 September 2025, 04:36

Discover Q

  • Contributed by:
  • Views: 1,682
CoCoS Cobol is English. Naming things in Cobol, if English is your mother tongue, could be tricky since there are so much reserved words defined.
Apply some tricks to avoid a clash with reserved words.

The letter Q is very rare in common sense language. So is the letter X. These can be used prudently.

CoCoS suggests to overcome a clash with reserved words:

-> prepend a paragraph name with a four-digit sequence number,
-> put a Q (a q that is) in front of any name that could possibly be a reserved word,
-> append one or more X's (x's that is) to any name that could possibly be a reserved word.

CoCos also suggests for paragraph names:

-> use a general format of 9999-myparagraph, where 9999 runs from 0000 to 9999,
-> have the paragraph names sorted by the prefix in your Cobol Text,
-> suggested meaning of the prefix:
-->0100 - 0200 initializing
-->0900 closing, shut down
-->1000 - 1999 general processing, first level
-->2000 - 2999 specific processing, second level

CoCoS also suggests that, if you use the X technique that

->try to name variables with a fixed length, f.i. stick to 8 characters
append as many X's to reach that fixed length

CocoS also suggests to not use the Q and X together.