View previous topic :: View next topic
|
Author |
Message |
pkmurali Warnings : 1 Active User
Joined: 15 Dec 2005 Posts: 271
|
|
|
|
Dear all,
I want to read my tapefile in the reversed order using cobol program 'REVERSED'. If so, how can i identify & stop the read process if it reached the first record of my file? will it return '10' as file status as EOF?
Please clarify.
Thanks,
Murali. |
|
Back to top |
|
|
Pravesh
New User
Joined: 30 Jul 2009 Posts: 32 Location: Gurgaon
|
|
|
|
Hi Murali,
If your purpose is to have a file in reverse order than you can use FileAid. Go to copy screen than give these options
Process online or batch ===> B (for tape file) and
Selection criteria usage ===> T
in next screen go to
1 OPTIONS than
SEQ/VSAM processing direction ===> B (read in backward)
than F3,F3 and submit batch job.
Sorry I am not sure regarding file status in cobol program if you want to read in reverese order.
Regards,
Pravesh |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
HTF are you going to read a tape file in reverse? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
The COBOL 85 standard states explicitly that the REVERSED option is obsolete. If you wish to use an obsolete function, be aware that it may not behave as you expect, may not work at all, and any problems you experience will not be addressed as issues by IBM as the REVERSED option should not be used in modern programming. |
|
Back to top |
|
|
Ronald Burr
Active User
Joined: 22 Oct 2009 Posts: 293 Location: U.S.A.
|
|
|
|
"OPEN...REVERSED" may be obsolete according to the ANSI COBOL 85 standard, but it IS still supported by IBM ENTERPRISE COBOL FOR z/OS.
"REVERSED
Valid only for sequential single-reel files. REVERSED is not valid for VSAM files. If the concept of reels has no meaning for the storage medium (for example, a direct access device), the REVERSED and NO REWIND phrases do not apply." |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
will it return '10' as file status as EOF? |
Suggest you create a test tape with a very small amount of data and run a test on your system. . .
This will confirm that you have both a successful compile/link and what happens when the read raises AT END. If my memory is working, the READ. . . AT END occurred when trying to read the record "before" the "first" record - just like when reading normally. Been a very long time. . . |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
And how about VB datasets? |
|
Back to top |
|
|
Ronald Burr
Active User
Joined: 22 Oct 2009 Posts: 293 Location: U.S.A.
|
|
|
|
I don't know exactly how the access method works when reading VB/VBS datasets in reverse, but it does work. Perhaps the access method checks the BDW/RDW's starting from the beginning of each physical block to determine where each logical record starts within the block and keeps the actual buffer addresses/offsets in a table so that it can "read" records in reverse order, AND also maintains an indicator so that it knows whether the first RDW belongs to a segment other than the first segment of a spanned record, and therefore needs to read another previous block in order to find the beginning of that logical record.
At least, that's how I would go about trying to read records in reverse order, if I were to attempt to do so. |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
Ronald Burr wrote: |
I don't know exactly how the access method works when reading VB/VBS datasets in reverse, but it does work. Perhaps the access method checks the BDW/RDW's starting from the beginning of each physical block to determine where each logical record starts within the block and keeps the actual buffer addresses/offsets in a table so that it can "read" records in reverse order, AND also maintains an indicator so that it knows whether the first RDW belongs to a segment other than the first segment of a spanned record, and therefore needs to read another previous block in order to find the beginning of that logical record.
At least, that's how I would go about trying to read records in reverse order, if I were to attempt to do so. |
No way you could do that in COBOL, obsolete and all the stuff.
You could use ,for example, a BSAM functionality to accomplish that.
But that needs some assembler programming.
Or start at the beginning of the tape dataset, count the records and do
some reading backward decreasing the recno.
But now im going to loose my mind, of course after heavy boozing we IT
guys need to do in a while. |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
It's hard to believe that there are still Data Centers out there with drives that support reel tape. |
|
Back to top |
|
|
pkmurali Warnings : 1 Active User
Joined: 15 Dec 2005 Posts: 271
|
|
|
|
oh i dint see this comment
Quote: |
"REVERSED
Valid only for sequential single-reel files. REVERSED is not valid for VSAM files. If the concept of reels has no meaning for the storage medium (for example, a direct access device), the REVERSED and NO REWIND phrases do not apply." |
Apologies. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Also in General Rules (6.2.26.1) it states
Quote: |
When OPEN REVERSED is specified, the record format must be fixed. |
|
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1248 Location: Richfield, MN, USA
|
|
|
|
Interesting. In my 40 years in IT, I've never had to read a data set in reverse sequence. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Terry,
maybe you did not take the appropriate classes resulting in such homework. |
|
Back to top |
|
|
Ronald Burr
Active User
Joined: 22 Oct 2009 Posts: 293 Location: U.S.A.
|
|
|
|
Terry Heinze wrote: |
Interesting. In my 40 years in IT, I've never had to read a data set in reverse sequence. |
Perhaps you've just never had to PROGRAM a reverse read yourself, but I'll bet you've done reverse reading lots of times - e.g. every time you scroll in reverse ( UP or PREV ) while browsing a dataset. |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1248 Location: Richfield, MN, USA
|
|
|
|
That reminds me of the only time, I'm aware of, that I had to read keys of an ISAM (the predecessor of VSAM) file in pseudo reverse sequence, the keys were inserted in 9s complement so that the last record read was actually the most current price in a price list file. Obviously, that was before reverse reading was available. |
|
Back to top |
|
|
CaptBill
New User
Joined: 28 May 2009 Posts: 20 Location: Oklahoma City, OK USA
|
|
|
|
The only time I have seen REVERSE used was in a SORT using TAPE as the intermediate media. |
|
Back to top |
|
|
|