Custom Search

note the use of the continuation character,continuation character in mainframes cobol programing language

Continuation Characters

When an alphanumeric value is too long to fit on a single line, it can be continued on the next line by using a continuation character. In Listing 2.11, the columns have been included. The message must be continued to the end of Area B (column 72) and ends without a closing quote. The next line begins with a hyphen (-) in column 7 to indicate that the previous quoted string is being continued. The rest of the message starts with a quote and continues as long as is necessary to complete the message. Lines can be continued over more than one line if necessary.

Listing 2.11. The continuation character.

1 2 3 4 5 6 7 8

12345678901234567890123456789012345678901234567890123456789012345678901234567890

000500 01 LONG-MESSAGE PIC X(80) VALUE "This is an incredibly long m

000600- "essage that will take more than one line to define".

Summary

Today, you learned the basics about COBOL's DATA DIVISION, including the following:

· The WORKING-STORAGE SECTION of the DATA DIVISION is used to create space for the variables of a program.

· Variables in WORKING-STORAGE are given names. The names are assigned by the programmer.

· Variables can be named using the uppercase characters A through Z, the digits 0 through 9, and the hyphen (-). The hyphen cannot be the first character of a variable name.

· Variables are divided into two broad classes: alphanumeric and numeric.

· Alphanumeric variables can hold printable characters: A through Z, a through z, 0 through 9, spaces, symbols, and punctuation characters.

· Numeric variables can hold numbers.

· Alphanumeric values must be enclosed in double quotation marks when being moved to variables.

· Numeric values being moved to numeric variables do not require quotation marks.

· The MOVE verb moves an alphanumeric value to an alphanumeric variable and pads the variable with spaces on the right if the value is too short to fill the variable.

· The MOVE verb moves a numeric value to a numeric variable and pads the value on the left with zeroes if the value is too small to fill the variable.

· The DISPLAY verb can display more than one value or variable at a time.

· A COBOL sentence can contain commas for punctuation. They do not affect the behavior of the final program, but they can be included to improve readability.

· A COBOL sentence ends with a period. It can spread over several lines of the source code file, as long as it stays within Area B, columns 12 through 72.

· A continuation character can be used to continue a literal on one or more subsequent lines.