access records from bottom onwards

vipinrye
Posts: 7
Joined: Mon May 24, 2010 6:13 pm
Skillset: fresher in Mainframe
Referer: Subramani

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?

User avatar
Akatsukami
Global moderator
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Skillset: Rexx, JCL, DB2/SQL, TSO/ISPF, PL/I
Referer: ibmmainframes
Location: Bloomington, IL
Contact:

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

steve-myers
Global moderator
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Skillset: Assembler, JCL, utilities
Referer: zos.efglobe.com

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!

vipinrye
Posts: 7
Joined: Mon May 24, 2010 6:13 pm
Skillset: fresher in Mainframe
Referer: Subramani

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..

User avatar
Akatsukami
Global moderator
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Skillset: Rexx, JCL, DB2/SQL, TSO/ISPF, PL/I
Referer: ibmmainframes
Location: Bloomington, IL
Contact:

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

sinmani
Posts: 93
Joined: Thu Mar 22, 2012 10:02 am
Skillset: COBOL
CICS
JCL
DB2
VSAM
IMS
Referer: INTERNET

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

User avatar
MrSpock
Global moderator
Posts: 809
Joined: Wed Jun 06, 2007 9:37 pm
Skillset: REXX, JCL, DFSORT, Syncsort, Axway MFT, Connect:Direct, FTP, SFTP
Referer: ibmmainframes.com
Location: Raleigh NC USA
Contact:

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.

BillyBoyo
Global moderator
Posts: 3805
Joined: Tue Jan 25, 2011 12:02 am
Skillset: Easytrieve Plus, Cobol, Utilities, that sort of stuff
Referer: Google

Re: interview question???

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

Not in Enterprise Cobol,

Ed Goodman
Posts: 341
Joined: Thu Feb 24, 2011 12:05 am
Skillset: 30 years on IBM mainframes
Referer: Searched for Frank Yeager

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.

Robert Sample
Global moderator
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Skillset: Systems programming, SAS, COBOL, CICS, JCL, SMS, VSAM, etc.
Referer: other forum
Location: Dubuque, Iowa, USA

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.


  • Similar Topics
    Replies
    Views
    Last post