Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DSPUSRPRF to a file misses fields

225 views
Skip to first unread message

Soterro

unread,
Jun 26, 2003, 11:27:23 AM6/26/03
to
Hello,

Is it by design or am I missing something? If I do a DSPUSRPRF on the
screen, I see the home directory (HOMEDIR) at the end. When I do it in
a file (OUTFILE), no home directory is around anymore...
Is there any other CL command which would put in a file this home
directory for further processing?

Thank you,
S

Dr. Ugo Gagliardelli

unread,
Jun 26, 2003, 1:03:09 PM6/26/03
to
It's by design, to get the home directory you should use ifs C api
getpwnam(username) or getpwuid(useruid) in a C program will be

struct passwd *pw;
char *hoedir;
pw = getpwnam(usrprf);
homedir = pw->pw_dir;

--
Dr.Ugo Gagliardelli,Modena,ItalyCertifiedUindoscrasherAñejoAlcoolInside
Spaccamaroni andate a cagare/Spammers not welcome
Spamers iros a la mierda/Spamers allez vous faire foutre
Spammers loop schijten/Spammers macht Euch vom Acker

Soterro

unread,
Jun 27, 2003, 5:10:54 AM6/27/03
to
"Dr. Ugo Gagliardelli" <do...@spam.please> wrote in message news:<3EFB274D...@spam.please>...

> It's by design, to get the home directory you should use ifs C api
> getpwnam(username) or getpwuid(useruid) in a C program will be

If it's by design, it's a very poor design IMHO. Same command gives
different results when different output options are given, sounds like
MS Windows to me.
I wonder was there any logic behind this 'design' or it's just a bug
which was later labeled 'we wanted it so'...

But thank you for the answer, I'll see what I can do - I would love to
avoid compiling programs when I can use scripts instead (should that
be the case).

All the best,
S

Joel S. Mueller

unread,
Jun 27, 2003, 11:03:14 AM6/27/03
to
I missed the original question, but I believe by specifying *OUTFILE, with a
type of *BASIC, it uses a canned (oh, what do you call it...) with format
QSYDSUPB (according to the help text). I am guessing that things like home
directory and locale are not part of that format (probably because of their
potential length?)

Since you mention "scripts", you could use QSH (QShell) to get the
information you want. If you enter QSH and type the following commands, you
end up with an IFS file that has all the information you want, I believe:

system 'DSPUSRPRF THEUSER' > /home/myuserid/dspusrprf.txt
cat dspusrprf.txt

(...blah, blah, blah)
Home directory . . . . . . . . . . . . . . : /home/THEUSER

--
Joel S. Mueller

"Soterro" <send_lotsa...@yahoo.com> wrote in message
news:1a63f162.03062...@posting.google.com...

Soterro

unread,
Jun 30, 2003, 5:33:17 AM6/30/03
to
"Joel S. Mueller" <Joel_M...@TAKEOUT.us.ibm.com> wrote in message news:<bdhmbm$upa$1...@news.rchland.ibm.com>...

> Since you mention "scripts", you could use QSH (QShell) to get the
> information you want. If you enter QSH and type the following commands, you

Theoretically yes. But that way the command gives you the
human-formatted form of the output, which is very messy to interpret.
Add the fact that I expect the output to be in different languages, so
the fields are in different order, have different names, have even
different values... believe me, I gave it some thoughts and I cannot
be done unless you program a neuronal network :)

Thank you,
S

Elvis

unread,
Jun 30, 2003, 11:13:53 AM6/30/03
to
I would go with the API.

Messy CL solution (not recommended):

DSPUSRPRF OUTPUT(*PRINT) and then
CRTPF FILE(QTEMP/MYSPLF) RCDLEN(132) followed by
CPYSPLF FILE(QPUSRPRF) TOFILE(QTEMP/MYSPLF) SPLNBR(*LAST)
and then read the QTEMP/MYSPLF either in CL or some HLL programming
language (i.e. RPG).
Parsing the resulting 132 character string is relatively simple no
matter whether English or other national language.

Francis Lapeyre

unread,
Jul 4, 2003, 8:42:43 AM7/4/03
to
In news:e148ad68.03063...@posting.google.com,
Elvis <budi...@hotmail.com> opined:

Why parse a spool file when DSPUSRPRF also has OUTFILE capabilities?

--

Regards,
Francis (Address is filtered by SpamCop)

"When once you have tasted flight, you will forever walk the Earth with your
eyes turned skyward, for here you have been, and there you will always long
to return."

--Leonardo da Vinci

Dr. Ugo Gagliardelli

unread,
Jul 5, 2003, 3:36:38 AM7/5/03
to
Francis Lapeyre wrote:
> Why parse a spool file when DSPUSRPRF also has OUTFILE capabilities?
Because the original question was about user-profile attributes that are
missing in the outfile record, as home directory, user id, group id, and
some other values releted to posix environment for wich you have to use
unix-like APIs.

Paul Allen

unread,
Jul 7, 2003, 10:19:51 AM7/7/03
to
Dr. Ugo Gagliardelli wrote:

> Francis Lapeyre wrote:
> Because the original question was about user-profile attributes that are
> missing in the outfile record, as home directory, user id, group id, and
> some other values releted to posix environment for wich you have to use
> unix-like APIs.

There is no need to use unix-like APIs. You can retrieve all of the
posix related user profile attributes using the Retrieve User
Information (QSYRUSRI) API format USRI0300.

Home directory is a little gnarly because it comes back in a
offset-based structure with fields indicating the value in in UCS2 CCSID
(i.e. 2-bytes per chatracter).

Mercury

unread,
Jul 7, 2003, 11:06:31 AM7/7/03
to

"Soterro" <send_lotsa...@yahoo.com> a écrit dans le message de news: 1a63f162.03062...@posting.google.com...

Though having no outfile parameter, the simple RTVCURDIR command might perharps fit your needs ?
Mercury


Dr. Ugo Gagliardelli

unread,
Jul 7, 2003, 1:24:10 PM7/7/03
to
For that I use unix-like APIs... :-)

Dr. Ugo Gagliardelli

unread,
Jul 7, 2003, 1:25:36 PM7/7/03
to
Mercury wrote:
> Though having no outfile parameter, the simple RTVCURDIR command might perharps fit your needs ?
> Mercury
RTVCURDIR command tells you the current directory of the current job,
not the user home directory.

--
Dr.Ugo Gagliardelli,Modena,ItalyCertifiedUindoscrasherAńejoAlcoolInside

Mercury

unread,
Jul 7, 2003, 1:58:44 PM7/7/03
to
"Dr. Ugo Gagliardelli" <do...@spam.please> a écrit dans le message de news: 3F09AD10...@spam.please...

> Mercury wrote:
> > Though having no outfile parameter, the simple RTVCURDIR command might perharps fit your needs ?
> > Mercury
> RTVCURDIR command tells you the current directory of the current job,
> not the user home directory.
>
Yes, I know that Dr.Ugo. thanks. I dropped this just in case Soterro interested.
Mercury

Soterro

unread,
Jul 8, 2003, 10:38:38 AM7/8/03
to
"Mercury" <nospam.ca...@hotmail.com> wrote in message news:<beccco$eqf$1...@news-reader1.wanadoo.fr>...

> Yes, I know that Dr.Ugo. thanks. I dropped this just in case Soterro interested.
> Mercury

Thanks a lot to you all.
Finally I reached the conclusion to use unix-like api's in a small
handmade utility called here and there in the scripts. I'm much more
familiar with C and the unix world plus the scripts are actually in
QSH, so as long PASE is quite usable (starting with V5R1) I'll stress
on it. Ok, I might be also among the lucky ones having an AIX system
handy to do the development :)

Again thank you,
S

0 new messages