HPlogo Command Interpreter Access and Variables Programmer's Guide: Series HP 3000 Computer Systems > Chapter 7 Sample Command Files

To Retrieve File Information

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

The FILINFO command file displays file label information for a given file. This command file provides an extensive routine that analyzes the file name if the file is not found. A fully qualified file name is returned even if the parameter input was not qualified.

Figure 7-7 File Information Command File

PARM FILE

IF NOT (FINFO("!FILE","EXISTS")) THEN

  COMMENT ** FILE DOES NOT EXIST **

  IF LFT("!FILE",1) <> "*" AND LFT("!FILE",1) <> "$" THEN

    COMMENT **QUALIFY FILE BEFORE REPORTING NON-EXISTENCE**

    IF POS(".","!FILE") > 0 THEN

      COMMENT ** A GROUP NAME IS SPECIFIED **

      IF POS(".","!FILE",2) > 0 THEN

        COMMENT ** FILE NAME IS FULLY QUALIFIED **

        ECHO ![UPS("!FILE")] does not exist.

      ELSE

        ECHO ![UPS("!FILE")].!HPACCOUNT does not exist.

      ENDIF

    ELSE

      ECHO ![UPS("!FILE")].!HPGROUP.!HPACCOUNT &

           does not exist.

    ENDIF

  ELSE

    ECHO !FILE does not exist.

  ENDIF

  RETURN

ENDIF

COMMENT ** FORMAL FILE DESIGNATOR **

ECHO (FINFO): Full file description for &

              ![FINFO("!FILE",1)] follows:

COMMENT ** CREATOR AND CREATE/MODIFY DATES **

ECHO    Created by ![FINFO("!FILE",4)] on &

             ![FINFO("!FILE",6)].

ECHO    Modified on ![FINFO("!FILE",8)] at &

             ![FINFO("!FILE",24)].

COMMENT ** FILE CODE **

IF FINFO("!FILE",9) = "" THEN

  ECHO    FCODE: ![FINFO("!FILE",-9)].

ELSE

  ECHO    FCODE: ![FINFO("!FILE",9)] &

                 (![FINFO("!FILE",-9)]).

ENDIF

COMMENT ** RECORD SIZE, END OF FILE, FILE LIMIT **

ECHO   RECSIZE: ![FINFO("!FILE",14)], EOF: &

       ![FINFO("!FILE",19)], FLIMIT: ![FINFO("!FILE",12)].

COMMENT ** FILE OPTIONS **

SETVAR _FOPT FINFO("!FILE,-13)

ECHO FOPTIONS: ![FINFO("!FILE",13)] (#!_FOPT, &

       ![OCTAL(FOPT)], !HEX(_FOPT)]).

DELETEVAR _FOPT

This command file searches for a designated file. If found, its formal file designator, creator and creation date, modification information, file code, record size, end of file, file limit, and file options are displayed. The following example provides a sample of the display provided by the FILINFO command file.

Figure 7-8 FILINFO Sample Output

:FILINFO SAMPLE

(FINFO): Full description for SAMPLE.PUB.MILL follows:

   Created by CLM on WED, MAY 10, 1989.

   Modified on WED, MAY 10, 1989 at 3:21 PM.

   FCODE: 0.

   RECSIZE: -80, EOF: 5, FLIMIT:5.

   FOPTIONS: ASCII, FIXED, NOCCTL, STD (#5, %5, $5).

If the file is not found, an extensive routine determines the fully qualified file name under which the search was performed. This routine determines if the specified file name is a backreferenced file name or a system-defined file name. It also determines whether a group or account designator was included in the original specification. If necessary the group or account are added to the file name to fully qualify it in a response to the user.

Feedback to webmaster