Extracting user data with DCL script

February 25, 2011 at 10:48:58
Specs: OpenVMS v 8.3
Please does anyone have a script which will allow, within DCL to determine a username and then extract files from within their user directory along with attributes of the files in the directory

Please Help


See More: Extracting user data with DCL script

Report •


#1
February 27, 2011 at 02:00:41
Other than on unix kind of systems (where ~user is the translated in shells to the users home directory), on VMS
only PRIVILEGED users are allowed to get information about other users account details (access to the SYSUAF file).

That said, as a privileged user, You can get access via DCL by using e.g. programs like GETUAI , UAF from the VMS freeware distribution. See
http://h71000.www7.hp.com/openvms/f...
http://vms.process.com/fileserv-sof...
Example:
$ getuai/default=tmp default
$ sh symbol tmp
TMP = "A01$USER:[USER]"
then use the symbol tmp in the DCL procedure to access files in the users directory.

If You are not privileged, then it depends on how "open" the system is configured: maybe all user directories can be found by logical directory names like disk$user or USER_HOME (on my systems), use "SHOW LOGICAL *user* to find out.

Maybe there is the FINGER utility installed on Your system:
use the output of "FINGER user" to extract the user directory.

Joseph Huber, http://www.huber-joseph.de
ITRC


Report •

#2
February 27, 2011 at 10:35:01
Hi Joseph

thank you for taking the time to post a reply to this - what follows is waht I am trying to achieve - any ideas ? - thank you thank you thank you.....

I want a script to search a passed directory andfile extension for a passed string.

I would like a file listing the extracts, i.e found items + the file creation mod dates which could be presented to a user.


Report •

#3
March 1, 2011 at 06:43:48
Just as easy as to loop over the list of files with lexical function f$search(), and then for each file found extract the dates with lexical function f$file_attributes().
Use HELP and read
HELP LEXICAL f$search
HELP LEXICAL f$file_attrib

But if I understand Your question right, then the script would do what the simple command
DIRECTORY [directory-path]*.ext /date=(creat,modif)
is doing.

Joseph Huber, http://www.huber-joseph.de
ITRC


Report •

Related Solutions

#4
March 1, 2011 at 07:00:07
Ah I misunderstood your question,
you want to list only those files which contain a certain string, right ?

Then in the above f$search() loop, say the symbol FILE contains the next file fopund, and the symbol STRING contains the search string:

$ SAVE_MESSAGE = F$ENVIRONMENT("MESSAGE")
$ set message/nofacility/noident/noseverity/notext !suppress noise
$ search/nooutput 'FILE' "''STRING'"
$ severity=f$integer($SEVERITY)
$ SET MESSAGE'SAVE_MESSAGE'
$ if severity.ne.1 then goto loop !next file if string not found

Joseph Huber, http://www.huber-joseph.de
ITRC


Report •

#5
March 1, 2011 at 07:48:26
And a one-liner if you have the "EACH" command:

›$ each *.ext (searchstring) "write sys$output lv"

where "each" is each.com from VMS freeware.
If not found in the usual freeware distributions, then download it from my server:
HTTP://WWWVMS.MPP.MPG.DE/DISK$WWW/C...

Joseph Huber, http://www.huber-joseph.de
ITRC


Report •

Ask Question