Hi,
I'm using the following File infile1 (sam_rpt) to get the line number ($ln) for File infile2 (loadPracNew.in), ie, the first number after 'Error Text: ' in infile2. In my example, $ln will be 1, and 5.
#### Infile1: sam_rpt
LOAD0007
RUN DATE: Dec 13, 2005 12:07:42
PRIMARY KEY
Error Text: 1, , 12, DOCDEA, , PRACTITIONER_REGI ...
Error Text: 5, , 12, DOCDEA1, , PRACTITIONER_REG ...
RECORDS READ: 6 ACCEPTED: 2
#### Input File 2: loadPracNew.in
PCDOCFIRSTNAME DOCLASTNAME DOCDEA 12PRE194001013000010
AISTATELICID 082005120130000101
PCDOCFIRSTNAME1 DOCLASTNAME1 DOCDEA1 32PRE195001013000010
AISTATELICID1 082005120130000101
PIDOCFIRSTNAME DOCLASTNAME STATELICID 58PRE194001013000010
PIDOCFIRSTNAME1 DOCLASTNAME1 STATELICID1 68PRE195001013000010
Then, I need to loop through infile2, read the line ($ln) into an output file (newLoad.dat).
My problem is: if the next line of Line $ln (Line $ln+1) begins with 'A', both Line $ln and Line $ln+1 should be read into the output file. So my output file should look like the following (from Line 1, Line 1+1, and Line 5 of infile2). But I don't know how to get the Line $ln+1. Please help.
#### Output File: newLoad.dat
PCDOCFIRSTNAME DOCLASTNAME DOCDEA 12PRE194001013000010
AISTATELICID 082005120130000101
PIDOCFIRSTNAME DOCLASTNAME STATELICID 58PRE194001013000010
Many thanks
David
I'm using the following File infile1 (sam_rpt) to get the line number ($ln) for File infile2 (loadPracNew.in), ie, the first number after 'Error Text: ' in infile2. In my example, $ln will be 1, and 5.
#### Infile1: sam_rpt
LOAD0007
RUN DATE: Dec 13, 2005 12:07:42
PRIMARY KEY
Error Text: 1, , 12, DOCDEA, , PRACTITIONER_REGI ...
Error Text: 5, , 12, DOCDEA1, , PRACTITIONER_REG ...
RECORDS READ: 6 ACCEPTED: 2
#### Input File 2: loadPracNew.in
PCDOCFIRSTNAME DOCLASTNAME DOCDEA 12PRE194001013000010
AISTATELICID 082005120130000101
PCDOCFIRSTNAME1 DOCLASTNAME1 DOCDEA1 32PRE195001013000010
AISTATELICID1 082005120130000101
PIDOCFIRSTNAME DOCLASTNAME STATELICID 58PRE194001013000010
PIDOCFIRSTNAME1 DOCLASTNAME1 STATELICID1 68PRE195001013000010
Then, I need to loop through infile2, read the line ($ln) into an output file (newLoad.dat).
My problem is: if the next line of Line $ln (Line $ln+1) begins with 'A', both Line $ln and Line $ln+1 should be read into the output file. So my output file should look like the following (from Line 1, Line 1+1, and Line 5 of infile2). But I don't know how to get the Line $ln+1. Please help.
#### Output File: newLoad.dat
PCDOCFIRSTNAME DOCLASTNAME DOCDEA 12PRE194001013000010
AISTATELICID 082005120130000101
PIDOCFIRSTNAME DOCLASTNAME STATELICID 58PRE194001013000010
Many thanks
David