Thread: COBOL

Trying to put EXEC CICS / SQL into copybooks - nothing works

Started by Anita • user4 replies191 viewsLast activity 2 weeks ago
Post #1
1 votes
Anita
Reputation
118
Posts: 23
Joined: May 29, 2025, 12:45 PM
Posted: Jul 28, 2026, 8:20 AM

Learning CICS + DB2. Program works but it is getting long and ugly. Figured I could shove the common paragraphs that have EXEC CICS and EXEC SQL into a copybook and reuse them.

Tried COPY, INCLUDE, even ++INCLUDE. Compile either ignores it or blows up in the precompiler step. Shop JCL still does DSNHPC then DFHECP1$ then IGYCRCTL.

Is putting executable CICS/SQL in a copybook even a thing people do, or am I fighting the wrong fight?

Post #2
0 votes
Marty
Reputation
412
Posts: 58
Joined: Aug 12, 2024, 9:14 AM
Posted: Jul 28, 2026, 10:20 AM

With the old separate precompilers, EXEC statements in copybooks are a pain. Switch the compile to the integrated CICS translator and DB2 coprocessor (CICS and SQL on the IGYCRCTL PARM). Then COPY of EXEC SQL / EXEC CICS is handled.

That said: most shops keep copybooks for data, not for paragraphs of executable code. Common logic usually becomes a subroutine or a CICS LINK.

Post #3
0 votes
Dave
Reputation
356
Posts: 25
Joined: Jul 21, 2024, 2:55 PM
Posted: Jul 28, 2026, 2:20 PM

Second the integrated translator. We dropped DSNHPC years ago. Big programs are normal in CICS by the way. Do not feel forced to carve everything into copybooks.

Post #4
1 votes
Anita
Reputation
118
Posts: 23
Joined: May 29, 2025, 12:45 PM
Posted: Jul 29, 2026, 11:20 AM

Got a simplified JCL with CICS,SQL on the COBOL step. Copy of a small EXEC CICS READ block compiles now. Still moving the shared stuff into a LINK program instead. Thanks.

You must be signed in to reply to this thread