Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Which coding is efficient?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Java & MQSeries
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    Post subject: Which coding is efficient?
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: 2360
Location: Israel

PostPosted: Fri Jan 30, 2009 9:15 pm    Post subject:
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    Post subject: Reply to: Which coding is efficient?
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: 2360
Location: Israel

PostPosted: Sun Feb 01, 2009 11:17 am    Post subject:
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    Post subject:
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    Post subject:
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    Post subject: Re: Which coding is efficient?
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    Post subject: Reply to: Which coding is efficient?
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    IBMMAINFRAMES.com Support Forums -> Java & MQSeries All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Efficient sorting chandracdac DFSORT/ICETOOL 5 Sat Oct 22, 2016 3:23 am
No new posts Which is more efficient? pshongal DB2 6 Wed Mar 16, 2016 2:55 pm
No new posts Choosing efficient computational data... sachinji84 COBOL Programming 1 Fri Feb 13, 2015 8:39 am
No new posts Need help on coding an Assembler Table saranyasakthivel PL/I & Assembler 9 Thu Jan 08, 2015 7:03 pm
No new posts ISPF Panel Coding Soumick Sarkar TSO/ISPF 4 Tue Mar 25, 2014 11:36 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us