× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Scott,

Thanks for that, I will give this method a try.
I quite like the stat() approach because its relatively straight
forward.

I have got the QSYRTVUA API working now as suggested by Emmanuel & its
OK.
It will be useful to compare the two approaches.

For the interest of the list, the reason to see who owns an IFS object
is because in our case they are created by a Windows application, not
iSeries, and we occasionally hit problems over the authorities.

It seems QUSER gets to own the objects, but not always.

Regards

Ian Patterson

Grange IT Limited
tel 01947 880458
fax 01947 880439
www.grangesystems.com

* Bacstel-iP systems for Windows and IBM iSeries
* CHECKER Bank Account details Authetication systems
* Inland Revenue submission systems
* HMRC Data Provisioning systems

Grange IT Limited, Registered in England No. 5017635. Registered Office:
62-63 Westborough, Scarborough YO11 1TS


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: 21 August 2007 17:48
To: RPG programming on the AS400 / iSeries
Subject: Re: retrieving an IFS object owner


ian wrote:
If I use the stat() API it gives the User ID of the Owner as a numeric

field. How do I convert this to the Owner name ?

The getpwuid() API will give you the username. There's also a
getgrgid() API for the group profile that owns the file (you didn't ask
about that, but it might also be of interest.)

Here's an excerpt from one of my programs:
D owner s 10a
D groupx s 10a

D info ds likeds(statds64)
D own ds likeds(passwd)
D based(p_own)
D grp ds likeds(group)
D based(p_grp)

path = %trim(dirname) + '/' + filename;
if (lstat64(path: info) = -1);
// handle error
endif;

p_own = getpwuid(info.st_uid);
if (p_own = *null);
owner = %char(info.st_uid);
else;
owner = %str(own.pw_name);
endif;

p_grp = getgrgid(info.st_gid);
if (p_grp = *null);
groupx = %char(info.st_gid);
else;
groupx = %str(grp.gr_name);
endif;


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.