× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Here/attached is the full file - it looks like the email service may have clipped off the rest of the script.

Output file is referenced for a redirected print line. Inputfile is not referenced internal to the script, but, from putting in print statements and running it is reading the input file. Also based on the fact that the pattern match works on the first pattern /^ISA/ but not any of the subsequent patterns.

-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Buck Calabro
Sent: Wednesday, July 20, 2016 10:37 AM
To: midrange-l@xxxxxxxxxxxx
Subject: Re: Awk script running in QShell

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?

--
--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.

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.