From: Richard on
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).

From: Pete Dashwood on
Richard wrote:
> On Feb 17, 6:59 pm, "James J. Gavan" <jgavandeletet...(a)shaw.ca> wrote:
>>
>> 01 ErrorCode pic x(4) comp-5 *> or pic 9(03).
>> 88 NoErrors value 0.
>> 88 NameMissing value 1.
>> 88 AddressMissing value 2.
>> 88 ...
>> 88 LastCurrently value 35.
>> 88 ValidErrorCode value 0 thru 35. *> or 1 thru 35, depending upon
>> *> your coding style
>
> 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.

This is why I define the base as "filler"... It reminds me NOT to search for
it. Instead I would search for where a condition gets SET...

The point is that the 88 is not about the storage it is attached to; it is
about a condition being true.

Pete.
<snip>
--
"I used to write COBOL...now I can do anything."


From: James J. Gavan on
Richard wrote:
> On Feb 17, 6:59 pm, "James J. Gavan" <jgavandeletet...(a)shaw.ca> wrote:
>
>>01 ErrorCode pic x(4) comp-5 *> or pic 9(03).
>> 88 NoErrors value 0.
>> 88 NameMissing value 1.
>> 88 AddressMissing value 2.
>> 88 ...
>> 88 LastCurrently value 35.
>> 88 ValidErrorCode value 0 thru 35. *> or 1 thru 35, depending upon
>> *> your coding style
>
>
> 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.

I'm aware that there is a 'school' of thought that doesn't like 88s. The
only assumption I can make from your approach is that you produce, for
the end user, an Error Code list indicating where it has gone wrong -
more expansive than something which appears in a Messagebox ?

If I was trying to check some six months after going live say, I would
search on the specific line that had :-

set NameMissing to true
>
>>78 NM value 35. *> NM = Number of Messages
>>78 ML value 30. *> ML = Message Length
>>01 MessageTable.
>> 05 pic x(ML) value "Customer name is missing".
>> 05 pic x(ML) value "Address missing for Customer".
>> 05.......
>> 05 .......
>>
>>01 Filler redefines MessageTable.
>> 05 ErrorMessage pic x(ML) occurs NM.
>
> You can be _much_ cleverer that that:
>
> 78 ML VALUE 30.
> 01 MessageTable.
> 05 pic x(ML) value "Customer name is missing".
> 05 pic x(ML) value "Address missing for Customer".
> 05.......
> 05 .......
> 01 MX REDEFINES MessageTable PIC X.
> 78 MN VALUE LENGTH OF MessageTable / ML.
> 01 Filler redefines MessageTable.
> 05 ErrorMessage pic x(ML) occurs NM.
>
> The MX redefine is required to complete the MessageTable definition so
> that its length can be used.
>
> However I don't use 78s, not even for this.
>
Firstly, I don't want to be 'clever' - nor am I clever; I thought I had
done pretty good switching to the '01 Filler redefines MessageTable',
within the last month - which I found googling on dates :-).

In fact I used to code :-

01 MessageTable.
05 pic x(ML) value "Customer name is missing".
05 pic x(ML) value "Address missing for Customer".
05.......
05 .......

01 MessageTable2 redefines MessageTable.
05 ErrorMessage pic x(ML) occurs NM.

That contains an unnecessary reference in my code to MessageTable.

Still, each to his own :-)

Jimmy, Calgary, AB
From: Richard on
On Feb 18, 11:34 am, "James J. Gavan" <jgavandeletet...(a)shaw.ca>
wrote:
> Richard wrote:
> > On Feb 17, 6:59 pm, "James J. Gavan" <jgavandeletet...(a)shaw.ca> wrote:
>
> >>01 ErrorCode        pic x(4) comp-5 *> or pic 9(03).
> >>  88 NoErrors        value 0.
> >>  88 NameMissing     value 1.
> >>  88 AddressMissing  value 2.
> >>  88 ...
> >>  88 LastCurrently   value 35.
> >>  88 ValidErrorCode  value 0 thru 35.   *> or 1 thru 35, depending upon
> >>                                        *> your coding style
>
> > 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.
>
> I'm aware that there is a 'school' of thought that doesn't like 88s. The
> only assumption I can make from your approach is that you produce, for
> the end user, an Error Code list indicating where it has gone wrong -
> more expansive than something which appears in a Messagebox ?

I am not sure why you would make any assumptions at all.

I certainly do not a messagebox dialog for trivial problems such as
'Name Missing' - that is really annoying when you have to grope for
the mouse, click the 'OK' button then focus back to the field. Usually
the error message appears alongside the field with the focus back in
the input ready to keep typing.

> If I was trying to check some six months after going live say, I would
> search on the specific line that had :-
>
>         set NameMissing to true

Given that you have a series of 88s that can be set into a single
field then only one error condition can be activated at one time. This
is OK if you do a 'bottom up' scan looking for errors so that it
finishes with the topmost error rather than the last.

In particular with dialogs and JavaScript web pages I deal with each
field individually so if a field has an error I deal with that, put
the message out and refocus.

If I did want to record a series of errors, such as would be done
offline or in the CGI script (yes, even in COBOL) I would put them in
a list (array) rather than a single value field.

From: Clark F Morris on
On Thu, 18 Feb 2010 11:29:14 +1300, "Pete Dashwood"
<dashwood(a)removethis.enternet.co.nz> wrote:

>Richard wrote:
>> On Feb 17, 6:59 pm, "James J. Gavan" <jgavandeletet...(a)shaw.ca> wrote:
>>>
>>> 01 ErrorCode pic x(4) comp-5 *> or pic 9(03).
>>> 88 NoErrors value 0.
>>> 88 NameMissing value 1.
>>> 88 AddressMissing value 2.
>>> 88 ...
>>> 88 LastCurrently value 35.
>>> 88 ValidErrorCode value 0 thru 35. *> or 1 thru 35, depending upon
>>> *> your coding style
>>
>> 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.
>
>This is why I define the base as "filler"... It reminds me NOT to search for
>it. Instead I would search for where a condition gets SET...
>
>The point is that the 88 is not about the storage it is attached to; it is
>about a condition being true.

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.
>
>Pete.
><snip>
First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5 6 7
Prev: all
Next: Open Cobol is free and standard.