IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Which coding is efficient?


IBM Mainframe Forums -> Java & MQSeries
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
atulbagewadikar

New User


Joined: 15 Jun 2006
Posts: 26

PostPosted: Fri Jan 30, 2009 6:17 am
Reply with quote

Hi,

Which is more efficient way from below two & how:

1. READ view BY descriptor/superdescriptor WHERE condition

2. READ view BY descriptor/superdescriptor
ACCEPT IF (the same condition given on WHERE clause above)

Regards,
Atul
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Fri Jan 30, 2009 9:15 pm
Reply with quote

In most cases,the first option.

O.
Back to top
View user's profile Send private message
atulbagewadikar

New User


Joined: 15 Jun 2006
Posts: 26

PostPosted: Sat Jan 31, 2009 5:57 am
Reply with quote

Ofer,

Could you please explain how it works in background?
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Sun Feb 01, 2009 11:17 am
Reply with quote

Sorry, I can't tell that, since I don't know that. I only know that Software AG's fine manuals state, more then once, that the usage of ACCEPT should be limited as it is known to perform a little heavy.

I can guess, however, that the WHERE criteria are filtered by ADABAS, whereas the ACCEPT/REJECT statements are pure NATURAL.

O.
Back to top
View user's profile Send private message
Ralph Zbrog

New User


Joined: 21 Nov 2009
Posts: 58
Location: California

PostPosted: Sat Dec 12, 2009 1:48 am
Reply with quote

Ofer71's first statement is correct - WHERE is a tad faster than ACCEPT, but WHERE is applied by Natural, not Adabas.

The rule of thumb is, the fewer the number of statements, the more efficient the program. This is based on the presumption that each statement is interpreted at run time. (In fact, some statements are generated as machine code, even more if you have Natural Optimizer Compiler.)

Since WHERE is a clause and ACCEPT is a statement, WHERE will be a tad faster.
Back to top
View user's profile Send private message
Steve Robinson

New User


Joined: 14 Nov 2009
Posts: 12
Location: U.S.

PostPosted: Thu Dec 17, 2009 3:37 am
Reply with quote

As far as performance goes, there is an additional difference between ACCEPT and WHERE.

A record that "flunks" a WHERE clause does not increment *COUNTER.

A record that "flunks" an ACCEPT has already incremented *COUNTER.

Forgetting performance for a minute; as Ralph noted, WHERE is part of the READ. By contrast, ACCEPT is a standalone statement.

This means ACCEPTs can be scattered throughout a READ loop.

I find the functionally equivalent IF some-condition ESCAPE TOP easier to read, and hence, understood by maintenance programmers. But that is purely subjective.

steve
Back to top
View user's profile Send private message
nan_ishan

New User


Joined: 15 Apr 2009
Posts: 3
Location: Pune

PostPosted: Thu Feb 18, 2010 1:26 am
Reply with quote

atulbagewadikar wrote:


1. READ view BY descriptor/superdescriptor WHERE condition

2. READ view BY descriptor/superdescriptor
ACCEPT IF (the same condition given on WHERE clause above)



Defintely the first one is more efficient.
Reason:
In first case by giving where clause the number of records fetched from Adabas is limited.

In second case the entire adabas file will be read and the unmatching records will be skipped.

Thus, considering performance wise, first case is efficient.

* Please correct if I am wrong
Back to top
View user's profile Send private message
Ralph Zbrog

New User


Joined: 21 Nov 2009
Posts: 58
Location: California

PostPosted: Thu Feb 18, 2010 2:40 am
Reply with quote

The number of records retrieved by Adabas is identical!

Both WHERE and ACCEPT conditions are applied by Natural, so the records must be returned to Natural for the conditions to be applied.

See my posting above for an explanation of why WHERE is a bit faster than ACCEPT.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Java & MQSeries

 


Similar Topics
Topic Forum Replies
No new posts How efficient are you, while working ... General Talk & Fun Stuff 0
No new posts SMS:- Efficient filter lists in ACS All Other Mainframe Topics 7
No new posts Efficient sorting DFSORT/ICETOOL 5
No new posts Which is more efficient? DB2 6
No new posts Choosing efficient computational data... COBOL Programming 1
Search our Forums:

Back to Top