× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Don't DECLARE CURSOR statements have to be pretty high up in the source? Like the first SQL statements?

Or maybe first in a procedure - I don't think we can put them where they are opened now - we used to, though.

Vern

On 6/25/2014 10:33 AM, Buck Calabro wrote:
On 6/24/2014 2:19 PM, Gary Thompson wrote:
I'm changing an existing program and noticed we have a variety of "styles" for
where sql cursor declare statements are embedded:

1) "in line" in the subrtn/subproc where the cursor is opened

2) In *inzsr

3) On c specs just after the last d specs and prior to any "business logic"
In the interest of trying to make a "shop standard" I'm welcoming comments
Thanks!
I personally prefer #3 but I have some thoughts to share on shop standards.

Don't bother.

Coding standards are a great idea if you work in a mammoth place where
turnover is something to be constantly dealt with, where some large
proportion of the programmer population are raw juniors, or where the
code must pass some strict military / industry audit.

Guidelines have a place in helping programmers quickly sort out the
multitude of trivial decisions that happen every hour: Hungarian? Java?
Braces on this line or the next? Indent 2 or 3? //, -- or /*? Inline
or right side comments? But these guidelines are best discovered by the
actual programming team talking it out.

Promulgating a standard won't actually impose a standard unless you also
have formal code reviews.

And there's one ugly issue that 'standards' always bring up: Existing
code. I'm in an existing program and I need to do some simple
maintenance. Contrary to standard, the code is indented 3 spaces. Do
you really want to pay me umpty-hundreds of dollars to change the
indenting of this program from 3 to 2 spaces? If I don't do that work,
the program is in violation of standards, and if that's the case, then
where's the 'standard'?

If the goal is to unify the look of the code going forward, then why not
talk it out among the team and see if everyone can agree to a particular
style? They'll be far more likely to adhere if they have buy-in, and if
your team gets in the habit of looking at each others' code (informal
code review) you'll be in the habit of discussing more substantial
coding habits (refactoring?) as well as matters of style.

--buck


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.