inbound

2
Local File &myfile; Local array of string &myarray; Local string &text; Local Record &rec; &myfile = GetFile("C:\Documents and Settings\Administrator\Desktop\ office.txt", "r", %FilePath_Absolute); &myarray = CreateArrayRept("", 0); &rec = CreateRecord(Record.IN1_TBL); If &myfile.IsOpen Then While &myfile.ReadLine(&text); &myarray.Push(&text); &myarray = Split(&text, ","); &rec.IN1_NAME.Value = &myarray [1]; &rec.IN1_LOCATION.Value = &myarray [2]; &rec.Insert(); End-While; End-If; &myfile.Close(); Or Local File &MYFILE; Local Record &REC; Local array of string &ARRAY; &MYFILE = GetFile("R:\psoft\hr89\IPT.TXT", "R", %FilePath_Absolute); &REC = CreateRecord(Record.RECD); &ARRAY = CreateArrayRept("", 0);

Upload: nagasankar

Post on 18-Jan-2016

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Inbound

Local File &myfile;

Local array of string &myarray;

Local string &text;

Local Record &rec;

&myfile = GetFile("C:\Documents and Settings\Administrator\Desktop\office.txt", "r", %FilePath_Absolute);

&myarray = CreateArrayRept("", 0);

&rec = CreateRecord(Record.IN1_TBL);

If &myfile.IsOpen Then

While &myfile.ReadLine(&text);

&myarray.Push(&text);

&myarray = Split(&text, ",");

&rec.IN1_NAME.Value = &myarray [1];

&rec.IN1_LOCATION.Value = &myarray [2];

&rec.Insert();

End-While;

End-If;

&myfile.Close();

Or

Local File &MYFILE;

Local Record &REC;

Local array of string &ARRAY;

&MYFILE = GetFile("R:\psoft\hr89\IPT.TXT", "R", %FilePath_Absolute);

&REC = CreateRecord(Record.RECD);

&ARRAY = CreateArrayRept("", 0);

If &MYFILE.IsOpen Then

Page 2: Inbound

If &MYFILE.SetFileLayout(FileLayout.RECD_FL) Then

While &MYFILE.ReadLine(&STRING);

&ARRAY = Split(&STRING, ",");

For &I = 1 To &REC.FieldCount

&REC.GetField(&I).Value = &ARRAY [&I];

End-For;

/* Additional processing */

&REC.Insert();

End-While;

Else

/* Message – filelayout not correct */

End-If;

Else

/* Message – file not open */

End-If;

&MYFILE.Close();