Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need arbitrator: END-IFs and EVALUATE... 7

Status
Not open for further replies.

JFett

Programmer
Dec 7, 2005
10
US
This question is open to everyone, and I would appreciate your responses on these.

1) Can someone tell me what their professional opinion of (and their installation's standards/guidelines on) the use of explicit scope terminators like END-IF/ENDIF? I use them because they're clear and (as their title says) they explicitly terminate the scope of a sequence of code. It makes nested IF's much easier to follow for me. My impression of them is that they MUST'VE been useful to others, since they were added to COBOL in its later variants.

My teammates at work hate them and I'm being run into the ground on it. They'd rather use periods, indentations, and NEXT SENTENCEs as indicators. They're mostly older programmers who are pretty set in their ways/opinions. (To add to their intractability, we don't get along that well.)

2) For another example (and one I'd like your input on as well): I tried to suggest using an EVALUATE statement for a segment of code where they had to consider each digit of a string, and they shot me down, even though it would've reduced the code by a third or more. They preferred using a nested IF structure, but unindented in a "Case-like" format. For example:


IF condition a
statement
ELSE
If condition b
statement
ELSE
IF condition c
statement

(etc)...

On the other hand, here's how EVALUATE would look

EVALUATE variable
WHEN condition a
statement
WHEN condition b
statement
WHEN condition c
statement

(etc)...


To me, it makes for cleaner, more understandable code...but they argue that their way is better. When I suggested the use of EVALUATE (which they weren't familiar with), I got shot down. To me, it seems that everyone else is hell-bent on maintaining THEIR preferences, regardless of what may actually be better or may follow more standard practice elsewhere.

Maybe I'm the crazy one. I'd appreciate you guys letting me know.
 
As 3gm mentioned there is no other way to communicate.

you should post your email as WMK did or as follows

my_email
domain is my_domain
most of us will be able to understande that your email is

my_email@my_domain

You may not get a full history from all members here, as many have over 20 years experience, and we will tend to exclude some of it, either because it is irrelevant or just "cant be bothered with it".


Also some of us work as consultants and I am sure that some would not mind consulting to your company [bigcheeks][2thumbsup]

Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
Periods are very easy to see if you use the right font and just adjust the monitor's resolution.

Maybe what we really need is a different symbol for the period like a solid square or something like that.

You know there are these programmers who also argue about never using a period at all except to end a paragraph. Some people just can not accept that some programming languages are different than quick basic and C++. You just have to learn the language you are programming in instead of trying to make it into something else.

What takes more time a Period or END-IF?
Nested IF statements are more confusing than speghetti GOTO code. They sure are not very object oriented programming!!!!!!!! This does not promote structured programming at all!

Blaming the problem on not being able to see the period is a problem with your screen resloution. High resolution is great for video games but is is very undesirable for reading code. Text resolution does not need to be set too high. Programmers get old and need to learn to change the resolution back to about 600 X 800 or just use larger font by default. Dont be a slave to technology, make technology your slave!

Blaming problems on screen resolution is not very intelligent.

If you do not like my post feel free to point out your opinion or my errors.
 
Ok...to reach me:


Syngent
domain: hotmail.com

Most of you here agreed with me; and as I mentioned before, I would like to get title/credentials, experience and any relevant professional information from each of you...your professional opinions will be very valuable in the upcoming days.

If you don't want to leave your name, that's fine...but please mention your screenname here in your EMail so that I can appropriately attribute your opinions to you, where necessary.

THANKS!
 
The only real relevant things about me: 13 years since writing my first program, 11 years since I wrote my first COBOL program, IT business administration degree holder which involved primarily mainframe studies (though I have extensive experience with PCs too), most of my work experience has laid in writing COBOL. All you need to know.

Except that it does seem by your request that the trail to that new job is on its way.
 
JFett,

I will leave my opinion here. (You may look at my profile for credentials. Add to that the fact that my first COBOL job was with a major automotive firm translating the dealer reporting system to COBOL from Autocoder. That should reasonably place me as a peer to your coworkers!)

Bill Klein should be considered authoritative WRT IBM COBOL. [smarty]

In general, the scope delimiters and EVALUATE statement were placed in the language by a group of those same 'mostly older programmers who are pretty set in their ways' who also realized there were some serious shortcomings in the COBOL language. Most of this can be attributed to the structured programming research/revolution/craze occurring in the late 1970s and early 1980s. Since COBOL shop standards were evolving in the same time period, without benefit of the structured programming constructs introduced in the 1985 COBOL standard, those shop standards had to create solutions to the very same problems addressed by structured programming.

It will be interesting to see what technical data Bill Klein's reference material provides. From the standpoint of a compiler writer/vendor, I can tell you that a compiler has a much better shot at optimizing an EVALUATE than it does a string of cascaded IF statements and, more generally, structured code (i.e. code created by rigorous use of scope terminators) stands a far better chance of being optimized by a compiler than does code full of GO [TO] statements and NEXT SENTENCE statements. (Do your shop standards permit GO [TO] statements? If not, why do they permit NEXT SENTENCE, which is merely a disguised GO without an easily discernable label?)

Some complain that these new-fangled (only 20! years old) constructs take more memory. Have you really priced memory recently? Often an optimization (for execution time) requires a memory usage tradeoff.

WRT indenting, as previously mentioned, the compiler is forced to ignore indenting by the standard, so indenting cannot convey information to the compiler. I do know that some programmers become confused because they impute significance to indentations that the compiler does not. Sometimes these programmers even call Technical Support organizations to complain about the compiler creating incorrect code!

ceh4702 (whose tag is, "If you do not like my post feel free to point out [...] my errors.") has incorrectly equated the period-space separator with the END-IF scope delimiter. The period-space separator also creates a sometimes elusive unlabeled target for a branch statement (i.e. NEXT SENTENCE).

I have some other, more emotion-based arguments, but I quit here. Good luck!

Tom Morrison
 
BTW, your troubles are nothing new. In the Autocoder-COBOL job I mentioned in my previous post, I was not allowed to use PERFORM. Reasons:[ul]
[li]it was quite literally 'above my pay grade' to use such confusing (!) features[/li]
[li]it was too inefficient (I don't think the tape reels moved any faster by my use of GO TO!)[/li]
[/ul]

Does that sound somewhat familiar?

Tom Morrison
 
Cant Say I am a master programmer by any means.

I leaned to program in COBOL on an IBM Mainframe (VSE) system (not large business systems) at a community college. When I first started working here we had a system with CICS that they purchases form some outfit that went out of business. This is your typical green screen interface. I have an Associates Degree in CIS and about 80 Credit Hours in Business Systems Information Management at Washington University in St Louis, MO.

In School I was taught both Programming Logic and COBOL by the someone who actually programmed for a living at one time. Never learned any of the new object oriented COBOL but I have had classes in Rule Based Programming, Java, and Microsoft Visual C++.

I have 7 Years on the job experience in one location.

We are in the process of moving our entire system over to a new application system made by Datatel called Colleague which is based on the IBM Unidata Database. It can also run off of Oracle. The new system uses Envision Programming. The new software has a lot wider range of flexibility and is designed for both the community college and the university. It uses Rules and Rule tables to accomplish many tasks. It is constantly being updated and patched by Datatel for upcoming requirements and implemented system changes and version upgrades.

Envision also has an IF THEN ELSE END programming structure. It is a little different in how it works but it works. We use Case Structure as well. Sometimes in their programming they prefer to use GOSUB and sub-programs and their own screen environment. It is a mixture of basic code and the Envision Code where you can design your own screens/forms and windows. It is very similar to something like VB. It can run off of both a Linux Environment or an NT Server Environment.


We presently run our mainframe off of a customized IBM X-Server and a Virtual Environment on top of enterprise SUSE Linux. It operates much like a mainframe. You can not tell that the mainframe OS sits on top of emulation.

Lewis & Clark Community College

I really have this thing about setting the resolution so high that you cant read the font on your monitor. I mean is programming more important or are the Internet and Games more important? Who Knows.

Hobbies: Genealagy, Building my own computers.

You might try looking at some of the NEWSGROUP locations.

alt.comp.lang.cobol or something like that. I cant access a newsgroup from work.

If you do not like my post feel free to point out your opinion or my errors.
 
It's been a while since I checked in with this forum and, in fact, a while since I programmed seriously in Cobol but with over 20 years' experience of IBM (and other mainframe) Cobol I feel like adding my twopenn'orth which supports the general opinion here.

I am somewhat surprised to see that anybody is advocating not using scope terminators. They were one of the best additions ever made to the language, finally making it possible to write good structured code. Before they were introduced one was forced to either write some real ugly code and/or use some very artificial constructs in order to translate structured design into Cobol code.

I must confess to not necessarily using expllicit scope terminators everywhere but I always use End-If. I once worked in a shop where the standards said that no more than three levels of nested IF could be used. As an absolute rule it can be a pain but as a general guideline it's pretty good and I can't imagine writing code which had a long series of End-Ifs before a full stop as per RichInMinn's example; I would suggest rewriting any such construct, probably with Evaluate.

Modern compilers do a pretty good job of optimisation but, quite honestly, if memory or performance differences between If and Evaluate really matter to you then you should be using a different language.

Personally I only use full stops (periods) where necessary to avoid compiler messages and I never ever use Next Sentence. Continue works well with scope terminators, should such action occasionally be required.

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
Personally I only use full stops (periods) where necessary to avoid compiler messages and I never ever use Next Sentence. Continue works well with scope terminators, should such action occasionally be required.

Actually I learned very quick to use periods after every imperative statement as a terminator. It's more consistent with other languages, and it brought less confusion to me if I went back to review my code, especially if I wanted to see what was subordinate code to a conditional. It actually eliminated a lot of my errors too in developing.

Like was said, memory and CPU are dirt-cheap now compared to what most programs can do. Programmer time, however, is not. So it becomes more incumbent to code programs for human consumption rather than computer consumption.
 

Hi Glenn,

I guess you've not been coding long enough! Full stops have been the cause of more problems than I care to recall. I used to work with someone who reckoned there was a finite number of them in the universe and that when you added one somewhere it must have come from another piece of code somewhere else and, conversely, when you removed one it turned up later in testing where it wasn't supposed to be. A light hearted way of looking at it, certainly, but there were times when it was almost believable.

Glenn9999 said:
It's more consistent with other languages,
Some languages use punctuation as mandatory terminator; some use it as optional terminator, and some don't use it at all. I really don't think there is enough consistency to argue for or against it in that vein.

Programmer time, however, is not. So it becomes more incumbent to code programs for human consumption rather than computer consumption.
It is precisely because of this that I would never ever rely on full stops in Cobol. Regardless of one's own preferences, programmers routinely work on code written by others which may or may not use them consistently; their use always needs careful checking. Explicit scope terminators allow for clear demarcation of every construct which requires it - the full stop in Cobol, IMO, belongs to a day long gone.

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top