lenjturnbull
MIS
I am splitting information inside a script and want to establish a file name from data read. Right now I have a script that separates and fills a file but the file name is one I create. In the file I am reading the 2nd text line(record) has the 9th field that I want to id the file.
I am beating my brains trying to figure this one out.
here is a sample of the script I am using.
It takes a file and creates single files for each ISA/IEA encountered.
/^ISA/ && OUTFILE == "" {
OUTFILE = "ACK997X"sprintf("%03d",outnum++)".999"
}
OUTFILE != ""{
print > OUTFILE
}
/^IEA/ && OUTFILE != ""{
close(OUTFILE)
OUTFILE=""
In the 2nd text line, it always starts with a "GS" and the 9th field always has a value
Example
ISA*00* *00* *01*003897733 *02*HBGI *000210*072
8*U*00300*000021127*0*P*^
GS*FA*COMPAQSTS*HBGI*000210*0728*21127*X*003040
ST*997*0001
AK1*QM*14975
AK9*A*1*1*1
SE*4*0001
GE*1*21127
IEA*1*000021127
In the above I want to create a file id "ACK997X"+"3040".suffix
Thanks for any assistance.
Len
I am beating my brains trying to figure this one out.
here is a sample of the script I am using.
It takes a file and creates single files for each ISA/IEA encountered.
/^ISA/ && OUTFILE == "" {
OUTFILE = "ACK997X"sprintf("%03d",outnum++)".999"
}
OUTFILE != ""{
print > OUTFILE
}
/^IEA/ && OUTFILE != ""{
close(OUTFILE)
OUTFILE=""
In the 2nd text line, it always starts with a "GS" and the 9th field always has a value
Example
ISA*00* *00* *01*003897733 *02*HBGI *000210*072
8*U*00300*000021127*0*P*^
GS*FA*COMPAQSTS*HBGI*000210*0728*21127*X*003040
ST*997*0001
AK1*QM*14975
AK9*A*1*1*1
SE*4*0001
GE*1*21127
IEA*1*000021127
In the above I want to create a file id "ACK997X"+"3040".suffix
Thanks for any assistance.
Len