Thank you all and especially @Bernd Oppolzer. They key is that I was not 
checking the open for success correctly. I was formatting the second file name 
incorrectly and as a result the open was failing but my code did not make me 
aware of that. Bad open of course yields a bad fd which yields a -21. It is all 
new code and I had not tested open failures specifically. 

Not sure where you saw the example that you cited. The IBM doc that I am 
looking at has the following for an example (in its entirety):

"open /u/linda/my.exec" o_rdwr+o_trunc+o_creat 700

which is of course useless with regard to how one checks for errors. IBM could 
do better, especially if open is atypical in how it reports errors. 

(https://www.ibm.com/docs/en/zos/2.5.0?topic=descriptions-open)

Thanks again,
Charles

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to