• Subject: Re: Error Indicator on Write
  • From: "Simon Coulter" <shc@xxxxxxxxxxxxxxxxx>
  • Date: Tue, 16 Mar 99 00:31:21 +1100

Hello Dave,

Modesty is my only failing :)

You are correct that SETLL respositions the file cursor.

I think you are probably correct in your reasoning in the limited case that I 
want to check for existence and 
mostly what I am checking for is unlikely to exist.  However I can't think of 
many cases where I would want 
that.

Mostly an existence check is performed prior to a write (as in the original 
append) and in this case if the 
record is unlikely to exists then don't check first.  Simply do the WRITE and 
handle any exception/error.

Regards,
Simon Coulter.


 FlyByNight Software         AS/400 Technical Specialists       
 Eclipse the competition - run your business on an IBM AS/400.  
                                                                
 Phone: +61 3 9419 0175      Mobile: +61 0411 091 400           
 Fax:   +61 3 9419 0175      mailto: shc@flybynight.com.au      
                                                                
 Windoze should not be open at Warp speed.                      

//--- forwarded letter -------------------------------------------------------
> Date: Tue, 09 Mar 99 10:23:52 +0000
> From: david.kahn@gbwsh.mail.abb.com
> To: MIDRANGE-L@midrange.com
> Reply-To: MIDRANGE-L@midrange.com
> Subject: Re: Error Indicator on Write

> 
> "Simon Coulter" <shc@flybynight.com.au> wrote:
> 
> >This topic has raised a few questions.  Here is the definitive
> >answer (Conceited? Watashi?).
> 
> Modest? Anata? Simon, that was a very, very good answer and it certainly
> put a stop to some off-beam replies that were trickling in. However, you
> should never assume an answer is definitive in this forum. At the risk of
> scratching an old sore then...    :-)
> 
> 
> >Checking should be dome with CHAIN if you want to process
> >the data in the program or SETLL if you are simply checking
> >existence.  The raison d'etre behind these recommendations
> >is avoiding exception overhead and data overhead.
> 
> This is the conventional wisdom, and the reasoning is sound, but I think
> it's a bit too simplistic. If a record is found, CHAIN has the overhead of
> importing the data and is therefore more expensive than SETLL. However, if
> the record is not found then the CHAIN command is significantly less
> expensive than SETLL as the latter command has to execute the code to
> position the file. That, at least, is my understanding.
> 
> Therefore the guidance that I follow is:
> 
> If I want to process the record data:    CHAIN
> If I want to test for existence:
>      If the record is more likely not to exist than to exist:     CHAIN
>      Otherwise:     SETLL.
> 
> This question came up a couple of years ago, and I think I persuaded a few
> people then that I was right. Unless anyone knows better?
> 
> Dave Kahn, ABB Steward Ltd.

+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 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 here. If you have questions about this, please contact [javascript protected email address].