- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Unable set file limit from C-programm
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
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
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
10-17-2014 11:05 AM
10-17-2014 11:05 AM
Unable set file limit from C-programm
Hello experts
I am trying to set a file version limit from a C-program for a file (directory is the next step).
The value is remin the same "No version limit".
Can someone point me to a right direction?
I have attached source code for my test program.
This is a screen copy when i run my test program.
$ cc SETLIMIT.C
$ link SETLIMIT.OBJ
$ TESTSET="$DKA700:[DMITRIY]SETLIMIT.EXE"
$ testset file3.txt 3
$ dir /full file3.txt
Directory DKA700:[DMITRIY]
file3.txt;1 File ID: (13155,28,0)
Size: 0/0 Owner: [1,1]
Created: 17-OCT-2014 13:12:46.70
Revised: 17-OCT-2014 13:12:46.72 (1)
Expires: <None specified>
Backup: <No backup recorded>
Effective: <None specified>
Recording: <None specified>
Accessed: <None specified>
Attributes: <None specified>
Modified: <None specified>
Linkcount: 1
File organization: Sequential
Shelved state: Online
Caching attribute: Writethrough
File attributes: Allocation: 0, Extend: 0, Global buffer count: 0, No version limit
Record format: Variable length, maximum 0 bytes, longest 0 bytes
Record attributes: None
RMS attributes: None
Journaling enabled: None
File protection: System:RWED, Owner:RWED, Group:RE, World:
Access Cntrl List: None
Client attributes: None
Total of 1 file, 0/0 blocks.
Thanks
Dmitriy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2014 12:16 PM
10-17-2014 12:16 PM
Re: Unable set file limit from C-programm
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2014 12:45 PM
10-17-2014 12:45 PM
Re: Unable set file limit from C-programm
H.Beker
Yes, did spend lot of time searching.
I have found that it is read-only, but can't find any straight reference how to set.
I come across this link http://compgroups.net/comp.os.vms/how-to-retrieve-and-set-default-file-version-limi/524495.
But it is incomplete specially without the referenced example (can't find uchar.c on the web anymore).
- Tags:
- rms
- version limit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2014 04:18 PM
10-17-2014 04:18 PM
Re: Unable set file limit from C-programm
Google finds the FILE utility: http://www.decuslib.com/decus/vax88b1/meadows/file/file.c which seems accept /version_limit which in turn seems to set a file version limit. I admit I didn't try to compile the sources and test it, as it looks like VAX(C) code, which you may want to change for newer compilers and because "my VMS system" on the net is on the move.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2014 04:46 PM
10-17-2014 04:46 PM
Re: Unable set file limit from C-programm
To set the file version limit under program control (and not via a subprocess that invokes the SET FILE /VERSION_LIMIT command), see the OpenVMS I/O Abuser's Reference Manual starting on page 46; specifically, see the QIO ACP interface and the IO$_MODIFY I/O function with the FIB$W_VERLIMIT itemcode. There aren't all that many IO$_MODIFY examples posted around the 'net, but see here, here and here as some starting points.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2014 05:43 PM
10-17-2014 05:43 PM
Re: Unable set file limit from C-programm
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2014 10:41 AM
10-20-2014 10:41 AM
Re: Unable set file limit from C-programm
As Steven indicates, there will be SYS$QIO examples on the web to help you.
But why bother? How often will this call be made?
Just call LIB$SPAWN to do the deed and move on.
Hein
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2014 02:31 PM
10-20-2014 02:31 PM
Re: Unable set file limit from C-programm
Thank you for your response.
After changing my code to use sys$qiow, I still can't change the default limit setting.
All calls to IO system are finishing successfully.
I can't use LIB$SPAWN since I need to use this for many files.
Is anything in my code I am doing wrong?
Attached is the source code of my program and also the screen output.
To compile the code, header files will be needed from http://www.decuslib.com/decus/vax88b1/meadows/file.
Thanks
Dmitriy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2014 07:26 PM - edited 10-21-2014 04:10 AM
10-20-2014 07:26 PM - edited 10-21-2014 04:10 AM
Re: Unable set file limit from C-programm
[editted - the dog ate my homework on first submission]
>> To compile the code, header files will be needed from http://www.decuslib.com/decus/vax88b1/meadows/file.
That may be part of the problem.
Just compile with: cc SET_VERLIMIT.C+sys$library:sys$lib_c.tlb
To make that work, fix up FATDEF -> FAT, fchdef -> FCH, ATRDEF -> atrdef. FAT$S_FATDEF -> ATR$S_RECATTR
remove fjndef, and the second set of moves into fid and did.
fwiw... the printing of the FID is not correct for ID > 65K. Need to show FID[2] or add in NMX
>> I can't use LIB$SPAWN since I need to use this for many files.
I used to think that way. I was wrong. Your time is infinitely more valuable than some execution overhead except for a few rare cases
See attached.
It works for me now.
Hein
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2014 01:45 AM
10-21-2014 01:45 AM
Re: Unable set file limit from C-programm
This works for me, with the VMS supplied header files:
#include <stdio.h> #include <string.h> #include <stdlib.h> #define __NEW_STARLET 1 #include <descrip.h> #include <fabdef.h> #include <fibdef.h> #include <iodef.h> #include <iosbdef.h> #include <namdef.h> #include <starlet.h> #include <ssdef.h> static int setverlimit(char *filename, unsigned short limit) { static FABDEF fab; static NAMDEF nam; static FIBDEF fib; static struct dsc$descriptor FibDesc = { sizeof fib, DSC$K_DTYPE_Z, DSC$K_CLASS_S, (char *) &fib }; static struct dsc$descriptor_s DevDesc = { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, &nam.nam$t_dvi[1] }; static struct dsc$descriptor_s FileName = { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0}; char EName[NAM$C_MAXRSS]; unsigned short int DevChan; IOSB iosb; int i, status; fab = cc$rms_fab; fab.fab$l_fna = filename; fab.fab$b_fns = strlen(filename); fab.fab$l_nam = &nam; nam = cc$rms_nam; nam.nam$l_esa = EName; nam.nam$b_ess = sizeof(EName); status = sys$parse(&fab); if (!(status & 1)) return status; status = sys$search(&fab); if (!(status & 1)) return status; DevDesc.dsc$w_length = nam.nam$t_dvi[0]; status = sys$assign(&DevDesc, &DevChan, 0, 0); if (!(status & 1)) return status; FileName.dsc$a_pointer = nam.nam$l_name; FileName.dsc$w_length = nam.nam$b_name+nam.nam$b_type+nam.nam$b_ver; for (i = 0; i < 3; i++) fib.fib$w_fid[i] = nam.nam$w_fid[i]; for (i = 0; i < 3; i++) fib.fib$w_did[i] = nam.nam$w_did[i]; fib.fib$w_verlimit = limit; status = sys$qiow(0, DevChan, IO$_MODIFY, &iosb, 0, 0, &FibDesc, (__int64)&FileName, 0, 0, 0, 0); if (status & 1) status = iosb.iosb$w_status; if (!(status & 1)) return status; status = sys$dassgn(DevChan); return status; } int main(int argc, char *argv[]) { int status = SS$_INSFARG; if (argc > 2) { unsigned int limit; sscanf (argv[2], "%u", &limit); if (limit > 32767) limit = 0; status = setverlimit(argv[1],(unsigned short)limit); } exit (status); }