COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
03 TITLE PICTURE X(5).
?SECTION ADDRREC
01 ADDR-REC.
03 NUMBER PICTURE X(5).
03 STREET PICTURE X(15).
03 APT-NUM PICTURE X(3).
03 CITY PICTURE X(15).
03 STATE PICTURE X(2).
03 ZIPCODE PICTURE X(5).
?SECTION DATEREC
01 DATE-REC.
03 MONTH PICTURE X(9).
03 DAY PICTURE X(2).
03 YEAR PICTURE X(4).
Line in HP COBOL source program:
?SOURCE SRCFILE
Resulting source code:
01 NAME-REC.
03 LAST-NAME PICTURE X(15).
03 M-I PICTURE X(1).
03 FIRST-NAME PICTURE X(15).
03 TITLE PICTURE X(5).
01 ADDR-REC.
03 NUMBER PICTURE X(5).
03 STREET PICTURE X(15).
03 APT-NUM PICTURE X(3).
03 CITY PICTURE X(15).
03 STATE PICTURE X(2).
03 ZIPCODE PICTURE X(5).
01 DATE-REC.
03 MONTH PICTURE X(9).
03 DAY PICTURE X(2).
03 YEAR PICTURE X(4).
If the HP COBOL source program in Example 236 contains the line
?SOURCE SRCFILE (NAMEREC,DATEREC)
then only the sections NAMEREC and DATEREC are included in the resulting source code, which
is:
01 NAME-REC.
03 LAST-NAME PICTURE X(15).
03 M-I PICTURE X(1).
03 FIRST-NAME PICTURE X(15).
03 TITLE PICTURE X(5).
01 DATE-REC.
03 MONTH PICTURE X(9).
03 DAY PICTURE X(2).
03 YEAR PICTURE X(4).
Replacing Text-Words in an HP COBOL Source Program
You can replace text-words with other text-words in an HP COBOL source file with a REPLACE
statement. A REPLACE statement is active from the time the compiler encounters it until the compiler
encounters either another, overriding REPLACE statement or the end of a separately compiled
program.
The two Data Divisions in Example 237 are equivalent.
Example 237 Replacing Text-Words in an HP COBOL Source Program
DATA DIVISION.
REPLACE ==OFFICES== BY ==10==
766 Creating and Compiling HP COBOL Source Programs










