Code Comments
Programming Forum and web based access to our favorite programming groups.>>> On 10/6/2007 at 8:12 PM, in message <i0fgg31l7rpg3pd700meml250qe6chfj5s@4ax.com>, Clark F Morris<cfmpublic@ns.sympatico.ca> wrote: > > With a large amount of COBOL code still on IBM z series, some > interesting developments are relevant to this discussion. There > purportedly is a Websphere based IDE that supports COBOL and > presumably has repository functions (I haven't researched it yet > because I am trying to figure out if it matters). COBOL for the z > series supports OO in JAVA context. There apparently are classes and > other OO pieces of functionality for C/C++ in CICS according to one > posting I read on bit.listserv.ibm-main. This could mean that there > could be a path to moving COBOL on the z series to OO. IBM is pushing > web integration, SOA and a number of other things that I don't pretend > to understand except in a very broad sense. > > IBM z series is still used by a large number of large organizations > and a surprising number of smaller ones. It is getting decent Unicode > support. There are web servers for it. DB2 is still one of the most > used data bases and improvements are still being made to IMS data base > and data communications including 64 bit support. IBM vacillates on > whether it wants the smaller user but currently does have some > interesting offerings at the low end (not the developer low end > unfortunately for those small ISVs who can use a mainframe on a > laptop). Most larger banks are probably on CICS or IMS for their > major processing even today. > > Thus the question becomes would it be worthwhile to push IBM to make > it come together? The benefits are the reuse of a number of systems > that can't be replaced by SAP, et al and a migration path. For those > of you who know both C# and COBOL, how much would have to added to > COBOL for it to have the same functionality that C# has. Personally I don't understand where IBM is going here. OO COBOL is not even supported under CICS: http://publibfp.boulder.ibm.com/cgi...2/3.1.1?SHELF=i gy3sh33&DT=20061117131343 "Restrictions: COBOL class definitions and methods (object-oriented COBOL) cannot be run in a CICS environment." Neither is DB2 (EXEC SQL) supported inside of Cobol classes either. Sheesh! Looks like you can use OO COBOL by itself or combined with Java within a batch environment, where its recommended that the batch environment be z/OS UNIX System Services. It doesn't say why... Anyway, there does appear to be, as you say, some OO CICS stuff for C++, call "Foundation Classes". See the following page for more information: http://www-03.ibm.com/servers/eserv...df/cicstserv22. html The manual is "C++ OO Class Libraries". Considering that COBOL's OO features are not allowed under CICS I'd say it's a good bet that you cannot use the C++ Foundation Classes from Cobol... :-) Frank
Post Follow-up to this messageFrank Swarbrick wrote: > Neither is DB2 (EXEC SQL) supported inside of Cobol classes either. > Sheesh! Do they have other database access classes? I don't think I'd *want* to do EXEC SQL in a class unless I just had to... :) -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~ / \/ _ o ~ Live from Albuquerque, NM! ~ ~ _ /\ | ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Business E-mail ~ daniel @ "Business Website" below ~ ~ Business Website ~ http://www.djs-consulting.com ~ ~ Tech Blog ~ http://www.djs-consulting.com/linux/blog ~ ~ Personal E-mail ~ "Personal Blog" as e-mail address ~ ~ Personal Blog ~ http://daniel.summershome.org ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ GEEKCODE 3.12 GCS/IT d s-:+ a C++ L++ E--- W++ N++ o? K- w$ !O M-- V PS+ PE++ Y? !PGP t+ 5? X+ R* tv b+ DI++ D+ G- e h---- r+++ z++++ "Who is more irrational? A man who believes in a God he doesn't see, or a man who's offended by a God he doesn't believe in?" - Brad Stine
Post Follow-up to this messageFrank Swarbrick wrote:
> < GemdnaPKRcdMgpHanZ2dnUVZ_tLinZ2d@comcast
.com>, LX-i<lxi0007@netscape.net>
> wrote:
>
> I don't know. I guess since they support instantiating Java objects from
> within COBOL you could use JDBC.
There you go. :)
> I don't understand the reasoning behind your second statement, though. It
> seems to me (without having actual tried it!) that it would be desirable t
o
> have a database access class containing EXEC SQL statements. That is if
> you're stuck using static SQL, which I know Pete always comes out against.
> (I don't have enough experience to have an opinion on that matter).
I suppose you could - that would be a "had to". Our current system has
everything abstracted - if you need data, you execute a method in our
"db layer", giving it a query name and any applicable parameters. Today
I was working on occupational illness reporting; if I want to get a list
of all the investigators with the "public health" role, I coded
something like this...
public ArrayList<Investigator> getInvestigatorsInRole(
final Long plIllnessId, final Long plRoleId)
throws AfServiceException {
ArrayList<Investigator> aInvestigators = new ArrayList<Investigator>();
try {
ReturnObject[] oInvestigatorData = getDbLayer().performSelect(
"illness.get_investigators_in_role",
new Object[] { plIllnessId, Investigator.PUBLIC_HEALTH } );
if (!ArrayUtils.nullOrEmpty(oInvestigatorData)) {
for (ReturnObject oData : oInvestigatorData) {
aInvestigators.add(new Investigator(oData));
}
}
}
catch (AfDatabaseException oException) {
throw new AfServiceException(
"Error retrieving investigators for illness "
+ plIllnessId.toString(), oException);
}
return aInvestigators;
}
(ReturnObject is a database row.) Then, in the application code, I did
it like so...
IllnessService oService = new IllnessService(
getDbLayer(), getUserSession());
ArrayList<Investigator> aPublicHealth
= oService.getInvestigatorsInRole(
plIllnessId, Investigator.PUBLIC_HEALTH);
In this model, I don't really care about the query, although I need to
know the parameters to pass. In fact, if I were just worried about
getting the investigators, I wouldn't even need to know anything about
the underlying data. :) However, in this case, I do all three layers
(actual SQL, service to deal with it, and application code to use the
service).
(Our queries are stored externally, in XML files by name.)
> Assuming that you were working with mainframe COBOL and you, for whatever
> reason, are not using JDBC for database access, what type of OO methodolog
y
> and database access would you use? I assume (perhaps erroneously!) that
> coding EXEC SQL statements in the main body of each program is not the bes
t
> OO way to go. Then again, perhaps it is?
No - if it has to be that way, I'd pull them out into a separate *set*
of classes. I'd create an interface or abstract class for the common
stuff, and each "query" class would implement that interface. (You
could have a single query per class, but that might be unmanageable.
You could have them all in one - the true COBOL way ;), but then you've
got one monolithic library that *does* change frequently. You could
group the queries by functional area - that would probably be the way
I'd go.) I'd also abstract the return data (much like the current
system I'm working on has the ReturnObject that we use for all data
coming back from the database).
I'm not an OO expert, but I've learned a heck of a lot since I posted
that "My First C#" post earlier this year. I actually understand it
now. The code above is some I wrote today when I realized that one of
my methods needed to be reused, but not entirely. I refactored the "get
investigator's e-mail addresses" part out, then the part you see above
out of that. Finally, I "genericised" (is that a word? I guess it is
now...) the e-mail method to append some info to every message, and log
messages to a history log (another 3 methods).
I hope that somewhere in that rambling, I've explained what I meant. :)
If not, let me know and I'll try again...
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ / \/ _ o ~ Live from Albuquerque, NM! ~
~ _ /\ | ~ ~
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
~ Business E-mail ~ daniel @ "Business Website" below ~
~ Business Website ~ http://www.djs-consulting.com ~
~ Tech Blog ~ http://www.djs-consulting.com/linux/blog ~
~ Personal E-mail ~ "Personal Blog" as e-mail address ~
~ Personal Blog ~ http://daniel.summershome.org ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~
GEEKCODE 3.12 GCS/IT d s-:+ a C++ L++ E--- W++ N++ o? K- w$ !O M--
V PS+ PE++ Y? !PGP t+ 5? X+ R* tv b+ DI++ D+ G- e h---- r+++ z++++
"Who is more irrational? A man who believes in a God he doesn't see,
or a man who's offended by a God he doesn't believe in?" - Brad Stine
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.