Copying data from a file created in QTEMP

Tags:
QTEMP
RPGLE
How to write a code to copy the data from a file which is created in QTEMP to the file which is created in a permanent library.
1

Answer Wiki

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

It’s no different than any other copy file. It can be in a cl using the CPYF command and qualifying the libraries. It could also be done in an RPGLE as long as you have QTEMP in your LIBL and the file has been created with data it works no differently than any other file with the exception that when your interactive session ends the QTEMP files are deleted.

Discuss This Question: 5  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.
  • Subhendu Sen
    Did you want a sample code? It is better to write code and come back if there is any error.
    130,690 pointsBadges:
    report
  • GregManzo
    The main trick to remember is that every job gets its own private little version of QTEMP, so any attempt to copy data to a permanent library must be done in the same job. ((under the covers, QTEMP is really just a chunk of memory that only exists in your jobs PAG. When your job ends the PAG and all that memory is released.))
    2,905 pointsBadges:
    report
  • ShanuPriya1994
    Please help me by giving some sample code.
    25 pointsBadges:
    report
  • ShanuPriya1994
    Using RPGLE.
    25 pointsBadges:
    report
  • GregManzo
    Any code in RPG to read a file in QTEMP will look identical to code that reads a file in any permanent library. You *could* add EXTFILE('QTEMP/FileName') to the F-spec to make sure you are opening the QTEMP version, but if QTEMP is high in your library list (and why not?) then even that is unnecessary.
    Once the file is opened, you can deal with it the same as any other file (chain, read forwards/backwards, update, delete, etc.).
    The beauty of the way QTEMP is implemented is that it looks and behaves identical to any real library, the only difference is you have your own private copy that no other process can interfere with.
    2,905 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.

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

Following

Share this item with your network: