Thanks Scott!!!
I will try that...i will pad the "string" with blanks, then overwrite them
to that same padded length. That should work.
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Scott Klement
Sent: Tuesday, May 05, 2009 12:44 PM
To: RPG programming on the IBM i / System i
Subject: Re: open ifs file for update
Hi Tim,
Is this a stream file (*STMF) that you are updating? Or... what?
There's no such thing as an "IFS file" but most of the time when people
use that phrase, they really mean a "stream file".
If it is indeed a stream file -- it's important to remember that a
stream file is not organized into records. You can think of the entire
file as one big stream of bytes -- kinda like a character string. Think
of it as one big huge alphanumeric field in RPG.
With that in mind... your question is really "can I change a substring
of this file?"
The answer is YES... Just use lseek() to position to the starting
position where you want to change the substring, and then use write() to
change the data at that position.
But, again, remember that this is NOT a record oriented file. If you
write more bytes than will fit before an existing CRLF (or whatever
delimiter you're using) then you will overwrite the CRLF. They are just
characters in a string...
tim wrote:
I am using ExtProc('write'), ExtProc('open'), etc to create a text file in
the ifs. I was wondering if I can us this type of logic to update an
existing text file. I need to update the first record of the text file
with
summary information.
As an Amazon Associate we earn from qualifying purchases.