James, I doubt this applies to MI, but in RPGLE I'd use the special
value *START. In general, this is why I avoid file I/O by RRN.
-Eric
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of James H. H. Lampert
Sent: Thursday, March 18, 2010 1:19 PM
To: RPG programming on the IBM i / System i
Subject: Failed SETLL leaving program at undefined position in SQL VIEW,
butnot in DDS LF
This is really about an MI program (see the thread on the MI list), but
it also happens in an RPG test program that approximates the
point-of-failure in the MI, so maybe somebody who's here, but not on the
MI list might have an insight.
It seems that with this code (intentionally opening the file in
program-described mode, as that's essentially what happens in the
original MI program):
FHPADLPUA IF F 1243 DISK
D RECORD DS 1243
C 1 SETLL HPADLPUA
121314
C READ HPADLPUA RECORD
if I run it on a DDS LF, and RRN 1 is omitted by a SELECT clause in the
DDS, the SETLL comes back with an error, but the READ still finds the
first record that satisfies the SELECT.
But if I run an otherwise identical program on an equivalent SQL VIEW of
the same data, the READ fails, evidently from the file being left at an
undefined position.
SETGT (and this surprised me) also returned with an error, and left the
SQL VIEW at an undefined position.
Anybody know of a way, short of iteratively SETLLing until a record is
found, to deal with this?
--
JHHL
As an Amazon Associate we earn from qualifying purchases.