FILEATTR Subroutine

FILEATTR is a subroutine, actually three subroutines linked into a single load module, that may be called from a COBOL main program to return dataset attributes for a supplied dataset name.  The dataset may be catalogued or the Volume Serial number may be supplied to return attributes for an uncatalogued dataset.

It is located in File #270 of the CBT tape and is part of a collection submitted by the Washington Department of Information Services.  

Installation

There are no changes required to assemble this command under MVS 3.8j as it exists on the CBT tape.  The single jobstream - fileattr.jcl - that assembles both the main routine and assembles and compiles the secondary routines is contained in the archive fileattr.tar.gz [MD5: 4675cc749820940a1491fcdd3c267328].  Download the archive and extract the jobstream (WinZip on Windows/?? or tar on Linux).  Submit the jobstream to assemble and link the single load module into SYS2.LINKLIB.  If you don't have SYS2.LINKLIB defined, you will need to modify the jobstream to specify a different target load library.  

 

Utilizing FILEATTR

The following data areas are REQUIRED in WORKING STORAGE:

       01   IN-DSN                   PIC X(44).
       01   OUT-VALID-SWITCH         PIC X(3).
       01   OUT-ERROR-MSG            PIC X(30).
       01   UT-VOLSER                PIC X(6).
       01   OUT-LRECL                PIC 9(5).
       01   OUT-BLKSIZE              PIC 9(5).
       01   OUT-DSORG                PIC X(2).
       01   OUT-REC-FORMAT           PIC X.
       01   OUT-DEVICE               PIC X.

The following data area is OPTIONAL.  It  is to be used  if your
dataset is not cataloged:

       01   IN-VOLSER                PIC X(6).

In the PROCEDURE DIVISION:

     If your dataset IS cataloged:

         MOVE your dataset name to IN-DSN.

         CALL 'FILEATTR' USING IN-DSN
                               OUT-VALID-SWITCH
                               OUT-ERROR-MSG
                               OUT-VOLSER
                               OUT-LRECL
                               OUT-BLKSIZE
                               OUT-DSORG
                               OUT-REC-FORMAT
                               OUT-DEVICE.

     If your dataset is NOT cataloged:

         MOVE your dataset name to IN-DSN.
         MOVE your volume serial number to IN-VOLSER.                             

         CALL 'FILEATTR' USING IN-DSN
                               OUT-VALID-SWITCH                                   
                               OUT-ERROR-MSG
                               OUT-VOLSER
                               OUT-LRECL
                               OUT-BLKSIZE
                               OUT-DSORG
                               OUT-REC-FORMAT
                               OUT-DEVICE
                               IN-VOLSER.

After the call, interrogate OUT-VALID-SWITCH.

If OUT-VALID-SWITCH  is not  equal to  'YES', then  OUT-ERROR-MSG
contains  the  reason  for  the  error  (such  as  data  set  not
cataloged)  and the  other parameters  are  not generated  except
possibly OUT-DEVICE.

If  OUT-VALID-SWITCH  is  equal  to  'YES',  then  the  following
parameters are generated with the contents as shown:

          PARAMETER                   CONTENTS
       ----------------    ------------------------------
       OUT-VALID-SWITCH    'YES'
       OUT-ERROR-MSG       Spaces
       OUT-VOLSER          Volume Serial Number
       OUT-LRECL           LRECL
       OUT-BLKSIZE         BLKSIZE
       OUT-DSORG           DSORG
       OUT-RECFM           'F' for fixed length records
                           'U' for undefined records
                           'V' for variable length records
       OUT-DEVICE          'T' data set is on tape
                           'D' data set is on disk

NOTE:  If you wish to make all calls to FILEATTR with the same
       number of parameters, and your dataset is cataloged, then
       move 'ABSENT' to IN-VOLSER.

There  are  17 possible  error  messages  that this  program  can
produce which is stored in OUT-ERROR-MSG.  They are:

       'DATASET NOT CATALOGED'
       'FILE IS ON MORE THAN 1 VOLUME'
       'REQUIRED VOLUME NOT MOUNTED'
       'FORMAT-1 DSCB NOT FOUND ON VOL'
       'OBTAIN MACRO RETURNED RC 12/16'
       'INVALID SYNTAX FOR DSNAME'
       'PROBLEM IN BAL PGM FILEATTR'
       'MEMBER NAME NOT FOUND'
       'UNSUCCESSFUL DYNAMIC ALLOCATION'
       'I/O ERROR READING DIRECTORY'
       'UNSUCCESSFUL FREE OF DDNAME'
       'MEMBER NAME TOO LONG'
       'INVALID MEMBER NAME'
       'DATASET IS ON TAPE'
       'INVALID VOL SER GIVEN'
       'DATASET NOT PARTITIONED'
       'DATASET IS NOT A GDG'

I hope that you have found my instructions useful.  If you have questions that I can answer to help expand upon my explanations and examples shown here, please don't hesitate to send them to me:


Return to Site Home Page 


This page was last updated on January 17, 2015 .