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?



BROWSE BY TAG
CICS Newsletter,   VIEW ALL TAGS

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



RELATED CONTENT
CICS Newsletter
IBM z/OS 1.11 preview: New features and functions
New statistics for CICS Transaction Server 3.2
Manage CICS workloads with transaction classes
Run CICS in batch to beat a shrinking batch window
Ensuring CICS security with the Web Services Security standard
Use DFHLS2WS to expose CICS applications as a Web service
Using IBM IPCS to battle software bugs
CICS and Web services: Ready to go
Using External Call Interface (EXCI) to access CICS
Using CICS event monitoring points (EMPs) for tuning and debugging

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


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




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



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

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




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