USROPN – AS/400 question

440 pts.
Tags:
AS/400
USROPN
AS/400 question: When normal handling of opening and closing is done in RPG...why do you need USROPN, OPEN & CLOSE commands? As per my understanding, Say you have the below scenario: You have file A and member A - After processing file A you wanted to process File B and its Member B. In this case you use extfile and extmbr declared in your RPG and you have to manually control the file open and close operations using USROPN. Please correct me if this is wrong and can you please help me knowing more about the usage of USROPN in specific when we have the RPG handling the file open and close operations. Also, another question which I would like to ask is about the usage of USROPN in Display file. Can you please state an example? Thanks.

Answer Wiki

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

Discuss This Question: 2  Replies

 
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
  • TomLiotta
    When normal handling of opening and closing is done in RPG why do you need USROPN , OPEN & CLOSE commands?   You use those when you want files opened and close at times other than when it would automatically be done. Your FileA and FileB example is a possible use.   Another example would be spooled output from a program I wrote a few years ago. The program might be called thousands of times per second, day after day for months. Under certain error conditions that might happen once in a couple years, or never, the program needed to print some records about what caused the error. I didn't want the printer file to be opened and closed every time the program was called, so it was a USROPN file.   ...the interviewe specifically questioned about the usage of USROPN in Display file. Can you please state an example?   Yes.   But you should be able to think of circumstances when you do not want a display file opened.   Tom
    125,585 pointsBadges:
    report
  • ToddN2000
    Another reason for USROPN, OPEN and CLOSE is if you use the QCMDEXC command.  We use this if we want to change spool attributes. Say a certain user want 2 copies of the spoolfile. You would close ther current, OVRSPLF, OPEN.. do job , then revert back to original spool file attributes. We have also used the feature when we developed some of our CGI apps. This was to control the proper OVRDBF commands within an RPG program to grab the correct data files.
    9,915 pointsBadges:
    report

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