IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Calling a COBOL-DB2 from a pure COBOL program


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
nareshdacha

New User


Joined: 12 Jan 2010
Posts: 66
Location: US

PostPosted: Mon Jul 26, 2010 4:00 pm
Reply with quote

Is it possible to call a COBOL-DB2 from a pure COBOL program? If yes, how to write a JCL for it? Do we still need to use IKJEFT01 as PGM.
How to declare the plan/package for the sub-program ? Please suggest me how to proceed further....
Back to top
View user's profile Send private message
bipinpeter

Active User


Joined: 18 Jun 2007
Posts: 213
Location: Cochin/Kerala/India

PostPosted: Mon Jul 26, 2010 4:46 pm
Reply with quote

Yes you can call COBOL-DB2 program from a non DB2 Cobol Program.
You have to use IKJEFT* program to execute this.
Back to top
View user's profile Send private message
nareshdacha

New User


Joined: 12 Jan 2010
Posts: 66
Location: US

PostPosted: Mon Jul 26, 2010 5:05 pm
Reply with quote

Normally we use IKJEFT01 to execute the COBOL-DB2 program. But in my scenario sub-program is a COBOL-DB2 program and main program is a pure COBOL program. Then how to use IKJEFTO1 for this purpose...
How to speify the plan/package for program..... Please explain.......
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Mon Jul 26, 2010 5:11 pm
Reply with quote

You specify it for the first program...

O.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6248
Location: Mumbai, India

PostPosted: Mon Jul 26, 2010 5:48 pm
Reply with quote

Your standard COBOL program can call a DB2 program without any differences to the COBOL. In the calling program, the 'CALL' statement is exactly as it would be in any other program - so what to change?

The difference lies in the outside environment. In order to access DB2, you must start off with in a DB2 environment, and specify a plan (or package?) name, which has got the DB2 statements already defined to it (Ok, I'm not talking about dynamic SQL for the time being).

What this means in an zOS is that in the JCL rather than coding a EXEC PGM="pure-cobol", you would code a call to TSO, as in EXEC PGM=IKJEFT01, passing the actual execution in the SYSIN as Mr. O has said.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Mon Jul 26, 2010 6:02 pm
Reply with quote

First show an example of how PROGA (Cob-Db2) would call PROGB (also Cob-DB2).

Show an example of how your Bind Package and Bind Plan statements look.

Then show example of how you would invoke your PROGA.

I could show you how I would do it, but that may not match the conventions used in your shop.

So if you go first, then you can be helped.
Otherwise... not so much help.
Back to top
View user's profile Send private message
nareshdacha

New User


Joined: 12 Jan 2010
Posts: 66
Location: US

PostPosted: Wed Jul 28, 2010 3:40 pm
Reply with quote

As my main program is COBOL program i think we need to use the below JCL...Is it correct ? .....But here my doubt is since my sub-program is COBOL-DB2 do we need to mention the plan/package or not...

//STEP1 EXEC PGM=FSS00100
//STEPLIB DD DSN=MAGT.ENDEVOR.LOADU,DISP=SHR
//INFILE DD DSN=MAGT.TEST.INPUT,DISP=SHR
//OUTFILE DD DSN=MAGT.TEST.OUTPUT,DISP=(NEW,CATLG),
// DCB=(RECFM=FB,LRECL=80)
//SYSOUT DD=SYSOUT(*)

Please correct me if am wrong.........
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jul 28, 2010 4:10 pm
Reply with quote

nareshdacha,
your lack of knowledge is depressing.

bipinpeter gave you the answer, offer71 expanded and provided detail.
and Anuj gave you an explanation why.

you need to learn some fundamentals, stop guessing and presuming.

again, as Anuj explained:
you need to establish a connect with db2.
A CAF connect via IKJEFTnn will suffice.
if you have RRS requirements, than you will need another method.

and do not ask the difference between a CAF connect and an RRS connect.
research, even google will provide you with the info.
you can start with chapter 3 of the ABCs of z/OS System Programming Volume 5
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6248
Location: Mumbai, India

PostPosted: Wed Jul 28, 2010 4:31 pm
Reply with quote

nareshdacha wrote:
Please correct me if am wrong.........
Unfortunately, you are wrong, note this from what I said earlier:
Quote:
in the JCL rather than coding a EXEC PGM="pure-cobol", you would code a call to TSO, as in EXEC PGM=IKJEFT01, passing the actual execution in the SYSIN as Mr. O has said.
.

Suggest you look here also.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jul 28, 2010 5:23 pm
Reply with quote

nareshdacha,
my apologies. this is an interview forum.
Back to top
View user's profile Send private message
nareshdacha

New User


Joined: 12 Jan 2010
Posts: 66
Location: US

PostPosted: Thu Jul 29, 2010 3:22 pm
Reply with quote

My program is FSS00100 is COBOL program which is calling COBOL-DB2 program FSS00500.

FSS00100:
05 WS-SUBPGM PIC X(8) VALUE 'FSS00500'.


CALL WS-SUBPGM USING CUSTOMER-NO.



//STEP010 EXEC PGM=IKJEFT01
//STEPLIB DD DSN=MAGT.ENDEVOR.LOADU,DISP=SHR
// DD DSN=SYS1.DSNDSNH.SDSNEXIT,DISP=SHR
// DD DSN=SYS1.DSNDSNH.SDSNLOAD,DISP=SHR
//SYSTSIN DD *
DSN SYSTEM(ATST1) -
RUN PROGRAM(FSS00100) PLAN(T_PLAN) -
LIB(MAGT.DBRM.LOADLIB) -
END
/*

This is the normal run jcl format which i used to run COBOL-DB2 program. But am not sure how to bind and execute if the sub-program is a COBOL-DB2.
Please correct me and suggest me.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Thu Jul 29, 2010 5:37 pm
Reply with quote

Dick,

While this is an interview forum, the level of questioning seems to me to be beyond that.


Naresh,

What you show above looks like it would work depending on:

What is still in question, is what do the Bind statements look like for BOTH Package FSS00500 and Plan T_PLAN.

Do you think I asked for this just for fun?
Quote:

Show an example of how your Bind Package and Bind Plan statements look.


So either:
1) You did not actually read what I took the time write
2) Chose to ignore the request as not important
3) Did not understand what I was looking for and did not want to ask
4) Some other unknown reason

Quote:

Please correct me and suggest me.


Help others help you. Provide ALL of the information requested!

That is your suggestion.
Back to top
View user's profile Send private message
siva04408

New User


Joined: 23 Feb 2010
Posts: 11
Location: pune

PostPosted: Wed Aug 18, 2010 7:11 pm
Reply with quote

My program is FSS00100 is COBOL program which is calling COBOL-DB2 program FSS00500.
Back to top
View user's profile Send private message
siva04408

New User


Joined: 23 Feb 2010
Posts: 11
Location: pune

PostPosted: Wed Aug 18, 2010 7:17 pm
Reply with quote

Hi to all sorry for the inconvinience...

I too want to know what is the actual process we have to fallow when a cobol program is calling cobol+db2 subprogram.

You people has given some answers but iam not getting clarity...

ProgA is cobol program, ProgB is cobol+db2 prog.

i need actual process from start to end . compilation to execution with one example. If possible code the JCL...

it is not that much easy for newers..so iam requesting clear explination
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Aug 18, 2010 7:19 pm
Reply with quote

daveporcelan,

oh my!
Did the TS actually repeat useless information that he provided before,
or did he actually answer your question about the bind statements?
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Wed Aug 18, 2010 7:40 pm
Reply with quote

Dick,

Kanna (siva04408) is not the TS, but rather a TE (topic extender?).

Kanna,

There is more than one way to bind packages and plans.

I highly suggest you speak with some seniors at your site for an example of how your Bind Package and Bind Plan statements look.

If you have no seniors to go to then speak with your manager.

If you are just asking for your own knowledge, read the manual, or wait till you are on a site and go back to number 1.
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Wed Aug 18, 2010 8:30 pm
Reply with quote

with "standard" I mean what is usual at your site.

- Compile fss00100 as a standard non-db2 program
- precompile/compile/bind fss00500 as a standard db2 program to a normal package in the standard collection you would use.
-execute fss00100 with JCL as if it was a standard db2 program with the plan that contains the collection to which you have bound

The only possible difference might be the about searching for the correct Loadmodules.
You can use DSN RUN ... LIB() to specify the library with the main program ie. fss00100
But (this comes straight out of the manual) : Normal z/OS library searching is always used for any subprograms that is loaded by the main program.
which means the library with the subprogram must be somewhere in : STEPLIB DD , JOBLIB DD, link list
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts COBOL sorting, with input GDG base COBOL Programming 7
No new posts Need help with ADABAS query (COBOL-AD... All Other Mainframe Topics 0
No new posts Replacing FILLER with FILLER<SeqNu... DFSORT/ICETOOL 2
No new posts Error to invoke MPP program through B... IMS DB/DC 3
No new posts Compile Sp Cobol base COBOL Programming 1
Search our Forums:

Back to Top