Technical data

Using Files and Directories
10.1 Understanding Extended File Specications Features
Case Is Determined by the First Instance of an Extended File Name
On an ODS-5 volume, the case for all versions of a file name is identical; the case
is preserved as the file name was first created.
In the following example, the disk is ODS-5.
$ SET DEFAULT DKA500:[TEST]
$ SET PROCESS /PARSE_STYLE=EXTENDED
$ CREATE myfile.txt
Ctrl/Z
$ CREATE MYFILE.TXT
Ctrl/Z
$ DIRECTORY
Directory DKA500:[TEST]
myfile.txt;2 myfile.txt;1
Be Aware of Case Preservation but Case Blindness of Extended File
Specications
Keep in mind that although an ODS-5 disk preserves the case of a file as it is first
entered, it searches for files in a case-blind manner. Similarly, users must also be
careful when they do comparisons, such as when they use DCL string functions
like
.EQS.
and
F$LOCATE
in a DCL command procedure.
The following example demonstrates the importance of case-blind matching of
file names in DCL. In the program, notice that you specify no argument to do a
case-sensitive match but that you specify an argument to do a case-blind match.
This program uses
F$SEARCH
to find all the files that have a file type of
.TXT.
Because RMS (and therefore
F$SEARCH
as well does case-blind matching,
F$SEARCH
also finds files with the file type
.txt. F$SEARCH
then uses
F$LOCATE
to search
the file name for
TEST.
Because
F$LOCATE
does case-sensitive comparisons, it fails
to match unless you first change the string to uppercase.
$ case_blind = 0
$ if p1 .nes. "" then case_blind = 1
!
$loop:
$ file = f$search("*.TXT;")
"
$ if file .eqs. "" then goto not_found
$ write sys$output "Search returns " + file
$ if case_blind .eq. 1 then file = f$edit(file,"UPCASE")
#
$ if (f$locate("TEST",file) .ne. f$length(file)) then goto found
$
$ goto loop
$found:
$ write sys$output "Found a file matching TEST"
$ exit
$not_found:
$ write sys$output "Did not find file matching TEST"
$ exit
! Set
case_blind
to 1 if there is an argument (and a case-blind comparison can
be made).
" Get a file ending in
.TXT
or
.txt
(because
F$SEARCH
is case-blind).
# If a case-blind comparison was selected in Step 1, change the file name to
uppercase to make a case-blind comparison.
$ If
F$LOCATE
finds a file, it will go to
found:.
104 Using Files and Directories