Discussion:
UNIX tmpfile() (was: Passing data ...?)
Add Reply
Paul Gilmartin
2017-12-01 21:45:17 UTC
Reply
Permalink
Raw Message
And the OS feature I miss most in UNIX is temporary data sets.
​Yes, very much. My method, in general, is to create a "temporary" file in
the ${TMP} directory. Open it. Unlink the file entry. Use the FILE * and
pass it around to other programs so that they can access the data.​
It's easier than that. In:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/tmpfile.html#tag_16_618_03
... In some implementations, a permanent file may be left behind if the process calling
tmpfile() is killed while it is processing a call to tmpfile().

This is the exception that proves the rule that once tmpfile() nas completed
killing the calling process leaves no permanent file behind. tmpfile() ought to
unlink the file before returning.

Unlike most UNIXen, the earliest OMVS violated this, deleting the temporary file
only when the process exited. I suspect this was an accommodation to implementing
temporary files as Classic data sets. I believe it's better now. Don't know about
POSIX(OFF).

As an alternative, you could pass just the descriptor.

Of course, this doesn't cross job step boundaries. Alas, JCL doesn't support
temporary UNIX files.

-- gil

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
scott Ford
2017-12-02 20:56:51 UTC
Reply
Permalink
Raw Message
Gil,

Can you pass a type= memory file? I think it it has persistence..
I have tried it in C ...and know you can create it..

Scott
Post by Paul Gilmartin
And the OS feature I miss most in UNIX is temporary data sets.
​Yes, very much. My method, in general, is to create a "temporary" file in
the ${TMP} directory. Open it. Unlink the file entry. Use the FILE * and
pass it around to other programs so that they can access the data.
http://pubs.opengroup.org/onlinepubs/9699919799/functions/tmpfile.html#tag_16_618_03
... In some implementations, a permanent file may be left behind if the process calling
tmpfile() is killed while it is processing a call to tmpfile().
This is the exception that proves the rule that once tmpfile() nas completed
killing the calling process leaves no permanent file behind. tmpfile() ought to
unlink the file before returning.
Unlike most UNIXen, the earliest OMVS violated this, deleting the temporary file
only when the process exited. I suspect this was an accommodation to implementing
temporary files as Classic data sets. I believe it's better now. Don't know about
POSIX(OFF).
As an alternative, you could pass just the descriptor.
Of course, this doesn't cross job step boundaries. Alas, JCL doesn't support
temporary UNIX files.
-- gil
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Walt Farrell
2017-12-02 22:15:31 UTC
Reply
Permalink
Raw Message
Post by scott Ford
Gil,
Can you pass a type= memory file? I think it it has persistence..
I have tried it in C ...and know you can create it..
From https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.3.0/com.ibm.zos.v2r3.cbcux01/filetype.htm
<quote>
Memory files
Memory files are temporary files that reside in memory. For improved performance, you can direct input and output to memory files rather than to devices. Since memory files reside in main storage and only exist while the program is executing, you primarily use them as work files. You can access memory files across load modules through calls to non-POSIX system() and C fetch(); they exist for the life of the root program.
</quote>

Sounds like it would not work.
--
Walt

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Loading...