Page 1 of 1

access records from bottom onwards

PostPosted: Mon Nov 29, 2010 7:43 pm
by vipinrye
I have 50 records in vsam , i want access records from bottom onwards. what is the logic for that?

Re: interview question???

PostPosted: Mon Nov 29, 2010 8:36 pm
by Akatsukami
What kind of VSAM data set?

Re: interview question???

PostPosted: Mon Nov 29, 2010 8:48 pm
by steve-myers
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!

Re: interview question???

PostPosted: Tue Nov 30, 2010 3:15 pm
by vipinrye
sequential data... he wan to read the data from bottom to top? by default reading processes starts from top 2 bottom..

Re: interview question???

PostPosted: Tue Nov 30, 2010 4:25 pm
by Akatsukami
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?"

Re: interview question???

PostPosted: Fri Mar 23, 2012 9:28 pm
by sinmani
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

Re: interview question???

PostPosted: Fri Mar 23, 2012 10:18 pm
by MrSpock
I'm not a COBOL guy, but I believe that's incorrect. I don't think there is a READ PREV in COBOL.

Re: interview question???

PostPosted: Fri Mar 23, 2012 10:24 pm
by BillyBoyo
Not in Enterprise Cobol,

Re: interview question???

PostPosted: Fri Mar 23, 2012 10:46 pm
by Ed Goodman
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.

Re: interview question???

PostPosted: Sat Mar 24, 2012 12:07 am
by Robert Sample
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.