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



Of course, if you remove all external data definitions (including SQL
variable LIKE definitions), and then subsequently change a field
attribute, you will be looking at program code changes rather than just
recompiles. Swings and roundabouts.

Trevor Briggs
Analyst/Programmer
Lincare, Inc.
(727) 431-1246
TBriggs2@xxxxxxxxxxx

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Thursday, November 01, 2012 12:12 PM
To: RPG programming on the IBM i / System i
Subject: Re: Are level checks still useful?

Dale,

Most likely, you have LVLCHK(*NO) on the PF, but LVLCHK(*YES) on LFs
that are read by the programs.

The reason you don't have level checks in PHP (and similar environments)

is because they don't have hard-coded from/to positions in fields in the

record. When you compile an RPG program, the compiler reads the
external definition, and hard-codes the from/to positions of fields in
the record into the program. You have to recompile for it to update
these -- and therefore, level checks are an important safeguard. Without

them, if the file changes, you'll end up reading (or worse, writing)
incorrect data at incorrect places in the record, causing a big huge
mess.

If you don't like getting the errors, eliminate all your F-specs.
Instead, use SQL to read all files, and read into program-defined
variables (don't use an external definition for the variables you read
into.) Then you will eliminate level check errors, making your RPG
program work the same way the PHP programs do.

-SK



On 11/1/2012 8:17 AM, dale janus wrote:
We are in the slow, gradual process of changing from DDS to DDL.
Actually, we are creating new files with ops navigator and usually not
keeping the create specs. We just use navigator to change the file
when
needed. Mostly we need record ID and timestamp, or date fields added.

But we have lots of old files. Yesterday, we needed to add 2 fields
to a
file (a timestamp and a record id, both added with DDL in ops nav.)
Since we are adding the fields to the end of the files, we figured
this
would be a good time to remove level check from the file. But it did
not
work.

Here is our process for adding new fields to a file. We have a
library
that contains all our RPG, DDL, CL etc. but no data. We add the new
fields to the file (called DIRECT). We change to level check *no.
This
creates an empty file with the new fields.

We write a CL program to copy the data from production library to
empty
library using CPYF with *nochk. Then in the production library we
delete
all the logicals, rename the existing file to DIRECTOLD. Next CPYF
from
the empty library file (now filled with production data and new
fields)
to the production library, CRTFILE(*YES) then recreate the logicals.

When checking with DSPFD, both the file in the empty library and
production library say:
Record format level check . . . . . . . . . : LVLCHK *NO

Yet when I run programs against the file DIRECT or its logicals, I get
level check CPF4131errors.

So I had to recompile all the programs anyway.

We are a small shop with just 2 of us. We write all our own code, so
we
are quite sure that adding fields to the end of a record will not
affect
old programs.

I am RPG guy, my associate is PHP/WEB guy. He just kind of rolls his
eyes at me when I jump through all these hoops to add fields. His PHP
programs just keep on rolling, no matter what the file looks like.



So this long discourse asks two questions.

Why do my RPG programs (some RPG III, some ILE) insist on level check
when the file says LVLCHK *NO?

And

Is level check still useful? The ability to quickly add fields to
files
seems to outweigh the comfort of your rpg programs knowing exactly
what
the file looks like. Especially when half (uhh, maybe not half but
lots
of them) of your programs are PHP.

---Dale







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.