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:
Tue, 11 Apr 2006 21:14:47 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (56 lines)
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 *

ATOM RSS1 RSS2