PROCEDURE dum$display_file_tables, display_file_tables, disft (
  sfid: integer = $optional
  output, o: file = $output
  display_option, do: key
      (brief, b), (full, f)
    keyend = brief
  display_full_fat, dff: boolean = false
  help, h: file = $null
  status)


  "$FORMAT=OFF"
  VAR
    when_status: status
  VAREND
  "$FORMAT=ON"

  WHEN any_fault DO
    when_status = $previous_status
    putl ' Invoked DISFT condition handler due to the following abnormal status:'
    disv when_status
    putl ' Enter commands, "exit_proc" to abort, or "exit_proc with when_status" to abort with status'
    include_file command prompt='disft_ch'
  WHENEND

  IF $specified(help) THEN
COLLECT_TEXT o=help until='HELPEND'
DISPLAY_FILE_TABLES or DISFT

  This procedure displays device manager's knowledge of a file by calling
the following procedures, passing the proper parameters to eliminate manual
intervention:

   Procedure             Passed Parameter
1. display_sfid          sfid
2a.  display_dfd         pva_of_dfd
     {calls}
2b.  display_fat         sfid
3. display_all_fmds      pva_of_fmd

The display_option and output parameters will be retained for all proce-
dures. This procedure assumes the user has previously selected the correct
exchange package by available analyze_dump commands.  See warnings below
for additional information on usage.

PARAMETERS:

SFID: integer
  This parameter sets the SFID of the file to be displayed.  See below
for additional information.  This parameter is required.

DISPLAY_OPTIONS, DO: key full, f, brief, b
  This parameter selects the option of displaying the contents of memory
and the description of the selected fields (full), or the brief
mode of the descriptions only.  This parameter defaults to brief.

DISPLAY_FULL_FAT, DFF: boolean
  This parameter specifies whether or not the full contents of the File
Allocation Table (FAT) should be displayed.  This parameter defaults to
FALSE.

OUTPUT, O: file
  This parameter selects the file name to receive the data.  This para-
meter is defaulted to $output.  If a file name other than $output is
entered the data will be formated correctly for printer disposition and
will be sent to the file  "$asis".

STATUS

ADDITIONAL INFORMATION:
  The SFID contains the file's index, residence, and hash.  For example
sfid 000f014b(16) is index 000f, residence 01, hash 4b.  The residence of
01 identifies this file as residing in mainframe wired tables.  An
analyze_dump command of "CHAD e=m" will need to be entered to insure proper
execution.  If the file residence is 02, indicating the file resides in job
fixed tables, a "CHAD e=j" would need to be entered.  The "CHAPR e=(Exchange
Package RMA)" command can be used for other inactive jobs in the system.  Of
course there are many other possible combinations.

WARNINGS/KNOWN DEFICIENCIES:

ERROR HANDLER
  When any fatal error is encountered a condition handler is invoked and
the following messages will appear:
 "Invoked DISXXX condition handler due to the following abnormal status:"
 "< the error status message >"
 "Enter commands, "exit_proc" to abort, or "exit_proc with when_status"
  to abort with status"
To exit the handler enter:    "exit_proc"
To exit the handler with status, enter:   "exit_proc with when_status"
 NOTE: XXX is the name of the procedure at the time of the error.

HELPEND
    EXIT_PROC
  IFEND

  IF NOT $specified(sfid) THEN
    EXIT_PROC WITH $status(false, 'US', 5, 'Parameter SFID is required')
  IFEND

  "$FORMAT=OFF"
  VAR
    command_line: string
    fmd_p: integer
    media: string
    media_pointer: integer
    output_file: file
    previous_fmd_p: integer
    previous_media_pointer: integer
  VAREND
  "$FORMAT=ON"

  IF $file(output open_position) = '$BOI' THEN
    output_file = output.$asis
  ELSE
    output_file = output
  IFEND

  command_line = ' display_sfid sfid='//..
$strrep(sfid, 16)//'(16) output='//$strrep(output)//' display_option='//$strrep(display_option)//..
' display_depth=fde media=media media_pointer=media_pointer'
  include_line command_line

  IF previous_media_pointer = media_pointer THEN
    EXIT_PROC WITH $status(false, 'us', 1, 'Display_SFID FAILURE TO PASS MEDIA_POINTER PARAMETER')
  IFEND

  IF media = 'gfc$fm_mass_storage_file' THEN
    command_line = ' display_dfd pva='//$strrep(media_pointer, 16)//'(16) output='//..
$strrep(output)//' display_option='//$strrep(display_option)//' fmd_p=fmd_p'
    include_line command_line

    IF previous_fmd_p = fmd_p THEN
      EXIT_PROC WITH $status(false, 'us', 2, 'Display_Disk_File_Descriptor FAILURE TO PASS FMD_P PARAMETER')
    IFEND

    command_line = ' display_all_fmds pva='//..
$strrep(fmd_p, 16)//'(16) output='//$strrep(output)//' display_option='//$strrep(display_option)
    include_line command_line

    IF display_full_fat THEN
      command_line = 'display_fat sfid='//$strrep(sfid 16)//'(16) output='//$strrep(output)
      include_line command_line
    IFEND

  ELSEIF media = 'gfc$fm_served_file' THEN
    command_line = ' display_sfd pva='//..
$strrep(pass_parameter, 16)//'(16) output='//$strrep(output)//' display_option='//$strrep(display_option)
    include_line command_line
  IFEND

PROCEND dum$display_file_tables
