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

ENDING AT/THRU with superdescriptor


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

Active User


Joined: 23 Dec 2005
Posts: 176
Location: India

PostPosted: Wed Nov 11, 2009 10:22 pm
Reply with quote

Hi,

This question comes from an interviewer.

Why ENDING AT/THRU can not be used with superdescriptor?

Can somebody help me in answering this question?
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Wed Nov 11, 2009 11:36 pm
Reply with quote

As far as I know, there's no such limitation. May be you meant hyperdescriptors?

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

Active User


Joined: 23 Dec 2005
Posts: 176
Location: India

PostPosted: Thu Nov 12, 2009 9:04 pm
Reply with quote

Yes. I agree to your point. Otherwise usually we use the ENDING A/THRU with the superdescriptors only.

This makes me to think.

Why such restrictions for hyperdescriptors? I did not work on this descriptor any time.
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Sat Nov 14, 2009 2:48 am
Reply with quote

That's easy: Hyperdescriptor is used to generate descriptor values based on a user-supplied algorithm.

Since the ENDING clause is handled by ADABAS, and since ADABAS can't tell the next value of a user-defined sequence, hence you can't use it for hyperdescriptors.

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

Active User


Joined: 23 Dec 2005
Posts: 176
Location: India

PostPosted: Sat Nov 14, 2009 12:52 pm
Reply with quote

Thats cool. Good to know about it. Thank you. icon_smile.gif
Back to top
View user's profile Send private message
Steve Robinson

New User


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

PostPosted: Sat Nov 14, 2009 11:35 pm
Reply with quote

A correction to earlier post.

Adabas does not deal with ENDING AT clauses; Natural does.

Adabas does deal with Hyper Descriptors.

So, since Natural does not have access to Hyper Descriptors, it cannot use same in an ENDING AT clause.

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

New User


Joined: 21 Nov 2009
Posts: 58
Location: California

PostPosted: Wed Dec 09, 2009 9:56 am
Reply with quote

Since no one challenged the responses, it looks like you all failed the interview! icon_smile.gif Well, this particular question, anyway. This may be due in part to the interviewer being misquoted - see below.

First, as to hyperdescriptors, their values may be generated in a non-Natural way (a user exit coded in Assembler), but they are treated by Natural just like a superdescriptor, and can be used anywhere a super is used.

The interviewer's question applies not only to superdescriptors, but also to subdescriptors and hyperdescriptors. It probably was phrased, "When can THRU not be used with a superdescriptor?", rather than why.

Here's a working example of FROM/THRU, using subdescriptor DEPARTMENT in the EMPLOYEES demo file.
Code:
DEFINE DATA LOCAL
1 EMP VIEW EMPLOYEES
  2 PERSONNEL-ID
  2 DEPT
  2 DEPARTMENT     /* For use by THRU
END-DEFINE
R.
READ EMP BY DEPARTMENT FROM 'ADMA'
                       THRU 'ADMA'
  DISPLAY DEPT (AL=4)
          PERSONNEL-ID
*   UPDATE (R.)
END-READ
END

For the THRU clause (I find the synonym ENDING AT too wordy), Natural needs memory locations in which to place the "retrieved" descriptor value, so that a comparison can be made to the value provided (THRU 'ADMA'). In this example, it means that the subdescriptor, DEPARTMENT, must be included in the view.

What happens when the UPDATE statement is reinstated? Adabas will try to update each field in the view, but Natural knows that the subdescriptor does not actually exist as a field in the EMPLOYEES file, so he issues a NAT0633 at compile-time.
Quote:
NAT0633 Invalid use of view which contains super-/subdescriptor.


To answer the interviewer's question
Quote:
You cannot code THRU with a sub/super/hyper-descriptor in an update READ loop.


To keep the UPDATE, the corrective action is to remove the descriptor from the view. For Natural 3, you replace the THRU with an IF ... ESCAPE BOTTOM statement block to test for the end of range. For Natural 4, you replace the THRU with TO, which does not require the descriptor definition in the view because Adabas tests for the end of range.
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 SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Shift left VB record without x00 endi... DFSORT/ICETOOL 11
No new posts Dataset name ending with YYYY-MM-DD DFSORT/ICETOOL 5
No new posts STARTING FROM/ENDING AT vs STARTING F... Java & MQSeries 4
No new posts Old story ...New ending General Talk & Fun Stuff 0
Search our Forums:

Back to Top