You can do this in procedures (or functions, which is actually the same,
difference: a function returns something), which can be in the same source
file. But that has nothing to do with files; files are always global.
The background for your locking problem: With one access path you have one
file cursor that can point to and lock a record. If you need to lock
multiple records you'll need more access paths with one file cursor each.
You can open the same file more than once to get multiple access paths (do
not share access pathsin this case!).
F FILE UF DISK
F FILE1 UF DISK RENAME(RECORD:RECORD1)
F FILE2 UF DISK RENAME(RECORD:RECORD2)
and so on
with some overrides before the call:
OVRDBF FILE TOFILE(FILE) SHARE(*NO)
OVRDBF FILE1 TOFILE(FILE) SHARE(*NO)
OVRDBF FILE2 TOFILE(FILE) SHARE(*NO)
and so on
This is the same in the "old-fashioned way" as in ILE. It would be the same
if you call sub-programs. The point is the number of access paths = file
Of course there are limitations. If you have to lock 5 records or so and
this number will not grow in the future, i would use this approach.
With a higher or a unknown number of records to lock at the very same time,
i'd think over
- Paul's suggestion with commitment control
- a logical lock by means of a field, saying "this record is locked",
although this has some disadvantages if unlucky implemented.
Hope this helps
Vienna, Austria, Europe
>I want to lock multiple records from one file at the same time.
>I'm not familar (yet) with ILE but read something about local vars and
>Is this possible or has someone a piece of code?