× 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.




On 11/1/2012 3:39 PM, Gqcy wrote:
O, this appears to be a religious argument.
I was thinking there were actual reasons against turning off level check.


RPG hard-codes the field positions in the record. So if you start out with a file like this:

A R MYREC
A FIELD1 10A
A FIELD2 9P 2
A FIELD3 3A

That means that field1 occupies positions 1-10, field2 occupies 11-15, field3 occupies 16-18.

If you then change your file to look like this:

A R MYREC
A FIELD1 10A
A FOO 1S 0
A FIELD2 9P 2
A FIELD3 3A

the positions of FIELD2 and FIELD3 are now one position different. With this change they are in positions 12-16 and 17-19, respectively. But, until the RPG code is recompiled to pick up the new definitions, it'll still try to read/write them from positions 11-15 and 16-18, because it doesn't know that they have changed.

A "record format level check" (LVLCHK) is to protect you against reading garbage data (part of one field, part of another) when reading, and worse, overwrite part of one field with part of another when writing.

With LVLCHK(*YES), RPG will get a level check error, and the programmer will know that he has to recompile his program. If he forgets or a program gets missed, it continues to get the error, which is better than corrupting the data.

Make sense?

However, it's not really like russian roulette, which was a bad analogy. After all, we in the RPG community lived with program-described files for many years. It wasn't as nice, but it wasn't like we were constantly dying from gunshot wounds, either. You just had to be more careful, that's all. The same is true of LVLCHK(*NO). It's not "pure concentrated evil", but rather, you just have to be more careful.

IMHO, it's just not worth it (except maybe temporarily, if you have a very small upgrade window). It's just not that hard to recompile everything.

And if you /want/ to eliminate level checks, using SQL is a much better, cleaner, safer way to go about it than simply turning off LVLCHK.

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.