Monday, July 30, 2012

Peoplecode: Writing to file using Write Record


Local Record &RecLine;
Local File &MYFILE;
Local SQL &SQL2;

&MYFILE = GetFile("c:\temp\test.txt", "W", %FilePath_Absolute);


If &MYFILE.SetFileLayout(FileLayout.TEST_FILE_LAYOUT) Then
   &RecLine = CreateRecord(Record.TEST_EMP_REC);
   &SQL2 = CreateSQL("%Selectall(:1)", &RecLine);
   While &SQL2.Fetch(&RecLine)
      &MYFILE.WriteRecord(&RecLine);
   End-While;
End-If;

&MYFILE.Close();

No comments:

Post a Comment