Below is the contents of the file I am trying to process.
The Field separator is an asterisk....
Do I have to convert the incoming file from ASCII to EBIDIC or is there some what to force it to use ASCII encoding within the Qshell processing?
ISA*00* *00* *ZZ*10301 *ZZ*TN001988 *151204*1217*^*00501*000000001*0*P*:~
GS*FA*10301*TN001988*20151204*121752*1*X*005010X231A1~
ST*999*0001*005010X231A1~
AK1*HC*11723001*005010X223A2~
AK2*837*011723001*005010X223A2~
IK5*A~
AK9*A*1*1*1~
SE*6*0001~
GE*1*1~
IEA*1*000000001~
-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Buck Calabro
Sent: Wednesday, July 20, 2016 12:19 PM
To: midrange-l@xxxxxxxxxxxx
Subject: Re: Awk script running in QShell
On 7/20/2016 12:44 PM, Fuchs, James M wrote:
But if I put in print statements to print the records, the record number, and number of fields prior to the first pattern match and set the Field separator (hard coded ) within the variable/constants definitions the script will print all of individual records in the file along with accurate record numbers and field counts.
Well then we're back to character encoding / pattern matching. In particular, look at the ISA record. Column 4 should be the field separator for the rest of the records. To wildly generalise, CCSID 1252 is Windows. 819 is *nix.
Also tried with just printing the first field (print $1) as well as a
substring of the first 4 characters, that, for the most part worked
correctly also
That's a good diagnostic. What is the separator character on the ISA record? The names of the fields in the TA1 record are a bit generic, but the GS record looks easy to understand. Pretending that the vertical bar is the separator:
GS|fld2|PayerID|fld4|date YYYYMMDD|time HHMMSS|GroupCtl
Do you see something like this?
Is there a separator at the end of the line?
What characters are the field separators? (DSPF F10 to view in hex) What characters are the line endings?
--
--buck
Visit wiki.midrange.com and register for an account. Edit a page that helps you, and because it's public, you'll help someone else, too!
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at
http://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
________________________________
This communication may contain confidential Protected Health Information. This information is intended only for the use of the individual or entity to which it is addressed. The authorized recipient of this information is prohibited from disclosing this information to any other party unless required to do so by law or regulation and is required to destroy the information after its stated need has been fulfilled.
If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or action taken in reliance on the contents of these documents is strictly prohibited by federal law. If you have received this information in error, please notify the sender immediately and arrange for the return or destruction of these documents.
As an Amazon Associate we earn from qualifying purchases.