COBOL Manual for TNS and TNS/R Programs
Program Compilation
HP COBOL Manual for TNS and TNS/R Programs—522555-006
11-120
SOURCE
When the compiler encounters a SOURCE directive, it suspends reading of the current
source file and begins reading lines from the specified file. If no section-name list
appears, the compiler incorporates the entire file into its stream of source text lines. If a
section-name list does appear, the compiler incorporates text from the designated
sections only, in the order in which the sections appear within the specified file (not in
the order of the list). When the compiler reaches the end of the file specified in the
SOURCE directive, or has copied all specified sections, it resumes reading from the
prior source file.
Usage Considerations:
•
Effect on Compilation Output Listing
If a SHOWFILE directive is active, when the compilation encounters an input line
containing a SOURCE directive, (assuming that the LIST and NOSUPPRESS
directives are active) the compiler lists the directive line, then a line showing the
fully qualified name of the new source file and the date and time it was last
modified.
When no SHOWFILE directive is active (the default condition), the directive line
containing the SOURCE directive appears in the output, but the additional line
does not.
The text from the section summoned by the SOURCE directive is listed, subject
only to the LIST and SUPPRESS directives.
•
Nesting of SOURCE Directives
The text introduced by a SOURCE directive can include one or more SOURCE
directives. The compiler processes nested SOURCE directives when it encounters
them. The maximum nesting depth is three; that is, at most three source files can
be open at any given time as a consequence of SOURCE directives (source files
open in response to COPY statements are not counted in this respect).
•
Relationship Between SOURCE Directive and COPY Statement
The effect of the SOURCE directive is neither a subset nor a superset of the effect
of the COPY statement; they are completely independent.
The SOURCE directive does not provide a REPLACING capability.
The text that a COPY statement delivers can include one or more SOURCE
directives. The text that a SOURCE directive delivers can include one or more
COPY statements. A COPY statement is not permitted to deliver a SOURCE
directive that delivers another COPY statement, because this would create the
effect of nested COPY statements.