REXX Tips & Tricks, Version 2.80


Inf-HTML [About][Toc][Index] 0.9b (c) 1995 Peter Childs


Check if a name describes a device or a file





 
/* check if a name is the name of a file or the name of a device      */
/*                                                                    */
/* note:                                                        v2.40 */
/*                                                                    */
/*  Another method to test if a name is a device name or filename is  */
/*                                                                    */
/*   testName = stream( testFileName, "c", "QUERY EXISTS" )           */
/*   if fileSpec( "P", testName ) = "\DEV\" then                      */
/*      say testFileName || " is a device."                           */
/*   else                                                             */
/*      say testFileName || " can be a file or directory."            */
/*                                                                    */

  if stream( testFileName, "c", "QUERY EXISTS" ) <> "" then  /* v2.00 */
    if stream( testFileName, "c", "QUERY DATETIME" ) = "" then
      say TestFileName || " is a device!"
    else
      say TestFileName || " is a file!"
  else                                                       /* v2.00 */
    say TestFileName || " does not exist!"                   /* v2.00 */

  

Inf-HTML End Run - Successful