|
wrote:
Thanks for the information Scott.
I think I'll just add the job number to the filename.
Unfortunately, there is going to be numerous programs where this 'fix' is
required !
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott
Klement
Sent: 14 October 2014 15:03
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: tmpnam() not unique
This link is for Z/OS.
I know that tmpnam() is not considered unique on FreeBSD (an open Unix
similar to Linux that I've worked on), and they recommend calling
mkstemp() instead.
When I was looking for something similar on IBM i, I got the impression
that tmpnam() worked nicely on IBM i and it wasn't the same problem. So
it's disappointing to hear that it isn't, in fact, unique.
Usually (at least on other platforms) the problem is the time between
calling tmpnam() and the time it takes you to create the file in the /tmp
directory. Since it's possible that another job could call
tmpnam() in between your job calling tmpnam() and actually creating the
unique file in /tmp. The unique filename is checked against the /tmp
diretory, but if you haven't created it yet, it could duplicate.
But, I thought IBM had somehow worked around that on IBM i. Sigh.
On 10/14/2014 8:53 AM, McGovern, Sean wrote:
No, I've not seen anything that states the filename is based ontimestamp, but it wouldn't surprise me if it is.
existing file..."
I've just looked at this link...
http://publib.boulder.ibm.com/infocenter/zvm/v6r1/index.jsp?topic=/com
.ibm.zvm.v610.edclv/tmpnam.htm
...but can't tell whether the filename should be unique across the LPAR.
"Produces a valid file name that is not the same as the name of any
"The tmpnam() function produces a different name each time it is calledwithin a module..."
"When the calling application is an OpenExtensions C program, tmpnam()returns a unique file name..."
tmpnam() has returned the same filename in two separate jobs.
...and don't know how to write something to test it !
We had some issues which I've investigated, and my conclusion is that
generate a unique filename.
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of
Scott Klement
Sent: 14 October 2014 14:45
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: tmpnam() not unique
That would be very disappointing... IBM says that tmpnam() will
filename is returned (though I don't know how to test this scenario).
Does it say somewhere that this is based on the timestamp?? (which
certainly isn't unique!)
On 10/14/2014 8:19 AM, McGovern, Sean wrote:
I've believe I have encountered an issue with my use of tmpnam().
If 2 jobs use tmpnam() at the same timestamp moment, I *think* the same
trying to create the same temporary IFS file.
I haven't coded to handle this possibility, and end up with two jobs
number to the filename returned by tmpnam().
I was thinking that a solution could be just prefix/suffix the job
Does that seem like a feasible solution ?
--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/rpg400-l.
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
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.