Subject: | |
From: | |
Reply To: | |
Date: | Wed, 26 Nov 1997 13:29:36 -0700 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
>-----Original Message-----
>From: Jon Diercks <[log in to unmask]>
>>
>>The COBOL program in question normally does essentially this (butchered for
>>brevity, don't try to compile this):
>>
>> move "00120" to secs
>> call intrinsic "HPEXTIN" using secs, ... realsecs
>> call intrinsic "PAUSE" using realsecs
>>
>>...but from debug we can see that in today's run the PAUSE intrinsic is
>>behaving as if it was passsed -1, meaning pause for eternity. Could this
>be
>>a bug in HPEXTIN? a bug in PAUSE? a hardware problem? (we have had
>>problems in the past with our Floating Point Coprocessor but it has since
>>been replaced).
On the subject of handling real numbers in COBOL...
I had occasion recently to convert an R4 from Image to human-readable
form in COBOL. Given that R4 has been around forever, and I believe
INEXT' just as long, I thought this a piece of cake.
HOWEVER, I completely forgot about the introduction of HPFPCONVERT,
which converts among real-number formats (HP 3000 and IEEE). (Note
that HPFPCONVERT is documented in the Intrinsics manual, as opposed
to INEXT'/HPINEXT, which are in the Compiler Library manual.)
Oddly, the Image manual--in listing the language-specific equivalents
for the Image data types--lists FORTRAN 77's "Real" type as being
compatible for both E2 *and* R2. Surely the language doesn't make
the conversions automatically!? Anyway...
I'm pretty sure that INEXT' used to convert from HP's real number
format (can anyone confirm/deny this?). In any case, now it converts
only from IEEE format!
So, for an R4 field, the proper procedure (near as I can tell) is
05 R4-FIELD PIC X(08).
05 E4-FIELD PIC X(08).
...
CALL INTRINSIC "HPFPCONVERT" USING R4-FIELD
E4-FIELD
...
CALL INTRINSIC "HPINEXT" USING E4-FIELD
...
Be aware that
(1) HPFPCONVERT may give a warning saying the conversion wasn't "precise"
(2) HPINEXT requires a 32-bit address to the first WORD of the field
to be converted. As this is not a BYTE address (which *is* needed by
CREATEPROCESS when redirecting $STDIN and $STDLIST), there is no need
for ".LOC."; just provide the field name.
Does anyone have a better way?
Sorry if this is old hat to everyone; it sure kicked my butt for awhile.
FWIW.
--Glenn Cole
Software al dente, Inc.
[log in to unmask]
|
|
|