shlogg · Early preview
Judy @esproc_spl

How To Merge Two Text Files Using EsProc And Java Integration

Merging two txt files through ID field using esProc: Import data1.txt (A1), data2.txt (A2). Join A1 & A2 on ID. Create result table sequence. Export to mergedFile.txt.

Problem description & analysis
We have a txt file data1.txt, as shown below:
ID,Name,LastName,Department
12345,John,Samon,Computer Science
14524,David,Souza,Electric and Electronic
And another txt file data2.txt, as shown below:
ID,Q1,Q2,Q3,Midterm,Final
12345,100,90,75,89,100
14524,80,70,65,15,90
The two files associate through their IDs in a one-to-one relationship. We are trying to generate a new text file as follows:
ID,Name,avgQ_Average,Midterm,Final,Department
12345,John,88.33,89,100,Computer Science
14524,David,71.67,15,90,Electric and Electronic
Solution
Write the following script p1.d...