Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Calling an IMS/DB2 program in COBOL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
arulsatish

New User


Joined: 16 Jan 2006
Posts: 12

PostPosted: Wed Jan 18, 2006 2:22 pm    Post subject: Calling an IMS/DB2 program in COBOL
Reply with quote

I'm calling an IMS/DB2 program in a plain COBOL program. I'm passing the Working Storage variables through Linkage Section to the IMS and DB2 program but I'm unable to refer any of the variables. More over I'm getting a S0C4 error when I try to do the same. They are all in correct order.

Can any one please clarify and provide a work around?
Back to top
View user's profile Send private message

guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Wed Jan 18, 2006 3:03 pm    Post subject:
Reply with quote

could u please send us the code of linkage section of calling program & as well as procedure division using phrase of called program.
Back to top
View user's profile Send private message
arulsatish

New User


Joined: 16 Jan 2006
Posts: 12

PostPosted: Wed Jan 18, 2006 3:43 pm    Post subject: Re: Linkage section problem
Reply with quote

Calling program Work area.


+10 01 TCSCB00-REC.
+10 COPY TCSCB001 REPLACING ==:TCSCB001:== BY ==TCSCB002==.
+10 01 LAST-RUN-DTE PIC X(8) VALUE SPACES.
+10 01 REPORT-INDICATOR PIC X(1) VALUE SPACES.
+00
+00 01 BATCH-COMMAREA.
+05 COPY TCS277CB REPLACING ==:CB:== BY ==CB==.

Calling program Likage Section - Note: It's an IMS/DB2 program

+10 LINKAGE SECTION.
+10
+11 *01 BATCHPCB-MASK.
+10 COPY BATCHPCB.


Called program Linkage Section.

+00 LINKAGE SECTION.
+00
+41 01 TCSCB00-REC.
+41 COPY TCSCB001 REPLACING ==:TCSCB001:== BY ==TCSCB002==.
+41 01 LAST-RUN-DTE PIC X(8).
+41 01 REPORT-INDICATOR PIC X(1).
+00 01 BATCH-COMMAREA.
+41 COPY TCS277CB REPLACING ==:CB:== BY ==CB==.
+37 *01 BATCHPCB-MASK.
+36 COPY BATCHPCB.

Called program Procedure Division.

%+48 PROCEDURE DIVISION USING TCSCB00-REC, LAST-RUN-DTE,
%+48 REPORT-INDICATOR, BATCH-COMMAREA, PCB1-MASK.


Hope you got the required information. Let me know if you need more info.
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Wed Jan 18, 2006 5:04 pm    Post subject:
Reply with quote

Could u provide me calling statement to call subprogram.
Back to top
View user's profile Send private message
arulsatish

New User


Joined: 16 Jan 2006
Posts: 12

PostPosted: Wed Jan 18, 2006 7:20 pm    Post subject:
Reply with quote

Please find the calling statesment

CALL WS-TBSI0017 USING TCSCB00-REC, LAST-RUN-DTE,
REPORT-INDICATOR, BATCH-COMMAREA, PCB1-MASK.
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Thu Jan 19, 2006 12:28 am    Post subject: Re: Linkage section problem
Reply with quote

Arulsatish,

You say you are calling a DB2/IMS subroutine from a ?plain? cobol program? You cannot do this. You must compile the ?plain? cobol program as a DB2 program, even though there are no ?EXEC SQL? statements in it, and I believe the same for IMS (I don?t do much in IMS). This may be some of the problems you are experiencing?

Let us know the solution,
Dave
Back to top
View user's profile Send private message
arulsatish

New User


Joined: 16 Jan 2006
Posts: 12

PostPosted: Thu Jan 19, 2006 9:18 am    Post subject:
Reply with quote

Dave,
Thanks for your input.
We have indeed compiled the plain COBOL as a DB2 program only.
If you find any solutions please let us know.
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Thu Jan 19, 2006 8:02 pm    Post subject: Re: Linkage section problem
Reply with quote

arulsatish,

Another thing to check is if the subroutine is in an accessable library. Maybe you need to add //steplib to pick up the subroutine?

Good luck,
Dave
Back to top
View user's profile Send private message
arulsatish

New User


Joined: 16 Jan 2006
Posts: 12

PostPosted: Thu Jan 19, 2006 8:06 pm    Post subject:
Reply with quote

Dave,
Thank you once again. The call is a static call i.e stand alone executable program.

Thanks,
M Arul Satish
Back to top
View user's profile Send private message
arulsatish

New User


Joined: 16 Jan 2006
Posts: 12

PostPosted: Thu Jan 19, 2006 8:09 pm    Post subject:
Reply with quote

Dave,
I just forgot to add a piece of info. Infact we are getting into the called program but we are unable to access the likage section variables and getting S0C4 error from the called program.
Back to top
View user's profile Send private message
Bitneuker

CICS Moderator


Joined: 07 Nov 2005
Posts: 1105
Location: The Netherlands at Hole 19

PostPosted: Thu Jan 19, 2006 9:15 pm    Post subject:
Reply with quote

This might be a link problem. Did you in your link insert INCLUDE IMS(DFSLI000) in order to tell the system it's dealing with an IMS program? It also might be caused by conflicting parameters.

Cheers,
Back to top
View user's profile Send private message
arulsatish

New User


Joined: 16 Jan 2006
Posts: 12

PostPosted: Fri Jan 20, 2006 11:18 am    Post subject:
Reply with quote

George,
I'm using the utility DFSRRC00 for IMS. I'm not sure whether I still have to INCLUDE IMS(DFSLI000).

Please clarify.
Back to top
View user's profile Send private message
Bitneuker

CICS Moderator


Joined: 07 Nov 2005
Posts: 1105
Location: The Netherlands at Hole 19

PostPosted: Fri Jan 20, 2006 3:36 pm    Post subject:
Reply with quote

arulsatish,

DFSRRC00 in fact is IMS. Here's a snapshot of the JCL of one of our regions.
XXREGION EXEC PGM=DFSRRC00,REGION=&RGN,
XX PARM=(MSG,&CL1&CL2&CL3&CL4,
XX &OPT&OVLA&SPIE&VALCK&TLIM&PCB,
XX &PRLD,&STIMER,&SOD,&DBLDL,&NBA,
XX &OBA,&IMSID,&AGN,&VSFX,&VFREE,
XX &SSM)
XX*
IEFC653I SUBSTITUTION JCL - PGM=DFSRRC00,REGION=0M,PARM=(MSG,117000000

This is a part of one of our batchjobs:

//STEP01 EXEC PGM=DFSRRC00,REGION=0M,
// PARM='DLI,DSNMTV01,program,40,00'
//STEPLIB DD DSN=xxxxxxx.x.xxxxxx,DISP=SHR
//IMS DD DSN=xxxxx.xxxxx.PSBLIB,
// DISP=SHR
// DD DSN=xxxxx.xxxxx.DBDLIB,
// DISP=SHR
//DFSVSAMP DD *

Finally the link of one of our batch programs:

//LINKE01 EXEC xxxxx,
// INFILE='xxxxxx.xxxxxxx.OBJ(xxxxxx)',
// OUTFILE='xxxxxx.xxxxxxx.LOAD(xxxxxx)'
//PLKED.SYSIN2 DD *
//LKED.SYSIN DD *
INCLUDE IMS(DFSLI000)
ENTRY CEESTART
NAME xxxxxx(R)

and the link of an MPP (online) program:

//LINKE00 EXEC xxxxx,
// INFILE='xxxxxx.xxxxxxx.OBJ(xxxxx)',
// OUTFILE='xxxxxx.xxxxxxx.LOAD(xxxxx)'
//PLKED.SYSIN2 DD *
//LKED.SYSIN DD *
INCLUDE IMS(DFSLI000)
ENTRY CEESTART
NAME xxxxx(R)


I suggest you give it a try. BTW: our programs are in PL/1.

Cheers,
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Tue Jan 24, 2006 12:10 am    Post subject: Re: Linkage section problem
Reply with quote

arulsatish,

Have you any resolution for your problem yet. Without being closer to the problem, I don't have any other ideas, but I am interested in what the problem was.

Dave,
Back to top
View user's profile Send private message
arulsatish

New User


Joined: 16 Jan 2006
Posts: 12

PostPosted: Tue Jan 24, 2006 10:21 am    Post subject:
Reply with quote

Dave,
At the moment we are doing a work around - running the programs seperately. But we yet to find what the problem is. I'll update you once we find out.

Thank you for your concerns...

Regards,
M Arul Satish.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sat Jan 28, 2006 6:28 am    Post subject:
Reply with quote

As I recall, when I went to school they taught us that the CALLing pgm used WS fields to pass and receive data to/from the CALLed pgm which, in turn, used the fields defined in its LS to access that data.

Give it a try.
Back to top
View user's profile Send private message
arulsatish

New User


Joined: 16 Jan 2006
Posts: 12

PostPosted: Mon Jan 30, 2006 12:00 pm    Post subject:
Reply with quote

Hi Guys,
The problem is solved. Actually it happened in Endevor. The processor group was not updated properly.

Thanks for your support.

M Arul Satish
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am
No new posts ALPHABETIC check in COBOL vidyaa COBOL Programming 8 Thu Aug 17, 2017 7:13 pm
No new posts Calling CLIST through job and REXX Sahasra K CLIST & REXX 19 Tue Aug 01, 2017 10:25 am
No new posts XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us