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

Main Program in Cobol and Sub program with Cobol -Db2


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kmdhandapani

New User


Joined: 13 Jul 2007
Posts: 10
Location: india

PostPosted: Thu Apr 10, 2008 2:50 pm
Reply with quote

Hi ,

i have Program name ASF00001 is cobol and Sub Program with ASF00022 in Cobol -Db2 ..

Now i am modifying in both calling & Called program ..

How can i compile programs ..

kindly let me know the process ???
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Thu Apr 10, 2008 2:58 pm
Reply with quote

in general, every site has it's own jcl/skeleton/utility to do it... ask your peers.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1287
Location: Chennai, India

PostPosted: Fri Apr 11, 2008 3:57 pm
Reply with quote

dhandapani,

There are many ways to compile. It is all specific to your project/site. Some use JCL's , few compile in endevor/changeman .
Back to top
View user's profile Send private message
kmdhandapani

New User


Joined: 13 Jul 2007
Posts: 10
Location: india

PostPosted: Fri Apr 11, 2008 4:26 pm
Reply with quote

yes we can compile Sub program Seperate and Main prgram Seperate by endevour / Changman

But how can we Run Jcl ? Because we have Seperate jcl to Run Cobol ,Cobol -Db2 .


Regards,
Dhans
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Fri Apr 11, 2008 5:19 pm
Reply with quote

you should use IKJEFT01 to invoke your main program...
RUN PROGRAM(yourprogramhere)
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Apr 11, 2008 8:54 pm
Reply with quote

Hello,

Quote:
But how can we Run Jcl ? Because we have Seperate jcl to Run Cobol ,Cobol -Db2 .
You should talk with others on your project who run programs or the database support people for the proper jcl for your system. You should not just make-up or download some jcl from elsewhere.
Back to top
View user's profile Send private message
Mistermind

New User


Joined: 08 Feb 2008
Posts: 46
Location: Dublin

PostPosted: Sun Apr 13, 2008 4:24 am
Reply with quote

I would think your main program should be compiled like a DB2 program, i.e. going through the preprocessor, outputting DBRM for binding.

At runtime, JCL exec pgm=IKJEFT01 which invokes the main program, which then calls the subroutine statically or dynamically. The DB2 subroutine will not execute correctly unless the DB2 environment has been set up for the main program before the subroutine is activated.

If both are old programs, check the existing compile output and runtime JCL to confirm the above is the arrangement. If Endevor is used, check the processor groups previously used and ascertain the actions performed by the processor groups.

If these two programs are being connected for the first time, then implement the above, i.e. compile the main program as DB2. At runtime the main program does not HAVE to call the DB2-using subroutine, the main program can run to the end without ever using DB2.
Back to top
View user's profile Send private message
Sundar V

New User


Joined: 25 Apr 2006
Posts: 5

PostPosted: Mon Apr 14, 2008 12:06 pm
Reply with quote

Hi

Could you please explain more why the Main program need to compile as COBOL-DB2 Program, even it doesnt have any DB2 Statements.

1. What will happen if i compile my Mainprogram as a pure COBOL program (IGYCRCTL) which calls a COBOL-DB2 Subprogram?
Secondly if i try to execute/run my main program (which is compiled using IGYCRTCL) using IKJEFT01,
then whether my both main and subprogram get executed?

Or Will it get abort during run/execution?

2. As Mistermind mentioned, if i compile the Mainprogram (NO DB2 Statement) as similar to COBOL DB2 program,
then there wont be DBRM created, no need for Bind, and no consistency token check during execution.

If this is a case, why are we choosing the mainprogram to compile in COBOL-DB2 mode?

Please clarify.

Thanks in advance.

Sundar
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Mon Apr 14, 2008 12:28 pm
Reply with quote

do not db2 pre-compile a program that contains no db2. dumb, dumb, dumb.


your main program calls the sub program. IKJEFt.. invokes you main program after making a connection to db2.

That is the purpose of using IKJEFT.. First it connects to db2 with the plan for the db2 submodule and then invokes the main module, which will eventually call the submodule.

The OP (and a couple of the contributors) need to read a little about what is going on in the computer, control and invocation of db2 modules.
Back to top
View user's profile Send private message
kmdhandapani

New User


Joined: 13 Jul 2007
Posts: 10
Location: india

PostPosted: Mon Apr 14, 2008 1:08 pm
Reply with quote

thanks a lot for your help and its working fine

i compiled main program just like a Cobol -Db2 program ..and at run Program with IKJEFTO1 ..


regards,
Dhans.
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Using API Gateway from CICS program CICS 0
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top