Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

What could be file status check if i read the file reversed?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 236

PostPosted: Mon Dec 14, 2009 1:58 pm    Post subject: What could be file status check if i read the file reversed?
Reply with quote

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
View user's profile Send private message

Pravesh

New User


Joined: 30 Jul 2009
Posts: 32
Location: Gurgaon

PostPosted: Mon Dec 14, 2009 3:14 pm    Post subject:
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Dec 14, 2009 4:33 pm    Post subject:
Reply with quote

HTF are you going to read a tape file in reverse?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7904
Location: Bellevue, IA

PostPosted: Mon Dec 14, 2009 6:04 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Ronald Burr

Active User


Joined: 22 Oct 2009
Posts: 293
Location: U.S.A.

PostPosted: Mon Dec 14, 2009 6:21 pm    Post subject:
Reply with quote

"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
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Dec 14, 2009 8:34 pm    Post subject:
Reply with quote

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. . . icon_wink.gif
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2422
Location: Netherlands, Amstelveen

PostPosted: Mon Dec 14, 2009 10:46 pm    Post subject:
Reply with quote

And how about VB datasets?
Back to top
View user's profile Send private message
Ronald Burr

Active User


Joined: 22 Oct 2009
Posts: 293
Location: U.S.A.

PostPosted: Mon Dec 14, 2009 10:57 pm    Post subject:
Reply with quote

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
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2422
Location: Netherlands, Amstelveen

PostPosted: Mon Dec 14, 2009 11:15 pm    Post subject:
Reply with quote

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
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Mon Dec 14, 2009 11:23 pm    Post subject: Reply to: What could be file status check if i read the file
Reply with quote

It's hard to believe that there are still Data Centers out there with drives that support reel tape. icon_biggrin.gif
Back to top
View user's profile Send private message
pkmurali
Warnings : 1

Active User


Joined: 15 Dec 2005
Posts: 236

PostPosted: Sun Dec 20, 2009 1:03 pm    Post subject:
Reply with quote

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
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Mon Dec 21, 2009 5:35 am    Post subject:
Reply with quote

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
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1238
Location: Richfield, MN, USA

PostPosted: Mon Dec 21, 2009 10:28 pm    Post subject:
Reply with quote

Interesting. In my 40 years in IT, I've never had to read a data set in reverse sequence.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Dec 21, 2009 11:43 pm    Post subject:
Reply with quote

Terry,

maybe you did not take the appropriate classes resulting in such homework.
Back to top
View user's profile Send private message
Ronald Burr

Active User


Joined: 22 Oct 2009
Posts: 293
Location: U.S.A.

PostPosted: Mon Dec 21, 2009 11:57 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1238
Location: Richfield, MN, USA

PostPosted: Tue Dec 22, 2009 3:39 am    Post subject:
Reply with quote

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
View user's profile Send private message
CaptBill

New User


Joined: 28 May 2009
Posts: 15
Location: Oklahoma City, OK USA

PostPosted: Sat Jan 02, 2010 5:38 pm    Post subject:
Reply with quote

The only time I have seen REVERSE used was in a SORT using TAPE as the intermediate media.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us