How do you write to a source file .TXT in rpg?

105 pts.
Tags:
AS/400
AS/400 FTP
QCLSRC
txtsetup.sif
I am using a .TXT file in QCLSRC for FTP input. Instead of having the 4 records sitting there all the time. I want to be able to write to the .TXT file when a program is called.

Software/Hardware used:
AS/400

Answer Wiki

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

Try this. Create an RPG that writes to an acutal physical file. Then over ride the FTP input file to the physical file you created.

I did this once, a long time ago. Let me know if you need an example and I will see if I can find it.

Discuss This Question: 3  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
    I am using a .TXT file in QCLSRC for FTP input. Usually ".TXT" is contradictory to "QCLSRC". A ".TXT" file would be a streamfile in the /root file system while "QCLSRC" would be a physical source file (i.e., a database file) in the /QSYS.LIB file system. You might have a ".TXT" streamfile that is copied into a QCLSRC source member, and the resulting source member is then used as the input script for FTP. Or you might simply be using terms that aren't appropriate because you aren't familiar with what is happening. ILE RPG can read/write .TXT streamfiles, and it can also read/write physical source file members -- but the two methods are very different. Streamfiles are handled with the common Unix APIs for open(), read(), write(), close(), etc., while physical files are accessed with RPG instruction codes for database I/O. Can you clarify what you need to do? Do you know if you really have a ".TXT" file? Tom
    125,585 pointsBadges:
    report
  • Splat
    I created a source physical file named FTPSRC for my FTP input. I add or clear the relevant member, write the FTP script to the member, then override to that member when running the FTP.
    7,665 pointsBadges:
    report
  • Vatchy
    In your RPG program, use an output file - you might want to call it "SOURCE". In the RPG program you can write to the file from, for instance, a table. Outside the program, override the file "SOURCE" to the actual physical file member and compile the program interactively instead of compiling in batch. When calling the program, call a CL program that does the file override and calls the RPG program.
    1,410 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