On 7/20/2016 11:07 AM, Fuchs, James M wrote:
I am at a loss. Have an Awk script that I need to run in the QSH/QShell environment but it will not run to completion.
The AWK script runs without issue if I run it on a PC but when I run it on the AS400 in QShell it only processes/recognizes the first pattern match.
I have tried everything I can think of but being new to both Awk and QShell have no clue where to look for clues as to what is wrong.

The AWK script file was written by a former colleague and has been running without issue on a PC environment for several years. Due to changes within the company, however, we need to move the processing onto the AS400 and out of the PC scripted process it has been running in.

One of the AWK script files is below. There are multiple scripts that all do basically the same processing and are structured similarly. I am also getting the same process results on all of them....

BEGIN {
if (ARGC > 2) {
InputFile = ARGV[1];
OutputFile = ARGV[2];
ARGV[2] = "";
} else {
print("Output file name not specified.");
OutputFile = "Nul";
}
if (ARGC > 3) {
sep = ARGV[3];
RS = sep "|" sep "\n|" sep "\r\n";
ARGV[3] = "";
} else {
RS = "~|~\n|~\r\n|\n|\r\n|\32+"; # Input Record Separator
}

-snip-

A quick look but I didn't see a reference to either InputFile or RS.
I don't have AWK in QSh but I do have one in PASE (for what that's
worth) IBM i 7.2 Look at the CCSID of the file you are trying to
process (WRKLNK will do). Is it ASCII or is it EBCDIC?


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.