-NL - use or avoid ?

Posted by oedev on 19-Sep-2016 05:20

Hi All

What is the general opinion about the use of the -NL start-up parameter ? We currently don't use it, so developers have to specify no-lock on all record retrieval (we don't use share-locks, so it's either no-lock or exclusive-lock).

The argument being put against the use of -NL is that it will make the developers "lazy" and stop specifying NO-LOCK. I see -NL as more a defensive mechanism to avoid unwanted share-locks (which does happen occasionally, regardless of how diligent a developer is).

Thoughts?

Thanks.

All Replies

Posted by Mike Fechner on 19-Sep-2016 05:26

Don't use it. Lazy developers can create editor macros. But the source code needs to be clear. Especially in such critical elements as the record locking.

And if you ever need to import code from other sources into your code base, you'd first have to negotiate if their code is compatible with -NL.

I remember a situation where we were customizing Progress Dynamics and suddenly a developer felt clever and added -NL to the shared pf file. And bam ... the Dynamic session management did not work anymore on AppServers, because that was one of the rare occasions where a share lock was required (and not explicitly coded, because it was the default). Bad code, yes ... but did cost me three days debugging at that time.

To ensure that you are not using share locks where you shouldn't, look at Gilles Querrets work with SonarSource. Or prolint.

Posted by oedev on 19-Sep-2016 05:40

Thanks Mike, some good points as always.

Do Prolint and SonarSource work with dynamic queries ?

This thread is closed