Reading from one file and writing into another file Pseudo
Code.
Local array of string
&FNAMES;
Local string
&FILEPATH,&Lin;
Local File
&File1,&File2;
&FILENAME2 =
"c:\abc.txt";
&FILENAME1 =
"d:\xyz.txt";/***Give the right path with file name***/
/***Opening File2 in Append mode
and writing data into File2***/
&File2 =
GetFile(&FILENAME2, "A", %FilePath_Absolute);
If &File2.IsOpen Then
&TextPRINT = "Program ABCEF";
&File2.WriteLine(&TextPRINT);
End-If;
&File2.Close();
/***Opening File2 in Read mode
***/
&File2 = GetFile(&FILENAME2, "R",
%FilePath_Absolute);
/***Check whether File1
Exists***/
If FileExists(&FILENAME1,
%FilePath_Absolute) Then
&File1 = GetFile(&FILENAME1,
"A", %FilePath_Absolute);
/***read the data from File2 and writing into File1***/
If &File1.IsOpen Then
While
&File2.ReadLine(&Lin)
&File1.WriteLine(&Lin);
End-While;
End-If;
&File1.Close();
&File2.Close();
End-If;
*******************
Expected
output
File1
d:\xyz will have the Data of File2 (c:\abc.txt)
No comments:
Post a Comment