HP3000-L Archives

April 2006, Week 2

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
"Walter J. Murray" <[log in to unmask]>
Reply To:
Walter J. Murray
Date:
Wed, 12 Apr 2006 20:45:36 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (108 lines)
Tracy writes:

> But while we're there, CKERROR does a LOT more efficient job of
> translating the right byte of STATUS than does
> the entirely too cryptic for my taste FUNCTION ORD (STAT (2:1)) - 1  

Cryptic is in the eye of the beholder, so I won't debate that.

I will say that anyone familiar with standard COBOL should know what
FUNCTION ORD does, whereas only a programmer experienced with HP COBOL
is likely to have ever seen CKERROR.

And I'm hard pressed to know in what sense the call to CKERROR can be
considered more efficient.  It uses far more machine cycles.

> why not just do 
> 01  STAT VALUE "9}".   
>     05  ERRNO PIC S99 COMP.

> MOVE LOW-VALUES TO STATUS ( 1 : 1 )
> DISPLAY ERRNO

[assuming he means STAT, not STATUS, in the MOVE statement]

Why not?  Mainly because it doesn't work.  It displays only the
rightmost two digits of the decimal representation of the error code.

Walter  

Walter J. Murray


Tracy Pierce 

> -----Original Message-----
> From: HP-3000 Systems Discussion 
> [mailto:[log in to unmask]] On Behalf Of Walter J. Murray
> Sent: Tuesday, April 11, 2006 9:15 PM
> To: [log in to unmask]
> Subject: Using CKERROR to decode COBOL file status
> 
> Tracy Pierce wrote:
> 
> >yep, as long as CKERROR is properly documented (that's from Cobol68, 
> > right?), ksam-status "9{" really does equate to mpe error 
> 123 - notice
> 
> > that { is ascii(123).  
> 
> CKERROR was one of the "intrinsics" released with CM KSAM 
> back before HP
> implemented COBOL 74 and the "Indexed I-O" module.  The "CK" family of
> procedures have been retained for compatibility, but their use is
> discouraged now that HP COBOL has the ability to access KSAM files
> directly.
> 
> Yes, CKERROR can be used to decode the two-byte COBOL file status code
> of the form 9x, but why call an obsolete, nonstandard, HP-specific
> procedure to do something that can now be done easily in 
> standard COBOL?
> 
> Here's a sample program that shows the CKERROR method, compared to the
> standard method that I like to use.  Both give the same results.
> 
> -----cut here-----
> $CONTROL POST85
> $CONTROL STDWARN
>  IDENTIFICATION DIVISION.
>  PROGRAM-ID. DECODE-ERROR.
>  DATA DIVISION.
>  WORKING-STORAGE SECTION.
>  01  STAT                    PIC XX          VALUE "9{".
>  01  ERRNUM                  PIC 9(4).
>  PROCEDURE DIVISION.
>  1000-START.
> *
> *    Decode error, nonstandard method.
>      CALL "CKERROR" USING STAT ERRNUM
>      DISPLAY "ERROR NUMBER " ERRNUM
> *
> *    Decode error using standard COBOL.
>      COMPUTE ERRNUM = FUNCTION ORD (STAT (2:1)) - 1
>      DISPLAY "ERROR NUMBER " ERRNUM
> *
>      STOP RUN.
>  END PROGRAM DECODE-ERROR.
> -----cut here-----
> 
> Note the use of reference modification to access the second 
> byte of the
> file status, since I didn't define it as a group item in
> working-storage, and then the use of the ORD function to convert the
> byte to its numeric value.
> 
> Walter  
> 
> Walter J. Murray
> 
> * To join/leave the list, search archives, change list settings, *
> * etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
> 

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2