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



+1

-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of John Yeung
Sent: Thursday, March 19, 2015 10:28 AM
To: Midrange Systems Technical Discussion
Subject: Re: Finding Current Subsystem

On Thu, Mar 19, 2015 at 11:48 AM, Roger Harman <roger.harman@xxxxxxxxxxx> wrote:
And, I'll give a +9999 to Rob's "loving suggestion". Relying on parsing printed output is a fools game.

It's a game that is often played by fools, but not everyone who plays is a fool.

I once had a commercial package start failing a particular process after an OS upgrade. As I recall, they were looking at WRKDSKSTS *PRINT output to determine if an operation could run. When the spool file changed - kaboom - task failed every time.

Without looking at their code, I would have to guess that they just wrote it badly. Now, I'm not advocating putting spool-parsers into commercial packages if you can help it! I mean, if this is being released to the public, and to the *paying* public no less, then absolutely use an API if there's one available.

But I have seen APIs break from version to version too. And if your code relies on it, then it's REALLY broken. When you're parsing text robustly, it's OK if columns move a little here or there. If you're doing it really robustly, it's even OK if the order of the columns changes. Try shuffling the order of parameters in an API and see if there's ANYTHING you can do to cope with that.

Let me be clear: Usually it's more reliable to use APIs. Further, most spool-parsers are frankly not well written.

In part, it's because they usually don't have to be. They may be ad-hoc. But also, in part it's because most IBM i programmers (and especially AS/400 programmers!) either don't have or don't know about better techniques and tools. If your tool is CL, yeah, your spool parser is going to suck. If you are using RPG, then it *may* be decent, but most likely will also suck. The effort required to write a really robust spool parser in RPG is higher than the effort to just get the API calls right already. And yes, even with the absolute slickest and most bullet-proof text parsing in the world, the spooled output of a command could still change radically enough to break it.

So I *do* recommend using APIs over spool-parsing. But I hope people aren't dismissive of something just because they heard someone tell them a rule against it. I hope people understand what *actually* makes something a bad idea, and not confuse incidental or contributing factors with intrinsic ones.

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


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.