access records from bottom onwards



access records from bottom onwards

Postby vipinrye » Mon Nov 29, 2010 7:43 pm

I have 50 records in vsam , i want access records from bottom onwards. what is the logic for that?
vipinrye
 
Posts: 7
Joined: Mon May 24, 2010 6:13 pm
Has thanked: 0 time
Been thanked: 0 time

Re: interview question???

Postby Akatsukami » Mon Nov 29, 2010 8:36 pm

What kind of VSAM data set?
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: interview question???

Postby steve-myers » Mon Nov 29, 2010 8:48 pm

And what do you mean by, "access records from bottom onwards?" I suspect the interviewer (as opposed to the interviewee) doesn't know very much!
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: interview question???

Postby vipinrye » Tue Nov 30, 2010 3:15 pm

sequential data... he wan to read the data from bottom to top? by default reading processes starts from top 2 bottom..
vipinrye
 
Posts: 7
Joined: Mon May 24, 2010 6:13 pm
Has thanked: 0 time
Been thanked: 0 time

Re: interview question???

Postby Akatsukami » Tue Nov 30, 2010 4:25 pm

If it is known that there are only fifty records, read the ESDS into an array (table, etc.) and then process it in a loop from 50 to 1 by -1.

When you tell the interviewer that, raise one eyebrow in a supercilious fashion and tell him in a patronizing tone of voice, "Of course, no real application needs to do that; is this an inept attempt to determine my VSAM knowledge or an inept attempt to determine my problem-solving ability?"
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: interview question???

Postby sinmani » Fri Mar 23, 2012 9:28 pm

Move high values to KEY and then issue READ PREV command.

Hig values will make the keys point after last record
Read previous will make it start reading from last to first
-----------------------------------------
As long as you think you are a student, you are doing well.
The day you consider yourself as the master of the game..........well
sinmani
 
Posts: 93
Joined: Thu Mar 22, 2012 10:02 am
Has thanked: 14 times
Been thanked: 0 time

Re: interview question???

Postby MrSpock » Fri Mar 23, 2012 10:18 pm

I'm not a COBOL guy, but I believe that's incorrect. I don't think there is a READ PREV in COBOL.
User avatar
MrSpock
Global moderator
 
Posts: 808
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 4 times

Re: interview question???

Postby BillyBoyo » Fri Mar 23, 2012 10:24 pm

Not in Enterprise Cobol,
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: interview question???

Postby Ed Goodman » Fri Mar 23, 2012 10:46 pm

So probably the question comes from someone not using IBM Enterprise COBOL. Since it's "COBOL", the answer is to use READ PREV. Sad that the person taking the test will get the wrong answer for the right reason.

I guess the smart thing to do is to find out ahead of time which version of COBOL is being used at the job site. My MicroFocus COBOL manual has "READ PREV" as a valid option.
Ed Goodman
 
Posts: 341
Joined: Thu Feb 24, 2011 12:05 am
Has thanked: 3 times
Been thanked: 17 times

Re: interview question???

Postby Robert Sample » Sat Mar 24, 2012 12:07 am

Since this is a MAINFRAME forum, the presumption should be use of Enterprise COBOL (or one of its predecessors). And in Enterprise COBOL, the answer is that it cannot be done in batch (although CICS supports it).

I use Open COBOL on my Linux and Windows platforms and it, too, has READ PREVIOUS as an option.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times


Return to Interview Questions

 


  • Related topics
    Replies
    Views
    Last post