XML-INTO and File Lock

10 pts.
Tags:
iseries v5r4
XML
XML-INTO
Hi, I want to process an XML file from the IFS using XML-INTO. I want to lock the file so that no one accesses it while it is being processed. I use Open(FileName:O_RdOnly:O_Share_None). This seems to lock the file alright but the XML-INTO will not work while the file is locked. Both the Open and XML-INTO are issued from the same program. Any idea if I'm missing some other keyword? Thanks.

Software/Hardware used:
ISeries, V5R4

Answer Wiki

Thanks. We'll let you know when a new response is added.

<i>Open(FileName:O_RdOnly:O_Share_None)</i>

I can’t be sure since you don’t show a prototype, but it looks like you aren’t specifying sharing at all. The sharing should therefore become O_SHARE_RDWR.

But then it looks like you’re also applying permissions of O_SHARE_NONE.

O_SHARE_NONE resolves to 000002000000, but <i>mode</i> is type mode_t which is unsigned int. I’m pretty sure you don’t want to be assigning the O_SHARE_NONE macro value to the <i>mode</i> parameter.

What you were probably thinking was something more like:<pre>
myOFLAG = %bitor( O_RdOnly:O_Share_None ) ;
Open( FileName:myOFLAG ) ;</pre>
By using the <i>mode</i> parameter, you were setting permission bits on the file. What you needed to be thinking was that <i>oflag</i> is actually a series of bits that are either on or off. By ORing the related macro values together, you pass the combination of O_RdOnly and O_Share_None into that single parameter.

Now, I don’t know how XML-INTO reacts to different states of an opened file descriptor, so you’ll probably still need to experiment. But maybe this has shed a little light on how open() can be used. It’s definitely different from OPEN.

Tom

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following