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



If this is for a file id (like order number, customer number, etc) then I 
would suggest using an identity column in the table itself.  Check out the 
V5R2 SQL Reference for identity columns.  This would significantly reduce 
the amount of code needed, and the errors.  There is a field in the SQL 
data area that will tell you the number posted, if you need that.  Also, 
there is a SQL 'Values' function that will return that number also. 
Although I would stick with the data area, because if you have people 
hammering in the file someone could post a record in between your post and 
the time you execute the Values function, thus getting their number.

The problem with using a file, especially with an 'approve' option is that 
many people want the new number on the approve screen.  However if you do 
NOT approve it, then they want the new number to be reused.  The problem 
with this, is that you then need to handle the record locking on the 
number file.  You either lock the number, (and shoot the person when they 
leave it on the approve screen and go to lunch), or when they finally do 
approve you say, 'sorry slow poke, that number got used by someone else, 
is this new number good?'  And if you got a rapid turnover of new numbers 
the odds of locks increases.  Often it becomes a show the number only 
after they approve.  "Customer 1295 - xyz corp, added".  And if you're 
going to do that, all the more reason to use the identity column.

Others may suggest data areas, etc, instead of a file.  As far as I am 
concerned, they all have the same limitation with locking.

Rob Berendt
-- 
Group Dekko Services, LLC
Dept 01.073
PO Box 2000
Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com





simafrog <SimaFrog@xxxxxxxxxx> 
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
03/22/2004 10:56 AM
Please respond to
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>


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

Subject
Special Considerations for a one record file?






HI I have a file that contains a one record only, one field in fact that 
is a running number that users will get a display of this number, approve, 
and then the next number will be displayed and updated. Then within the 
same program they can go and get a new next number. I am unsure of the 
file aspect. I am doing a Read each time with LR for EOF. Is there going 
to be Open file status and should this file be closed each time? The file 
is not keyed.
Thank you,
Rob
_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



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.