Subject: | |
From: | |
Reply To: | |
Date: | Thu, 21 May 1998 13:30:17 -0500 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
At 12:15 PM 5/21/98 +0000, you wrote:
>What's the most common method being used, to get the MPE file number, of
>a file opened using the COBOL OPEN verb.
>
I don't know about "most common", but one which is portabe across any MPE
compliant compiler is this:
WORKING-STORAGE SECTION.
01 FILE-NUM pic x(8).
01 FILE-NUM-BIN PIC S9(4) COMP.
PROCEDURE
.
. MOVE SPACE TO FILE-NUM.
. CALL INTRINSIC "ASCII" USING
<file name>
10
FILE-NUM
GIVING TALLY.
CALL INTRINSIC "BINARY" USING
FILE-NUM
TALLY
GIVING FILE-NUM-BIN.
The ASCII intrinsic expects a PassedByValue integer, which is what the
file handle is. It produces a space terminated string, and the number of
characters in that string, which is exactly what the Binary intrinsic
expects. I claim no originality for this technique, but it allows me to put
together trainig programs without needing a library of "useful routines". (I
actually use a "useful routine" in production code!)
Tony
|
|
|