I want to have a COBOL subprogram called from either CICS or batch environments. The subprogram has no CICS commands...
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
in it and is simply a COBOL table lookup routine. I passed the subprogram through the CICS translator which inserted the DFHEIBLK and DFHCOMMAREA into the program for me. This works fine when I call from a CICS main program but I get an 0C4 abend when I call the sibprogram from a batch COBOL main program.
I inserted dummy WS field in the batch main program to account for dfheiblk and dfhcommarea so that the CALL prog USING dfheiblk dfhcommare parm1 would referr to the proper areas in the called sub. Am I doing something wrong?
From your description of the technique you used to call the same COBOL sub-program from CICS and batch I would have expected it to work. To check we ran the following code (which worked as expected):- COBOL Subroutine translated: IDENTIFICATION DIVISION. PROGRAM-ID. TCOBSUB. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. LINKAGE SECTION. 01 LINK-PARM PIC X(10). PROCEDURE DIVISION USING LINK-PARM. IN-THE-BEGINNING. MOVE 'TERRY' TO LINK-PARM. GOBACK. END PROGRAM TCOBSUB. COBOL Batch caller: IDENTIFICATION DIVISION. PROGRAM-ID. TCOBBTCH. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 DFHEIBLK PIC X. 01 DFHCOMMAREA PIC X. 01 WORK-PARM PIC X(10) VALUE 'NAME'. PROCEDURE DIVISION. IN-THE-BEGINNING. DISPLAY WORK-PARM. CALL 'TCOBSUB' USING DFHEIBLK DFHCOMMAREA WORK-PARM. DISPLAY WORK-PARM. GOBACK. END PROGRAM TCOBBTCH. COBOL CICS caller translated: IDENTIFICATION DIVISION. PROGRAM-ID. TCOBCICS. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 WORK-PARM PIC X(10) VALUE 'NAME'. PROCEDURE DIVISION. IN-THE-BEGINNING. EXEC CICS SEND TEXT FROM(WORK-PARM) ERASE END-EXEC. CALL 'TCOBSUB' USING DFHEIBLK DFHCOMMAREA WORK-PARM. EXEC CICS SEND TEXT FROM(WORK-PARM) END-EXEC. GOBACK. END PROGRAM TCOBCICS. If your programs were essentially the same as this example then I do not understand why the batch invocation failed. I should also point out that it is NOT necessary to translate the COBOL sub-program. You can call it from batch or from CICS using exactly the same CALL statement as you would normally (ie with no DFHEIBLK or DFHCOMMAREA parameters in either the CICS or batch calling program).
Dig Deeper on IBM system z and mainframe systems
Related Q&A from Robert Crawford
For better mainframe capacity planning, how do I convert CPU hours to MIPS? And is there a way to calculate the relationship between MIPS and MSUs?continue reading
I have two years of experience in mainframe technology, currently working as a mainframe developer. I want to change to Java technology.continue reading
I want to replicate DB2 from the mainframe to an AIX box since it's cheaper and the copy can be used for testing. Is this possible?continue reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.