Home > Ask the Data Center Experts > Questions & Answers > Help with calling a COBOL subprogram from either CICS or batch environments
Ask The Data Center Expert: Questions & Answers
EMAIL THIS

Help with calling a COBOL subprogram from either CICS or batch environments

Robert Crawford EXPERT RESPONSE FROM: Robert Crawford

Pose a Question
Other Data Center Categories
Meet all Data Center Experts
Become an Expert for this site


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


>
QUESTION POSED ON: 26 March 2002

I want to have a COBOL subprogram called from either CICS or batch environments. The subprogram has no CICS commands 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?


>
EXPERT RESPONSE
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). 


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


RELATED CONTENT
CICS Newsletter
Using External Call Interface (EXCI) to access CICS
Using CICS event monitoring points (EMPs) for tuning and debugging
Implementing CICS managed data tables
Taking advantage of the CICS workload dispatch ratio
CICS 3270 bridge tutorial, part 3: How to start and end a conversation
CICS 3270 bridge tutorial, part 2: Using DFHL3270
Mainframe applications never die: Using the 3270 bridge
Hash table how-tos for mainframe programmers
Can a program use IXLLIST macros in CICS?
CICS socket interface

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice

HomeNewsTopicsITKnowledge ExchangeTipsBlogsMultimediaWhite PapersEvents
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 2005 - 2008, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts