contents.gifindex.gifprev1.gifnext1.gif

Using COPY RESOURCE with helper applications

If you have Version 4.0 or later of the ACUCOBOL-GT compiler, you can use the new COPY RESOURCE statement in your COBOL source code to package your applications and bitmaps instead of or in addition to the cblutil utility. Use this statement as follows:

COPY RESOURCE resource-name [ {IN} path-name ] .

{OF}

Where resource-name and path-name identify a resource file to be included in the resulting object file.

The effect of a COPY RESOURCE statement is to add resource-name to a list of resources that the compiler embeds into the resulting COBOL object file. The resources are added to the end of the COBOL object in the same order as the corresponding COPY statements. Since the resources are added to the end of the object, the location of the corresponding COPY RESOURCE statement in the COBOL program is irrelevant. Conventionally, COPY RESOURCE statements are placed either in Working-Storage or at the end of the program, but any location is acceptable.

If resource-name resolves to a COBOL object or library file, the compiler includes this object or library in the resulting object in a manner similar to "cblutil -lib". These are not considered resources, but are embedded COBOL objects.

If you are creating a library containing multiple COBOL objects, we recommend using "cblutil -lib" instead of using COPY RESOURCE. Using cblutil, you do not need to worry about the order in which COBOL objects are compiled (if you use COPY RESOURCE, you must ensure that the copied object is compiled first), and cblutil also checks for duplicated program names while COPY RESOURCE does not.

Although technically, you can include XFDs in a library using COPY RESOURCE, the XFDs must exist before you compile with the COPY RESOURCE statement. Since XFDs are created at compile-time, this means you must compile more than once. For this reason, the cblutil method is also preferred for XFD inclusion.