×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




I've encountered the condition where two timestamps are created with the same value.

My "fix" was to attempt to write the TS value to a uniquely keyed file and if a duplicate
key error resulted, the time stamp value would be incremented by a small fraction and
the write retried until a unique value was created . . .

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of McGovern, Sean
Sent: Tuesday, October 14, 2014 7:20 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: tmpnam() not unique

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 filename is returned (though I don't know how to test this scenario).

I haven't coded to handle this possibility, and end up with two jobs trying to create the same temporary IFS file.

I was thinking that a solution could be just prefix/suffix the job number to the filename returned by tmpnam().

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.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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

This mailing list archive is Copyright 1997-2026 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.