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



The reason you're getting the unable to allocate error is because of the 
fact that it has to attempt to read the next record, even if the key 
doesn't match, to be sure the key doesn't match.  It can't tell that it's 
done with the ReadE without actually finding a record that doesn't match. 
So in reality, it's working properly.

Ron Power
Programmer
Information Services
City Of St. John's, NL
P.O. Box 908
St. John's, NL
A1C 5M2
Tel: 709-576-8132
Email: rpower@xxxxxxxxxx
Website: http://www.stjohns.ca/
___________________________________________________________________________
Success is going from failure to failure without a loss of enthusiasm. - 
Sir Winston Churchill




"Kurt Anderson" <kjanderson@xxxxxxxxxxxxx> 
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
2005/07/15 12:03 PM
Please respond to
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>


To
"RPG programming on the AS400 / iSeries" <rpg400-l@xxxxxxxxxxxx>
cc

Subject
Unable to Allocate Record (working as designed?)






I was working on a record lock issue, and found something that I'm not
sure is correct.
 
I have code below that you can use to replicate this situation.
 
Read through a set of records for update with ReadE.
If no more records match the key, and the next record is locked, then
the Unable to Allocate Record error will occur.
As a programmer, how can I worry about another record in the file that
may be locked (and justifiably so)?  I'd rather not code (E) on my read
because I prefer any kind of real errors to kill a program and force me
to find and fix the problem.
 
And the most confusing part about this problem, before I figured out
what was wrong... the error message was leading me to believe that
somehow an order maintenance program was accessing an order that was not
the order the user was working with.
 
To replicate with the code below:
TestPF3 needs 2 records (they need to be in the sequence listed). 
1.  XXCode = 'test'
    XXWebRegD = d'2004-05-06'
2. XXCode = 'test1'
    XXWebRegD = d'2004-05-07'
 
Compile TestFile as a program.
Compile TestFile3 as a program.
 
Session A:
StrDbg TestFile3.  Set a breakpoint on the  "code = 'done'" line. 
Call TestFile3.  Sit on the breakpoint line.
 
Session B:
Call TestFile - this will show be unable to complete normally because it
will receive the Unable to Allocate Record error.
 
 
-----------------------------------------
TESTPF3
 
     A          R XXREC                     TEXT('description of rcd')

     A            XXCODE        30A 
     A            XXWEBREGD       L         TEXT('Web Registration
Date') 
     A          K XXCODE

     A          K XXWEBREGD

 
-----------------------------------------
TESTFILE
 
FTestPF3   UF   E           K Disk 
 
D keyfld          S              5    Inz('test') 
 
 /Free 
 
   SetLL keyfld TestPF3; 
   DoU %EOF( TestPF3 ); 
     ReadE keyfld TestPF3; 
     If not %EOF( TestPF3 ); 
     EndIf; 
   EndDo; 
 
  *InLR = *On; 
 
 /End-Free 
 
-----------------------------------------
TESTFILE3
 
FTestPF3   UF   E           K Disk

 

D code            S                   Like( XXCode ) Inz('test1')

D date            S                   Like( XXWebRegD )
Inz(d'2004-05-07') 
 

 /Free

 

   Chain ( code : date ) TestPF3;

   If %found( TestPF3 );

      code = 'done';

   EndIf;

 

  *InLR = *On;

 

 /End-Free

 
 
I appreciate any input.
Thanks,
 
Kurt Anderson
Application Developer
Highsmith Inc.
W5527 State Road 106, P.O. Box 800
Fort Atkinson, WI 53538-0800
TEL (920) 563-9571  FAX (920) 563-7395
EMAIL kjanderson@xxxxxxxxxxxxx
 

As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.