TIP: Click on subject to list as thread! ANSI
echo: os2user-l
to: All
from: Herbert Rosenau
date: 2004-10-25 05:05:04
subject: Re: REXX - Selective Reading of An Array

Don{ald} O. Woodall schrieb:
> Hello REXX Programmers
> 
>      My current OS partition is a little bit corrupted.  I am unable to
> type help  REX0004  at the command line and get
> anything.
> 
> OS/2  Ctrl+Esc = Window List  Type HELP = help 13:34:07 Sat 10-23-2004
> 
> 
>           The program is reading all the Directory Names/Paths
> 
>                     and writing them into an Array.
> 
> [H:\]h:
>    104 +++         blankdir = blankdir + 1;
> REX0004: Error 4 running H:\blnk-in-dir.cmd, line 104: Program interrupted
> 
> [H:\]
> 
>      The reading into the array works.
> 
>      Writing EVERYTHING from te array to a file works.
> 
>      Trying to check all the directory paths for blank spaces in the
> directory name and only write the directories with spaces in their names
> to file hung as you see above.
> 
>      Help  Thanks
> 
> /*                The name of this file is:  Blnk-In-Dir.Cmd               
> */ /*                                                                         
> */
> 
> /*   The purpose of the program is to search a drive Partition/Volume      
> */ /*            for directory names which contain spaces in them.            
> */
> 
> /*           This program uses the REXX command
"SysFileTree."             
> */
> 
> /*        Get-Dir-Lst.CMD is (C)copyright by Donald O. Woodall 2004        
> */ /*			    all rights reserved 			    */
> /*      -------------------------------------------------------------      
> */
> 
> /*   PreRegister the  SysLoadFuncs  Function				    */
> /*
> ------------------------------------------------------------------------
> */
> 
> CALL RxFuncAdd 'WPToolsLoadFuncs', 'WPTOOLS',  'WPToolsLoadFuncs' CALL
> RxFuncAdd 'SysSetObjectData', 'RexxUtil', 'SysSetObjectData' CALL
> RxFuncAdd 'SysCreateObject',  'RexxUtil', 'SysCreateObject' CALL RxFuncAdd
> 'SysLoadFuncs',     'RexxUtil', 'SysLoadFuncs' CALL WPToolsLoadFuncs
> CALL SysLoadFuncs
> 
> 
> /*   Pre-Registering a REXX Function - System Cursor Position	*/ /*
> ------------------------------------------------------------ */
>    function_to_load = syscurpos
>    call rxfuncadd function_to_load,'rexxutil',function_to_load
> 
> 
> /*   Pull the Drive Letter to Check for Spaces in Directory Names   */ /*
> ---------------------------------------------------------------- */
>    RETRY1:
>    CLS
>    Say ' '
>    Say ' '
>    Say '     Enter the Drive Letter you want to Check for Blank Spaces'
>    Say ' '
>    Say '                    in the Directory Names. '
>    Say ' '
>    Call syscurpos 4, 44
>    parse pull driveletter
>    Say ' '
>    Say '              You entered file name of: ' driveletter
>    Say ' '
>    Say '                Is this correct? : '
>    Call syscurpos 8, 41
>    pull YN1a
>    if YN1a = N
>      then signal RETRY1
> 
> 
> /*  Variable Declarations             */
> /*  --------------------------------  */
> checkdrive = driveletter":"
> dirspec =  '\*'
> blankdir = 0
> 
> 
> /*  Variable Name for the Write File  */
> /*  --------------------------------  */
> ritefile = 'drive-'driveletter'-luser-dirs'
> 
> 
> /*  Open File to Write To      */
> /*  -------------------------  */
> CALL stream ritefile,'C','OPEN WRITE'
> 
> 
> /*           Screen Display For User To Look At            */ /*
> ------------------------------------------------------- */
>    CLS
>    Say ' '
>    Say ' '
>    Say '          The program is reading all the Directory Names/Paths'
>    Say ' '
>    Say '                    and writing them into an Array.'
>    Say ' '
>    Say ' '
> 
> 
> /*  Main Program  */
> /*  ------------  */
> 
> checkdrive
> 
> /* rc= SysFileTree(filespec, stem(,(options) (,(targ-attr) (,new-asttr))))
> */ CALL SysFileTree dirspec, 'results', 'DSO'
> 
> DO I = 1 to results.0

use of I first tim


> /*  Read the Directory Path Lines in from the Source File  */ /*  and
> write them out to the proper Level depth File.     */ /*
> ------------------------------------------------------- */ 

Do I = 1 to

use of I second time while I is already in use!

Why on earth will you roun twice over the tree? Hiding a do i... 
behind a comment may hide  it from the human reader but not from the 
interpreter

> results.0
>   looplength = length(results)
>   string_pos = 1
>   slashcount = 0
>   filenum = 0
>   search = ' '
>   DO WHILE looplength > 0
>     search = substr(dirpath,string_pos,1)
>     IF search = " " THEN

       DO
missing

>       CALL lineout ritefile, results.I
>       blankdir = blankdir + 1
>     END  /* IF THEN */
>     string_pos = string_pos + 1
>     looplength = looplength - 1
>   END  /* nested DO WHILE */
>   filenum = slashcount
> 
> END /* DO I */
> 
> CALL lineout ritefile, ' The number of blank directories is: ' blankdir
> SAY ' '
> SAY ' '
> SAY '    The number of blank directories is: ' blankdir
> SAY ' '
> 
> /*  EXIT Program  */
> /*  ------------  */
> EXIT
> 


-- 
Tschau/Bye

Herbert Rosenau
EDV Beratung & Programmierung
Eichelsdorfer Str. 15
97461 Hofheim i.UFr.

Tel: 49-9523-502834
Fax: 49-9523-502823                     http://www.dv-rosenau.de/


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/E8folB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

 To visit your group on the web, go to:
    http://groups.yahoo.com/group/os2user/

 To unsubscribe from this group, send an email to:
    os2user-unsubscribe{at}yahoogroups.com

 Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 




---
* Origin: Waldo's Place USA Internet Gateway (1:3634/1000)
SEEN-BY: 633/267 270 5030/786
@PATH: 3634/1000 12 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.