- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: Creating a userlist of menu access work file
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-31-2009 08:23 AM
тАО08-31-2009 08:23 AM
I have created a simple program for one user work directory and one menu file which works but I need to make the program generic and dynamic so that it will loop through all the users work directories and read all the menu files and append the menu file and user to each record.
This is what I have:
$ SET DEF [TJOHNSON]
$ OPEN/READ INFILE MENU.DAT
$ OPEN/WRITE OUTFILE USERLIST.LIS
$ READ_FILE:
$ READ/END_OF_FILE=DONE INFILE DATA
$ WRITE OUTFILE DATA,";", "MENU.DAT",";", "TJOHNSON"
$ GOTO READ_FILE
$ DONE:
$ CLOSE INFILE
$ CLOSE OUTFILE
$ TYPE USERLIST.LIS
$ EXIT
I need the SET DEF line to change to the users working directory"[TJOHNSON]" and not hard coded like my example.
1. All the users work directories are located under the SYS$SYSDEVICE FOLDER.
2. Each work directory contains about 40 *MENU.DAT files. All the menus end with MENU.DAT.
3. I need to read each record in the table and append it with the menu file name and the user(Work directory).
4. Once I have this information in a work file I can FTP the data down to access and create a report with crystal.
I can probably do this with a lot of hard coding and repetition.
Any Ideas?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-31-2009 08:54 AM
тАО08-31-2009 08:54 AM
Re: Creating a userlist of menu access work file
Before you read further in this reply, please go read through the OpenVMS User's Guide, skim the DCL dictionary and particularly the lexical functions, and skim the programming concepts manual.
http://www.hp.com/go/openvms/doc
>I need the SET DEF line to change to the users working directory"[TJOHNSON]" and not hard coded like my example.
See SYS$LOGIN and SYS$LOGIN_DEVICE, or set up your own site-local logical names.
Logical names and symbol substitution are key concepts for DCL programming, as are DCL lexical functions.
>1. All the users work directories are located under the SYS$SYSDEVICE FOLDER.
SYS$SYSDEVICE Folder? No.
SYS$SYSDEVICE is a logical name that refers to the system disk device.
If I'm building a menu system, I'd tend to have my own logical name for the device and (not folder) directory involved with the menu.
>2. Each work directory contains about 40 *MENU.DAT files. All the menus end with MENU.DAT.
That's going to be a maintenance problem, but you probably know that. And you need to guard against the user writing to the directory and clobbering those files, too.
>3. I need to read each record in the table and append it with the menu file name and the user(Work directory).
Ok. Go read it. (If that's your design.)
>4. Once I have this information in a work file I can FTP the data down to access and create a report with crystal.
COPY /FTP is your best friend here.
Work file?
>I can probably do this with a lot of hard coding and repetition.
Invest in learning before investing in brute-force.
>Any Ideas?
Read the manuals? (Seriously.)
If you're interested in seeing a combination of a DCL menu system and OpenVMS DCL code and OpenVMS C code and other such, see:
http://labs.hoffmanlabs.com/node/1260
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-31-2009 09:36 AM
тАО08-31-2009 09:36 AM
Re: Creating a userlist of menu access work file
2. Do you really want to create USERLIST.LIS in each directory where you find *MENU.DAT?
In any case, the DCL lexicals you will find useful are F$SEARCH and perhaps F$PARSE.
Will it be sufficient to simply find all *MENU.DAT on SYS$SYSDEVICE? F$SEARCH will do that. If you have a subset of directories to search rather than the whole disk then perhaps you will want another loop.
Have fun.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-31-2009 10:14 AM
тАО08-31-2009 10:14 AM
Re: Creating a userlist of menu access work file
I have made some progress and figured out how to loop through the work directories.
Just need to figure out how to loop through all the *Menu.dat tables in the directory. Currently this program is hard coded for one table "Menu.dat"
$! Created by......: ****** August 2009.
$! Description.....: Create a user list with Menu access
$!********************************************************
$! Open the work table
$! Get all the users from the SYSUAF file
$! Do while you have a User
$! Set the directory to the User
$! Check for a Menu file
$! Do while there is a record
$! Write to the work file with the file and the user
$! End
$! End
$!*****************************************************
$ OPEN/WRITE OUTFILE [TJOHNSON]USERLIST.LIS
$open /write/read/share=write uaf 'f$parse("SYSUAF","SYS$SYSTEM:.DAT",,,"SYNTAX)
$loop:
$ read/end=done uaf rec ! more than 1?
$ if p1.nes."" then read/end=done/key=&p1 uaf rec ! just 1
$ defdir=f$extr(148+1,f$cvsi(148*8,8,rec),rec)
$ SET DEF &defdir
$ OPEN/READ INFILE/ERROR=OPEN_ERROR MENU.DAT
$ READ_FILE:
$ READ/END_OF_FILE=DONE INFILE DATA
$ WRITE OUTFILE DATA,";", "MENU.DAT",";", defdir
$ GOTO READ_FILE
$ DONE:
$ CLOSE INFILE
$ OPEN_ERROR:
$ if p1.eqs."" then goto loop
$done:
$ CLOSE OUTFILE
$close uaf
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-31-2009 10:31 AM
тАО08-31-2009 10:31 AM
Re: Creating a userlist of menu access work file
$ sourcedir = "SYS$LOGIN:*.TMP"
$ next = f$search("RESET_SEARCH_CONTEXT.BOGUS_TMP;0",1)
...
$loop:
$ nextfile = f$search(sourcedir,1)
$ if f$length(nextfile) .eq. 0 then goto done
....
$ goto loop
$done:
...
$ exit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-31-2009 11:10 AM
тАО08-31-2009 11:10 AM
Solution> file in each user directory
I don't see that problem. Did you check HELP LEXICALS F$SEARCH? Will F$SEARCH ("SYS$SYSDEVICE:[*...]*MENU.DAT") find files that you don't want? Will you be able to tell that you don't want them?
> I have made some progress and figured out
> how to loop through the work directories.
OK. I see you pulling out the login directory but not the login device. This will fail if you get a user with a different login device from the current default device when your command file is run.
> Just need to figure out how to loop
> through all the *Menu.dat tables in the
> directory.
See my previous clues about F$SEARCH.
I still think that your SET DEFAULT commands are unnecessary. You can specify the device and directory information in your OPEN statement or in your F$SEARCH command.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-01-2009 01:14 AM
тАО09-01-2009 01:14 AM
Re: Creating a userlist of menu access work file
* Logicals
* File system
* DCL in general, and file access and lexical functions in particular
Some system management may be handy: you can specify what would be the defaults for any user ("working diectory" in UNIX terms), the type of account, facilities available and, in your case, what procedure to be executed, all set wehn this user logs in.
You won't need a SET DEFAULT at any time.
Keep in mind that a carefully designed system would be centrally maintainable with minimal effort and still be crystal clear for auditors. You cannot built such a system by thinking fingers.
OpenVMS Developer & System Manager
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-01-2009 05:25 AM
тАО09-01-2009 05:25 AM