HP3000-L Archives

May 1998, Week 3

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:
Tony Furnivall <[log in to unmask]>
Reply To:
Tony Furnivall <[log in to unmask]>
Date:
Thu, 21 May 1998 13:30:17 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (34 lines)
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

ATOM RSS1 RSS2