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

Concept clarification only - Cobol Db2 program


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
arien

New User


Joined: 02 Nov 2006
Posts: 43
Location: London

PostPosted: Fri Oct 08, 2010 12:13 am
Reply with quote

Hi,

I am getting back to Db2 environment after a long time. Needed clarifications on few doubts-

a) Can I use DB2 tables in batch programming like I use them in Stored Procedures ? What is the difference between the two?

b) I'm using changeman for release and version control within my application. I added my Cobol-DB2 program as a SRA component, when do I need to add the DBB component ? And do I always need to add the PKG component as well? Currently, while in DEV, I am using precompiler 'YES' option to pre-compile & compile my program and it is becomming active in my package.

Hope I'm making sense, please ask me questions in case anything is not clear above. It'll help me in fact.

Thanks icon_smile.gif
Back to top
View user's profile Send private message
ovreddy

Active User


Joined: 06 Dec 2004
Posts: 211
Location: Keane Inc., Minneapolis USA.

PostPosted: Fri Oct 08, 2010 1:25 am
Reply with quote

Hi Arien,

Here are the answers for your queries
a) Can I use DB2 tables in batch programming like I use them in Stored Procedures ? What is the difference between the two?

Yes you can use DB2 tables in batch programs. Batch programs written in host language like COBOL are independent programs and are not stored as part of Database. Batch programs makes calls to DB2 to retrieve or update information. A predefined access path is generated while compiling and binding a batch program.

DB2 Stored Procedures are stored as part of Database. Application program calling DB2 Stored Procedure will make only one call and whole Stored Procedure will execute on the DB2 Server. This way we can prevent multiple calls to DB2 which causes network traffic and multiple authentication check.

b) I am not a Changeman user. I donno about it. But while writing a COBOL DB2 program you should precompile--> Compile ---> BIND program. PKG option looks like a package which will have actual DB2 calls.

Thanks,
Reddy
Back to top
View user's profile Send private message
arien

New User


Joined: 02 Nov 2006
Posts: 43
Location: London

PostPosted: Fri Oct 08, 2010 1:35 am
Reply with quote

Thanks Reddy, my primary purpose is to unload a table into pipe-delimited flat file and apply some formatting to it which retrieving each row, hence I thought of writing it in a batch.

Another reason, which if you can confirm is, that SPs are called from Front end (like Java interface etc) and batch processing happens on Mainframes/DB2. Is that so ?

Considering my program purpose, could I code it as a SP as well ?
Back to top
View user's profile Send private message
ovreddy

Active User


Joined: 06 Dec 2004
Posts: 211
Location: Keane Inc., Minneapolis USA.

PostPosted: Fri Oct 08, 2010 1:44 am
Reply with quote

You are correct SPs are called from Front end as well as backend too (like Java interface etc) and batch processing happens on Mainframes/DB2.

If you want to deal with a flat file and DB2 I suggest Batch program only. Because SP cannot access flat files on mainframe.

Thanks,
Reddy
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Fri Oct 08, 2010 3:13 pm
Reply with quote

Quote:
Because SP cannot access flat files on mainframe

yes, they can : SYSPROC.admin_ds_write :
publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=/com.ibm.db29.doc.admin/db2z_sp_admindswrite.htm
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


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

PostPosted: Fri Oct 08, 2010 3:15 pm
Reply with quote

arien wrote:
a) Can I use DB2 tables in batch programming like I use them in Stored Procedures ? What is the difference between the two?
What host language you were using there?

Quote:
b) I'm using changeman for release and version control within my application. I added my Cobol-DB2 program as a SRA component, when do I need to add the DBB component ? And do I always need to add the PKG component as well? Currently, while in DEV, I am using precompiler 'YES' option to pre-compile & compile my program and it is becomming active in my package.
Change-Man set-up is pretty site-specific. What SRA means to you might mean SR2 to me and may be SRB at other shop, so mention about that does not really help us to help you. Suggest you get in contact with someone at your shop or contact Change-Man admin - they will be able hit direcly on the nail to solve your questions.
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 Oct 08, 2010 7:30 pm
Reply with quote

Hi Anuj,

Quote:
What host language you were using there?

Quote:
Concept clarification only - Cobol Db2 program
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


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

PostPosted: Fri Oct 08, 2010 7:53 pm
Reply with quote

Thanks Dick.

I was skeptical about the origin of the question, which I quote in my last post. When I last worked on DB2 SPs, there were folks from "Front-end" team, who used to "call the SP" from their JAVA-modules. And they never understood how COBOL and DB2 work with each-other. But if the OP has worked with COBOL and DB2 in creating the SPs - programming is pretty-similar. icon_smile.gif
Back to top
View user's profile Send private message
arien

New User


Joined: 02 Nov 2006
Posts: 43
Location: London

PostPosted: Fri Oct 08, 2010 8:06 pm
Reply with quote

Thank you all, I'm happy to be back on Db2 :-)
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 Oct 08, 2010 9:10 pm
Reply with quote

Good luck icon_smile.gif

Someone will be here when there are questions,

d
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 -> DB2

 


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