Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Dynamic COBOL Code using DB2

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

New User


Joined: 02 Aug 2011
Posts: 17
Location: India

PostPosted: Tue Aug 02, 2011 1:48 pm    Post subject: Dynamic COBOL Code using DB2
Reply with quote

Hello,

I have certain piece of code which is dynamic and likely to change for every Quarter,so i have thought of putting such COBOL code into a Db2 table and allow the users(technical) to change the code from a a CICS screen. I would like to fetch this code in to my COBOL program and then execute it without compiling it.
I would like to know if this is really possible!! If yes how??

Thanks,
Satish Boddu.
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Tue Aug 02, 2011 2:14 pm    Post subject: Reply to: Dynamic COBOL Code using DB2
Reply with quote

No, you can't dump a piece of Cobol source somewhere (anywhere), read the source into your program at run-time, and then run it.

Cobol on a mainframe is not interpreted, it is compiled.

And no, you will not be able to stick a chunk of compiled code somewhere, read it into your program and expect it to do anything meaningful.

You can include parameters somewhere on a dataset/database/whereever and included code in your, source-and-then-compiled, program to operate off the parameters.
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Tue Aug 02, 2011 3:20 pm    Post subject:
Reply with quote

Can you please explain the exact requirement in detail... this would help us in giving solutions....
Back to top
View user's profile Send private message
satishboddu

New User


Joined: 02 Aug 2011
Posts: 17
Location: India

PostPosted: Tue Aug 02, 2011 4:17 pm    Post subject: Dynamic COBOL Code using DB2
Reply with quote

@gylbharat
we are trying to incorporate business rules in to DB2 tables and prevent hard coding values and 'IF' checks in the code.

@Bill Woodger: Are there any alternatives to overcome this?? Pls suggest
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Tue Aug 02, 2011 4:44 pm    Post subject:
Reply with quote

Are these business rules in the cobol program?
Back to top
View user's profile Send private message
satishboddu

New User


Joined: 02 Aug 2011
Posts: 17
Location: India

PostPosted: Tue Aug 02, 2011 5:00 pm    Post subject: Dynamic COBOL Code using DB2
Reply with quote

yes Bharat,

they are the businnes rules in the cobol program
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Aug 02, 2011 5:01 pm    Post subject:
Reply with quote

satishboddu wrote:
we are trying to incorporate business rules in to DB2 tables and prevent hard coding values and 'IF' checks in the code


If I were you,
I would extend my knowlede
and learn about db2 constraints and db2 triggers.

These can be combined with a well designed business rules table
that could be modified.

Or even code a 'table driven' cobol module to cause conformance.
but, that must be well designed, also.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Tue Aug 02, 2011 5:08 pm    Post subject:
Reply with quote

If you have rules "somewhere", external to your program, you can have a program read the rules.

Then you can have Cobol code which interrogates the rules and behaves accordingly.

If you update the rules, the program when it next interrogates them behaves according to the new rules.

If going this route, you should always validate the rules as a whole before acting on them. The location of the validation can depend on where you store the rules. If you get your rules from SYSIN or PARM for instance, the validation will be in your program. If you get the rules from a database, then the program which stored them can validate the cohesion of the rules once data entry/update is complete. Having something in the database/file to indicate that the data is validated is a good idea, then test that in the Cobol and reject if not valid.

You do not want to have something fancy with rules that have "loop-holes" so that you can screw up your system without changing anything but your rules.
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Tue Aug 02, 2011 7:43 pm    Post subject:
Reply with quote

Hello,

Quote:
You do not want to have something fancy with rules that have "loop-holes" so that you can screw up your system without changing anything but your rules.
A few -places i've been wanted to have their processes driven by external rules tables. What they found (very lae in testing) was that maintenance to the table(s) could cause the rules to "fire" in different orders. No matter how you implement, this will be unacceptable.
Back to top
View user's profile Send private message
satishboddu

New User


Joined: 02 Aug 2011
Posts: 17
Location: India

PostPosted: Wed Aug 03, 2011 6:01 pm    Post subject: THanks.
Reply with quote

Thank you all for your replies... the discussion is closed.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Wed Aug 03, 2011 6:20 pm    Post subject: Reply to: Dynamic COBOL Code using DB2
Reply with quote

implementing business rules based on external table is not something likely to get answers on a forum!

unless the people from SAP are willing to disclose the SAP logic which does it icon_biggrin.gif
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 641
Location: Whitby, ON, Canada

PostPosted: Wed Aug 03, 2011 6:49 pm    Post subject:
Reply with quote

I have seen this sort of thing implemented a couple of times. It is no trivial task to maximize flexibility; the cost is always increased complexity. One system I saw was so flexible that they developed a cobol program that acted as a quasi compiler. This program translated user input (entered via online screen) into a series of instructions in a proprietary format that were then processed by another program. The user input had to be coded using a very arcane procedure that only one person in the company was trained in. An elaborate test facility also had to be built so that the end user could write and test his "code" before releasing it to production.

The cost and risk of building such an infrastructure needs to be weighed against the cost of having a programmer change a program every quarter or so.
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
No new posts What is the code in CLIST to enable t... jackzhang75 CLIST & REXX 1 Fri Dec 02, 2016 3:02 am
No new posts IDEAL - Code Retrieval yugendran CA Products 0 Fri Nov 25, 2016 3:27 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm
No new posts COBOL Version 6.1 Virendra Shambharkar COBOL Programming 5 Tue Nov 01, 2016 11:24 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us