Looking for relevant AS/400 Whitepapers? Visit the Search400.com Research Library.
GreenleeB | Jul 23 2008 3:52PM GMT
You don’t explain what you are doing or your objection to doing a CHAIN. I think this operation is probably the best bet. I used to adhere to the SETLL because logically you’d think that the SETLL by itself would not move data like the CHAIN would and would be more efficient but I was told by IBM some years ago that there really isn’t much difference performance-wise. The SETLL won’t replace data that already in the buffer, though. So, whatever you’re most comfortable with. It really depends on what you need to do.
Sloopy | Jul 24 2008 2:29PM GMT
There may not be much difference between CHAIN and SETLL, performance-wise, but still I would recommend using SETLL, just because you are not reading data into your program, and not locking the record.
Especially if the file you are CHAINing to is opened for update in the program - then, if you find the record but were only doing an existence check, you MUST unlock the record, or make sure that you used the (N) extender on the CHAIN opcode (or ‘N’ in the half-adjust column if you are using RPG/400).
I have found in some legacy code that most ‘mysterious’ errors involving locked records are caused by unneccessary CHAINs holding unneccessary locks; and the buggy code can be hard to find.
Regards,
Sloopy
Gilly400 | Jul 24 2008 2:47PM GMT
Hi,
One extra thing to bear in mind (adding to Sloopy’s comments on record locks) - If you’re using commitment control and READing/CHAINing a lot of records, your job will keep ALL of these records locked for UPDATE until they’ve been released/unlocked or your changes have been committed.
Not only can the fact that the records are locked cause plenty of problems with other processes, but it can have a severe performance impact as your job will need to use more and more storage to manage all the locks.
Regards,
Martin Gilbert.