Copybooks and subprograms

COPY and COPY REPLACING put one record in two programs; CALL and USING then pass it between them in the three parameter modes. RETURNING and RETURN-CODE carry the status back, and INITIAL, EXTERNAL and CANCEL decide what a subprogram keeps between calls. The part ends on a copybook both sides check and on the link line that builds the modules.

10.1 COPY and copybooks a copybook on disk, COPY, the extension the compiler searches, and one record in two programs Open 10.2 COPY REPLACING ==pseudo-text==, a record under another name, and the limits of the replacement Open 10.3 CALL and USING CALL "SUBPROG" USING, a subprogram with a LINKAGE SECTION, and the value that comes back Open 10.4 BY REFERENCE, CONTENT and VALUE the three modes, what each passes, and a callee that changes its parameter Open 10.5 RETURNING and RETURN-CODE RETURNING, RETURN-CODE, and the status the caller reads after the call Open 10.6 INITIAL, EXTERNAL and CANCEL IS INITIAL, EXTERNAL, CANCEL, and the state a subprogram keeps between calls Open 10.7 Nested programs and ENTRY END PROGRAM, an ENTRY point, and a CALL by entry name Open 10.8 A copybook-driven interface one copybook shared by caller and callee, a version field, and a contract both sides check Open 10.9 Building modules with cobc -m and -c -m for a module, -c for an object, and the link line that puts them together Open

Lessons