Prev: all
Next: Open Cobol is free and standard.
From: Howard Brazee on 18 Feb 2010 07:53 On Wed, 17 Feb 2010 11:01:11 -0800 (PST), Richard <riplin(a)Azonic.co.nz> wrote: >I dislike 88 levels. The problem that I find is that if I wanted to >find all references to where 'ErrorCode' is used I have to search for >all the various names using it. Don't forget the copy members. I use 88 levels for Status code checking, but that doesn't fall in your example. 88 levels are also useful for complex, repeated conditions. -- "In no part of the constitution is more wisdom to be found, than in the clause which confides the question of war or peace to the legislature, and not to the executive department." - James Madison
From: Richard on 18 Feb 2010 15:22 On Feb 18, 7:42 pm, "James J. Gavan" <jgavandeletet...(a)shaw.ca> wrote: > Richard wrote: > > On Feb 18, 3:47 pm, "James J. Gavan" <jgavandeletet...(a)shaw.ca> wrote: > > >>Richard wrote: > > >>>On Feb 17, 6:59 pm, "James J. Gavan" <jgavandeletet...(a)shaw.ca> wrote: > > >>>>Any particular reason you picked on Record Locked = 51, or was that just > >>>>a random example ? My (2a) above contains three references to Record > >>>>Locking :- > > >>>OpenCOBOL file status value for record locked is '51'. > > >>>> 05 pic x(L2) value "38Open on file previously LOCKED ". > > >>>That refers to trying to reopen a file in a run unit when previously > >>>it had been "CLOSE file WITH LOCK". > > >>>> 05 pic x(L3) value "065File locked ". > > >>>Another program has the file open in exclusive mode. Or in DOS/Windows > >>>something else has opened the file. One of the many things that I > >>>disliked about DOS and Windows and find nice in Unix/Linux is that the > >>>latter don't prevent me from accessing a file that is open and > >>>running. I can watch files as they are being created by other > >>>programs, for example using tail or more. Under Windows if I am > >>>examining a file the COBOL program will give this error when it tries > >>>to open it. > > >>>> 05 pic x(L3) value "068Record locked ". > > >>>>The first is Standard ANSI codes and the other two are M/F's use of the > >>>>authorized Vendor's extension where file-status-1 = "9". > > >>>And Fujitsu has 93 for file locked and 99 for record locked. > > >>>>All I've got in (2a) above is a 'whisper' searching the source on > >>>>"Extend" :- > > >>>> 05 pic x(L2) value "35Open IO/INPUT/EXTEND non-optional". > > >>>You get a 35 error status when a file does not exist and is not > >>>specified OPTIONAL explicitly or implicitly (a MF compiler option). If > >>>is is OPTIONAL you get a 05 and it is created (IO and EXTEND) or acts > >>>as if there was a zero length file (INPUT). > > >>Given the sequence of events, now it makes sense. I paraphrased the > >>Error 05, (from the M/F manuals), to read :- > > >> 05 pic x(L2) value "05Optional file not present ". > > >>However, each time you broached this subject I always used to think, > >>under what circumstances would you want to EXTEND a Sequential File to > >>add additional records. Given that PC systems tend to be inter-active, > >>per transaction, i.e. fill in a dialog and then WRITE or REWRITE, > >>(obviously to an ISAM), I've never done it, and have never thought of it > >>as a possibility. Are you in effect working in a semi batch-processing > >>mode, (perhaps in Linus/Unix, which you mentioned). > > >>So some sort of example where you use it ? > > > A Log file, an Audit file, any number of files that don't need to be > > keyed and yet have a sequence, usually time. > > > These may be LINE SEQUENTIAL, especially the system log file recording > > system login/logouts, file exceptions, backups, file edits, all sorts > > of stuff. > > > Then when the user claims 'I just did xx' I can look at the log and > > say: "but at time hh:mm you did this". > > OK Richard fair enough, and can see purpose. But I would have probably > thought of using a RELATIVE file, (the next Relative record would be by > ws-RelativeKey giving your time-sequence, except of course you can > independently of COBOL open a text file and search. Sure clarifies why > and how you are doing it this way. No quibble at all. In a multiuser system writing a single log, audit, or tracking file there is still a contention issue. You can't write using 'ws- RelativeKey' you need to have a shared resource that holds the next record number and each program must lock this while it updates it so that two programs do not write the same record. It is easier to loop waiting for the exclusive file to open then as many lines can be written and the file closed. Windows programmers may find a shared file kept open to be preferable because of poor open/close performance on those systems. I prefer to open/write/close because it ensures that the data is transferred to the disk instead of waiting in some buffer. Anyway using a LINE SEQUENTIAL for a log file allows variable line length so that I can write out sql selects to the log for debugging purposes if necessary. Plus normal text utilities and editors can be used on the log. In a mixed language environment (I use a lot of Python, a small amount of C) this can also write to the same log. > Your solution sure is a belt and braces approach. Methinks you've got > either some very aggressive clients or some real dumb ones. My German > 'friend' for whom I did the Corrosion Testing system, nice man, but oh > what a bloody PERFECTIONIST : Systems can be used by many people in my clients. Some users may be aggressive, some certainly are dumb. Many are inadequately trained. eg the warehouse system is used by warehousemen, sometime these are temporary staff, not always deliberately so. The systems have password access, security levels, program passwords, user/function permission tables, and even field level security for update and even for viewing data. But in the end the employees have to do their job and that means using the computer system. When a user does something wrong the log tells what has been done and makes it easier to fix. > EXAMPLE 1 - > > Back in DOS days when we used a screen painter with RM/COBOL the Master > Menu was no more than one screen filled with numbered menu options; in > the Edit group - > > (1) Customer Names > (2) Facility Names > (3) Systems > (4) Vessels > (5) Items etc.... > > Working from home I had occasion to go over to his office, no doubt with > some new changes, and accessed his computers. Immediately taken aback, > couldn't find 'Systems'. Using the screen painter he had gone in and > changed it to 'Services' - same difference. > > EXAMPLE 2 - > > I think this one has to be the real cat's Meow. Over my shoulder he is > looking at some new screen, peering and pointing at it; the comment was > "Can you move that down about half an inch ?". > > Gimme a break ! But for the fact I desperately needed the money I would > have told him to, "Stick your job where the sun don't shine !" > > That pimp/head-hunter for California - I tell yer $33 per hour is better > than $zero per hour :-). BTW should he read this, no point in contacting > me I haven't got a passport to get across the 49th. > > Jimmy, Calgary AB
From: Anonymous on 19 Feb 2010 19:08 In article <oX2fn.215$mn6.29(a)newsfe07.iad>, James J. Gavan <jgavandeletethis(a)shaw.ca> wrote: >Clark F Morris wrote: [snip] >> While I have used 88 levels in that manner, there is a lot to be said >> for the approach taken by one vendor where they had a list of >> constants - 05 RECORD-NOT-FOUND PIC XX VALUE '23'. (I may be >> recalling the value incorrectly and the vendor had similar fields for >> all of the status code values correctly coded). Then the test was IF >> FILE-A-STATUS-CODE = RECORD-NOT-FOUND etc.. This is both readable and >> easy to check for where FILE-A-STATUS-CODE is referenced. >> >That looks like a good approach to me Clark, just so long as it is >provided by the vendor. > >Haven't thought it through; the above s fine to get the >RECORD-NOT-FOUND, but what about RECORD-FOUND ? Depends on your file-structure and how many bowings and scrapings were done on the altar of All Ya Gotta Do got done o'er the preceding decades. Imagine - I know it may be difficult! - a company which added secondary keys in descending timestamp sequence for date/time of last order. (ain't nobody never seen nothing like that no time, right?) DD
From: Alistair on 20 Feb 2010 06:44 On Feb 20, 12:08 am, docdw...(a)panix.com () wrote: > In article <oX2fn.215$mn6...(a)newsfe07.iad>, > James J. Gavan <jgavandeletet...(a)shaw.ca> wrote: > > >Clark F Morris wrote: > > [snip] > > >> While I have used 88 levels in that manner, there is a lot to be said > >> for the approach taken by one vendor where they had a list of > >> constants - 05 RECORD-NOT-FOUND PIC XX VALUE '23'. (I may be > >> recalling the value incorrectly and the vendor had similar fields for > >> all of the status code values correctly coded). Then the test was IF > >> FILE-A-STATUS-CODE = RECORD-NOT-FOUND etc.. This is both readable and > >> easy to check for where FILE-A-STATUS-CODE is referenced. > > >That looks like a good approach to me Clark, just so long as it is > >provided by the vendor. > > >Haven't thought it through; the above s fine to get the > >RECORD-NOT-FOUND, but what about RECORD-FOUND ? > > Depends on your file-structure and how many bowings and scrapings were > done on the altar of All Ya Gotta Do got done o'er the preceding decades. > Imagine - I know it may be difficult! - a company which added secondary > keys in descending timestamp sequence for date/time of last order. > > (ain't nobody never seen nothing like that no time, right?) > > DD I've seen the six digit date (YYMMDD) subtracted from one million and used as a key.
From: James J. Gavan on 20 Feb 2010 12:37
Alistair wrote: > On Feb 20, 12:08 am, docdw...(a)panix.com () wrote: > >>In article <oX2fn.215$mn6...(a)newsfe07.iad>, >>James J. Gavan <jgavandeletet...(a)shaw.ca> wrote: >> >> >>>Clark F Morris wrote: >> >>[snip] >> >> >>>>While I have used 88 levels in that manner, there is a lot to be said >>>>for the approach taken by one vendor where they had a list of >>>>constants - 05 RECORD-NOT-FOUND PIC XX VALUE '23'. (I may be >>>>recalling the value incorrectly and the vendor had similar fields for >>>>all of the status code values correctly coded). Then the test was IF >>>>FILE-A-STATUS-CODE = RECORD-NOT-FOUND etc.. This is both readable and >>>>easy to check for where FILE-A-STATUS-CODE is referenced. >> >>>That looks like a good approach to me Clark, just so long as it is >>>provided by the vendor. >> >>>Haven't thought it through; the above s fine to get the >>>RECORD-NOT-FOUND, but what about RECORD-FOUND ? >> >>Depends on your file-structure and how many bowings and scrapings were >>done on the altar of All Ya Gotta Do got done o'er the preceding decades. >>Imagine - I know it may be difficult! - a company which added secondary >>keys in descending timestamp sequence for date/time of last order. >> >>(ain't nobody never seen nothing like that no time, right?) >> >>DD > > > I've seen the six digit date (YYMMDD) subtracted from one million and > used as a key. What sort of ansi-smansy technique is that ? Certainly with results from the Corrosion Testing system I did, way back........ using old RM/COBOL; I put results into a set of keys held in a 'Results File'. I can't remember specifics but had something like six ways of producing reports - using a similar technique, I could make the keys ascending or descending as required. Now the date one above is daft. And being a COBOL system we are talking fairly current dates, i.e., for the year 2010 we are in the range 2009 to 2011 as an example. I don't think too many COBOL programmers are interested in the date for Trafalgar or the Battle of Waterloo; well not to show bias - or the date for the Boston Tea Party. It's easily achievable in COBOL date functions to go from what I term ISO-Format6 (yymmdd) to ISO-Format8 (CCyymmdd); same with the (North American) NA-Format6 or EU-Format6 and get back an ISO-Format8 giving you a true ccyymmdd key. That date technique above. I've seen the same approach with some 4 M/F users querying, 'why doesn't this work' when they dream up a routine for getting the M/F usage of file-status-1 = "9"; they get some weird and wonderful three-digit error numbers. One kid, (presumably), drove me nuts, saying he was using a routine dreamed up where he worked and they had used it for years. I can only assume they never got any file errors that hit the '9' condition. In exasperation I wrote to him, "Don't believe a word of what I'm saying. Take the M/F piece of code I've pointed you at and try it. See how it compares with what you are trying to use!". I'm fairly certain with reference to file-status codes, that particular piece of code pops up in their on-line manuals. Jimmy, Calgary AB PS: Knew you would. Thanks for contacting the guy on N/E 5.1. |