HOME  NEWS  FORUM  DOWNLOAD  LINK
OpenCOBOL - an open-source COBOL compiler
Main Menu
Download
Documentation
Development
Who's Online
14 user(s) are online (8 user(s) are browsing Forum)

Members: 0
Guests: 14

more...
Powered by
SourceForge

Xoops

Creative Commons

OpenCOBOL Forum Index
   OpenCOBOL
     Read previous at end
Register To Post

Threaded | Newest First Previous Topic | Next Topic | Bottom
Poster Thread
mrcool
Posted on: 2012/6/12 21:09
Quite a regular
Joined: 2009/1/28
From:
Posts: 44
Read previous at end
Open Cobol returns a file status "10" end of file at the beginning of a file.

Read key-file
    previous record
    at end Move "11" to file-status
end-read. 


Notice the reset to "11" in the at end clause as shown.

The reason end and beginning should be different is that there is a common routine written that handles all file status codes. Using "10" for both means the screen message always says "end of file" when it could be end or beginning. The routine uses "11" as the beginning of file message to keep them different.

I'm not suggesting a change to Open Cobol at this time. Although if they did, that would be all right with me.

I'm posting this question mostly for Mr Klein (wmklein),

Are you on the ANSI/ISO Cobol committee?

Could there be a proposal to reserve file status "11" for beginning of file? (Or "12" or "13" or whatever they decide.)

I would like to have the committee decide on a code so that my routines will not be in conflict with other Cobol vendors.

For example, Ryan-McFarland Cobol (before they were called that) used "B3" for beginning file-status. I think they invented read previous with their call to "C$RDPRV". Other vendors may use something different.

Even if Read previous is not ISO yet, they could still reserve "11" for vendors that support it.

vbcoen
Posted on: 2012/6/13 12:31
Not too shy to talk
Joined: 2007/2/13
From: Essex, UK
Posts: 26
Re: Read previous at end
Small point, status 10 is actually 'There is no next logical record. You have reached the end od file.'

So, by reading reverse the last record (which is actually the first held in the file) IS the last record.

Does not a programmer that does a read reversed not expect such logic or am I just being a 65 year old (OK, not till the 23rd June anyway!!) M/F programmer again and having another brain fart.

As for a screen message that should be the responsibility of the programmer to create and word correctly.

Vincent
mrcool
Posted on: 2012/6/13 14:55
Quite a regular
Joined: 2009/1/28
From:
Posts: 44
Re: Read previous at end
You raise a good point. It's a logical end either way.

Having different file-status codes for end and begin is nice to have, not a requirement. As shown in the example, I handle it with my own Move "11" to file-status.

Even if ISO Cobol picks "10" for a beginning file-status, they should at least put it in the standard so that all vendors can follow it. Right now, I think that the standard does not say anything at all about what to do at the beginning of a file. The standard should pick something that all vendors can agree to.
vbcoen
Posted on: 2012/6/14 19:43
Not too shy to talk
Joined: 2007/2/13
From: Essex, UK
Posts: 26
Re: Read previous at end
Sorry,

but status 10 IS in the standard and has been since ANSI'74.

As far as I know all vendors use it, well the main one's anyway eg, MF, IBM heck even ICL did.

wmklein
Posted on: 2012/6/14 21:27
Home away from home
Joined: 2008/12/27
From:
Posts: 327
Re: Read previous at end
READ PREVIOUS (and other related features WERE new in the '02 Standard, but they are there now (and have been for a decade).

File Status "10" for "end of logical sequential processing" has been in the Standard since long before I knew COBOL.

You could ask for a different FS for reaching the beginning on backwards sequential processing, but I do not (personally) think there is any chance at all you would get it.

Does this answer everything addressed to me?
jgt
Posted on: 2012/6/16 0:39
Just can't stay away
Joined: 2010/1/18
From: 44.21.48N 80.50.15W
Posts: 76
Re: Read previous at end
Quote:
or am I just being a 65 year old

I think that makes you a junior member.
mrcool
Posted on: 2012/6/16 5:25
Quite a regular
Joined: 2009/1/28
From:
Posts: 44
Re: Read previous at end
Yes, thank you for your reply. And also, thank you for all the work you do for the Cobol community.

The "end of logical sequential processing" means a great deal to us developers. I get it. Hopefully all Cobol vendors interpret it the same way.

But that quote means nothing to an end user. It is jargon. It will confuse them.

The issue that I have is when some developer, such as myself, needs separate messages for beginning and ending of file. They have to use a separate code, in my case "11".

When a customer pushes the F-key for read previous, and gets the "Beginning of file: 11" message, they may look up "11" in their Cobol book. They will not find "11". Then they call customer support, asking "what's this?" Then we have to tell them that Cobol doesn't have a separate beginning of file code, so we made one up.

Not having a beginning of file status code adds an element of confusion that I would hope the ISO committee would at least consider.

To make Cobol friendlier to the end users there should be a code reserved for read previous.
dave4583
Posted on: 2012/6/16 11:01
Just popping in
Joined: 2009/2/22
From:
Posts: 4
Re: Read previous at end
Then why not just show them a "Beginning of file:" message, then they won't go looking for a 10 or 11 they will hopefully relaize they have reached the "beginning of the file".
mrcool
Posted on: 2012/6/18 14:12
Quite a regular
Joined: 2009/1/28
From:
Posts: 44
Re: Read previous at end
A good work around, thanks.

I hope the ISO Cobol committee realizes that, of the entire ISO Cobol specifications document, the only part that the end user sees is the table of file status codes.

The file status codes should be user friendly and complete.
vbcoen
Posted on: 2012/6/18 15:19
Not too shy to talk
Joined: 2007/2/13
From: Essex, UK
Posts: 26
Re: Read previous at end
I am a little lost here, 'The end user' only will see what messages etc, that the programmer has specified.

The programmer should be aware of how s/he's logic works and create suitable user messages accordingly.

The actual status code produced by the compiler is totally immaterial other than to the programmer assuming of course that it complies with the Cobol standards which OC does.


(1) 2 »
Threaded | Newest First Previous Topic | Next Topic | Top

Register To Post
 
Copyright (C) 2005 The OpenCOBOL Project. All rights reserved.
Powered by Xoops2 | PHP | MySQL | Apache
ocean-net