Ken Vickers reminded me of the FLABELINFO intrinsic (actually
he informed me of it, since you can't be reminded of what you
didn't know!). Anyway, I tried this intrinsic, but it doesn't
work when used for files that are in the process of being
created. That is, it works fine against permanent disk files
(and by extension, I assume it works for temp files as well),
but absolutely will not work (well, I can't find a way to
make it work) when using a file that is being created as the
program runs. The COBOL source I used to test this follows.
When I first tried it without an OPEN statement, I received
FSERROR 54 (Invalid File Reference). Adding an OPEN of the
file did not change that. When I changed the FORMALDESIG to
be and existing file, it worked fine. When I changed the
FORMALDESIG to be OUTPUT.JKP.CUSTOM, it failed with FSERROR
52 (Nonexistent Permanent File). Adding an "*" to the
FORMALDESIG to force it to backreference the file equation
didn't help either.
I guess there's nothing for it, but to use a LISTEQ command
and parse the output of it. FWIW, I agree that it would be
nice to have an intrinsic to provide this information.
Jim Phillips Manager of Information Systems
E-Mail: [log in to unmask] Therm-O-Link, Inc.
Phone: (330) 527-2124 P. O. Box 285
Fax: (330) 527-2123 Garrettsville, Ohio 44231
001000$CONTROL USLINIT,SOURCE,NOLIST
001100 IDENTIFICATION DIVISION.
001200 PROGRAM-ID. JKP071.
001300 AUTHOR. JIM PHILLIPS.
001400 INSTALLATION. T-O-L.
001500
001600 REMARKS.
001700*
001800* This program tests the FLABELINFO intrinsic
001900*
002000 ENVIRONMENT DIVISION.
002100 CONFIGURATION SECTION.
002200 SOURCE-COMPUTER. HP3000 WITH DEBUGGING MODE.
002300 OBJECT-COMPUTER. VARIOUS-MODELS.
002400 SPECIAL-NAMES.
002500
002600 CONDITION-CODE IS C-C.
002700
002800 INPUT-OUTPUT SECTION.
002900 FILE-CONTROL.
003000
003100 SELECT OUTPUT-FILE ASSIGN TO "OUTPUT".
003200
003300 DATA DIVISION.
003400 FILE SECTION.
003500
003600 FD OUTPUT-FILE.
003700 01 OUTPUT-RECORD PIC X(132).
003800
003900 WORKING-STORAGE SECTION.
004000
004100 01 FLABELINFO-FORMALDESIG PIC X(26) VALUE
004110 "OUTPUT".
004200
004300 01 FLABELINFO-MODE PIC S9(4) COMP VALUE 0.
004400
004500 01 FLABELINFO-FSERRORCODE PIC S9(4) COMP VALUE 0.
004600
004700 01 FLABELINFO-ITEMNUM PIC S9(4) COMP VALUE +23.
004800
004900 01 FLABELINFO-ITEM PIC X(8) VALUE SPACES.
005000
005100 01 FLABELINFO-ITEMERROR PIC S9(4) COMP VALUE 0.
005200
005300 PROCEDURE DIVISION.
005400
005500 JKP071-MAIN-PROGRAM SECTION.
005600
005700 JKP071-MASTER-CONTROL.
005800 OPEN OUTPUT OUTPUT-FILE.
005900
006000 DISPLAY "CALLING FLABELINFO FOR FILE: ",
006100 FLABELINFO-FORMALDESIG.
006200
006300 CALL INTRINSIC "FLABELINFO" USING
006400 FLABELINFO-FORMALDESIG
006500 FLABELINFO-MODE
006600 FLABELINFO-FSERRORCODE
006700 FLABELINFO-ITEMNUM
006800 FLABELINFO-ITEM
006900 FLABELINFO-ITEMERROR.
007000
007100 DISPLAY "BACK FROM FLABELINFO".
007200 DISPLAY " FSERRORCODE = ", FLABELINFO-FSERRORCODE.
007300 DISPLAY " ITEMERROR = ", FLABELINFO-ITEMERROR.
007400 DISPLAY " DEVICE NAME = ", FLABELINFO-ITEM.
007500
007600 CLOSE OUTPUT-FILE.
007700
007800 STOP RUN.
|