Peter Smithson asked about calling HPEXTIN, in the context of needing to
call the PAUSE intrinsic from COBOL. Following is some code that might be
useful.
When I was in the Response Center, we were frequently asked how to call
PAUSE from COBOL, and I didn't like any of the sample code fragments we had
in our files. I wrote an Engineering Note that I hoped would be the
definitive solution to the problem.
This should be Engineering Note A3043325, but I don't know whether those old
ENs are still available at the ITRC.
Walter
PROBLEM TEXT
I need to call the PAUSE intrinsic from COBOL. I would like sample code
that would work on both MPE V and MPE/iX.
DETAIL TEXT
HP 3000
MPE V (all versions)
MPE/iX (all versions)
COBOL II/V (all versions)
COBOL II/iX (all versions)
RESOLUTION TEXT
The following sample code will work on both MPE V and MPE/iX, in both
Compatibility Mode and Native Mode.
Because COBOL II does not support real numbers, the key is to call
HPEXTIN to convert from "external" (COBOL DISPLAY) format to "internal"
(floating-point) format. In this sample, the .LOC. pseudo-intrinsic is
used to capture the length of the field to be converted; moving 6 to
STRINGLEN would have worked as well.
Following is the COBOL subprogram.
$CONTROL DYNAMIC
IDENTIFICATION DIVISION.
PROGRAM-ID. EZPAUSE.
*
* This is a "universal" subroutine for calling the PAUSE
* intrinsic from COBOL. This source file can be compiled
* in any of the following environments.
*
* * ANSI74 or ANSI85.
* * COBOL II on MPE V systems.
* * Compatibility mode COBOL II on MPE/iX systems.
* * Native mode COBOL II/iX on MPE/iX systems.
*
* The subroutine can reside in a USL, an RL, an SL,
* an NMOBJ file, or an XL. Or use this as sample code
* showing how to call PAUSE directly from your program.
*
DATA DIVISION.
WORKING-STORAGE SECTION.
77 STRINGLEN PIC S9(4) COMP.
77 REAL-NUMBER PIC S9(9) COMP.
77 ERR-OR PIC S9(4) COMP.
LINKAGE SECTION.
77 PAUSE-SECONDS PIC 9(6).
PROCEDURE DIVISION USING PAUSE-SECONDS.
BEGIN.
CALL INTRINSIC ".LEN." USING PAUSE-SECONDS GIVING STRINGLEN.
CALL "HPEXTIN" USING
@PAUSE-SECONDS, STRINGLEN,
\0\, \1\, \0\, \0\,
REAL-NUMBER, ERR-OR.
CALL INTRINSIC "PAUSE" USING REAL-NUMBER.
EXIT PROGRAM.
Following is a test program that calls the subprogram shown above.
IDENTIFICATION DIVISION.
PROGRAM-ID. MURRAY.
*
* This test program calls "EZPAUSE" twice, first to
* pause for 8 seconds, then for 3 seconds.
*
DATA DIVISION.
WORKING-STORAGE SECTION.
77 PAUSE-SECONDS PIC 9(6).
PROCEDURE DIVISION.
BEGIN.
DISPLAY "BEGIN".
MOVE 8 TO PAUSE-SECONDS. CALL "EZPAUSE" USING PAUSE-SECONDS.
DISPLAY "THREE MORE SECONDS".
MOVE 3 TO PAUSE-SECONDS. CALL "EZPAUSE" USING PAUSE-SECONDS.
DISPLAY "END".
STOP RUN.
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|