Search This Blog

Sunday, August 15, 2010

Mind The Gap

Once upon a time, I was told that Cobol developers couldn't cross the gap to learn that "object oriented" stuff.  Why can't we? Could it be that we aren't smart enough? 

I think not.

I believe it has to do with the combination of syntax and methodology.  Let's face it, Object Oriented Cobol syntax from the 2002 standard is confusing.  Too many quote characters cluttering things up is my opinion.  Additionally, to use it, there was this object oriented approach to program design we were supposed to learn.  And because we had to learn a new language and we were coming from a procedural-based frame of reference, it stumped us.  I think we were trying to learn too many new things at once.

*cue creepy music*

I have a secret...

For the last couple of weeks,  I've been working secretly in my lab deep beneath the dungeon cooking something up.

I have been working to come to grips with...

Dare I say it...Cobol.Net and ASP.Net. *gasp*

(Ok, I was in my home office in the basement.  Anyway, back to the story)

I bought a book by Imar Spannjaars titled "Beginning ASP.NET 4 in C# and VB", and I had this thought... I wondered if I could translate what Imar was trying to teach the VB  and C# crowd into Cobol.Net syntax.  Guess what?  You can.  *smile*

First off, I've discovered that the new syntax the Micro Focus development guys have put together has made it easier for me to translate from VB.Net to the Cobol.Net.

And you want to know what else I found?  The Object oriented approach started to make more sense.  Not just basic sense but the kind of common sense you hope your teenage son finally gets before he graduates college (I keep my fingers crossed). 

I found that for the most part I only had to grasp a handful of concepts and I could write slick web-based ASP.Net applications using Cobol.Net. 

Basically it comes down to the new data types I've mentioned in earlier posts and two "new" statements, Set and Invoke.  For instance, here is how you use the Set statement.

 If the HasFile field of the FileUpload1 control on the current web page is true (think of it as an 88 level switch), set ws-filename to the value stored in the FileName field of the FileUpload1 control on the current web page.  If it doesn't, set the text of the UloadSuccessMessage object to "No File Selected. Unable to Upload" and make it visibile to the user.

And guess what?  Invoke isn't much different.

call the Redirect routine of the Response "program" that is tied to the current web application and pass it the URL of "Default.aspx?Redirect".

Based on this rather amazing revelation (amazing to me anyways), I've come to the conclusion that yes Cobol programmers can make the leap.

It isn't really that much of a leap actually, but more like a series of small steps. 

Additionally, I believe that C# and VB folks can understand the basics of this new version of the Cobol.Net syntax. 

In the near future, I hope to post the complete source for the web application I've been building and you can see for yourself what I'm talking about.  This stuff ain't rocket science.

Just in case you didn't notice, you too can give this a try.  Download a copy of Visual Cobol for your home machine for 30 days ( and give it a shot.  Can't figure out how to do something?  Maybe we can figure it out together.  Consider it a learning experience *grin*