HTBasic Help
×
Menu
Index

CAT

Displays a catalog of files or PROG file contexts.
 
 CAT [source] [TO destination] [ ; option [,option...] ]
 
Where:
source = path-specifier | prog-file-specifier
destination = #device-selector | string-array$(*)
option = COUNT number of lines | EXTEND | NAMES | NO HEADER | SELECT begin-characters | SKIP number-of-files
begin-characters = string expression
 
Usage:
CAT
CAT "C:\WP";NO HEADER
CAT "D:" TO #701; SELECT "X",SKIP 1;COUNT Count
CAT "*.TXT"
 
Example:
 
Description:
Catalogs of Contexts in a PROG file
If a prog-file-specifier is given, a list of the contexts in that file are listed. The different context types are main context, subprogram contexts, user defined function subprogram contexts and CSUB contexts. Each context is listed with its name, size and type.
 
Catalogs of Files in a Directory
CAT is used to produce a catalog of files that are present in a directory of a mass storage device. CAT can be used as a program command or statement. A header is printed and information is given about each file. The format of the information depends on the file system. However, when CAT is directed to a string array, it produces the SRM catalog format regardless of the file type. The EXTEND option can be used to suppress the SRM format so that the string array is written with the same format as would be displayed on the screen. The format for each file system, including SRM, is given later in this entry.
 
If the file name is too long to give in the space provided by each of the following formats, an asterisk, "*", will be printed in the last column of the file name field to indicate that the name has been truncated. For ASCII and BDAT files, the number of records shown is the number of records specified in the CREATE statement. This behavior was requested by customers for compatibility with existing programs. The actual number of records may be more or less and can be determined by examining STATUS register three of an I/O Path ASSIGNed to the file. Or the file can be CREATEd with zero records; CAT then reports the actual number of records.
 
Long Filename Format
Windows uses long file names, but CAT can use the classic FAT listing format with:
 
CONFIGURE LONGFILENAMES OFF
 
Long Year Format
The listing format for CAT may be changed to display a two-digit year with the command
 
CONFIGURE LONGCATDATES OFF
 
SRM Format
When CAT is directed to a string array, it produces an HP compatible SRM catalog format. The elements of the array must be declared to contain at least 80 characters. If the array has more elements than necessary, the extra elements are set to zero length. If the array doesn't have enough elements, information about the additional files is thrown away and no error is reported.
 
See the notes earlier about file names and number of records. The Level is always listed as 1. The system type specifies the kind of file header for typed files. If the file header is an HTB header, the system type is "HTB". If the file header is an HP LIF header, the system type is "S300" (or "S500" in the special case of Series 500 BDAT files). If the file is a regular file, the system type column is blank, since the file has no header. File access permissions are mapped into SRM permissions in a logical manner from the actual operating system permissions. In general, the Open Status is undefined.
 
Selecting a sub-set of files to be displayed
The SKIP option specifies the first N files are to be skipped. You can also use a wildcard filter.
 
COUNTing the number of lines displayed
The COUNT option gives the number of lines output.
 
Suppressing the header
The NO HEADER suppresses the header.
 
Listing filenames only
The NAMES option outputs only filenames.
 
See Also: