Author Topic: How to check file accessibility in REXX?  (Read 3469 times)

Dariusz Piatkowski

  • Hero Member
  • *****
  • Posts: 1317
  • Karma: +26/-0
    • View Profile
How to check file accessibility in REXX?
« on: October 11, 2020, 03:30:28 am »
Looking to do this in REXX for a couple of reasons:

1) my NetDrive samba plug-in stops reasponding after some hours...not sure why, all I can tell is that the mapped drive no longer has any contents available, which means that neither through WPS nor command line can I actually get to the remote Samba share

NOTE: I simply kill ndctl.exe, re-start and all is well once again...until the next time!  ???

2) for the above reason I need to enhance my RSYNC copy REXX script so that it verifies the accessibility of both the SOURCE and TARGET objects before any processing actually starts. In general this is good practice regardless. In my case the added benefit is that if ndctl.exe died again at least I know that, and can either re-start first or simply stop the script execution

OK, so right now I'm pulling the RexxUtil library into my RSYNC script, is there something there I should look at?

My REXX familiarity and experience are very surface level (rudimentary), although way back when, as in 20 yrs ago, I used to do a boat-load of mainframe scripting with REXX...ha ha. I suspect there is something out there that would allow me to basically point to a fully qualified filename (so path and the filename) to see if the given 'object' can be accessed. If my NetDrive plugin dies that call should fail and I should be able to trap that exception.

Any suggestions where I can find that additional info?

Thanks!

Andy Willis

  • Sr. Member
  • ****
  • Posts: 292
  • Karma: +7/-0
    • View Profile
Re: How to check file accessibility in REXX?
« Reply #1 on: October 11, 2020, 03:42:22 am »
If I am not misreading what you want, sysfiletree() should do what you want.  This is OOREXX documentation but as I recall it is the same for the OS/2 version:
https://www.oorexx.org/docs/rexxref/x29079.htm

Pete

  • Hero Member
  • *****
  • Posts: 1281
  • Karma: +9/-0
    • View Profile
Re: How to check file accessibility in REXX?
« Reply #2 on: October 11, 2020, 05:02:57 am »
Hi Dariusz

Saw something in Rexx Tips and Tricks 3.60 awhile back that may be of use - once modified to your purpose...
Aha! Found it! If you have this useful book see
     Sample source code -> Disk-, Directory- and File Handling -> Check if a drive is ready

If not download https://hobbes.nmsu.edu/download/pub/os2/dev/rexx/rxtt36.zip


Regards

Pete


Dariusz Piatkowski

  • Hero Member
  • *****
  • Posts: 1317
  • Karma: +26/-0
    • View Profile
Re: How to check file accessibility in REXX?
« Reply #3 on: October 11, 2020, 05:18:11 pm »
Andy and Pete,

Thank you guys. The sysfiletree() function is exactly what I was looking for and RexxUtil library has that available on our OS/2 platform. The Tips & Trick INF has some great info (i had an older version here) and the example pointed out will be a great reference point for me.

Cheers to all!