Created On:  01 February 2011

Problem:

If a person develops a COPY file containing TYPEDEFs, how can they make these available to record areas defined in an FD in the COBOL program that brings in the COPY file?  Is there some way to include TYPEDEFs defined in COPY files, so that they can be brought in and defined before the FD?

Resolution:

The documentation explains that if you put TYPEDEFs inside call prototypes, you can reference those TYPEDEFs in any subsequent source line of the compilation group.

"Compilation group" refers to the fact that a single disk file can contain more than one COBOL program.  You can have an IDENTIFICATION DIVISION and a whole COBOL program, ending with an END PROGRAM statement, and then in the same disk file another IDENTIFICATION DIVISION and another entire program with its own END PROGRAM statement, etc.

Attached to this Knowledgebase article is a file named "2285832-demo.tar".  It includes example code showing a successful "compilation group" approach to specifying a TYPEDEF within a COPY file, and having the TYPEDEF be referenced in an FD in the COBOL program that brings in the COPY file.
Incident #2285832