From: Howard Brazee on
On Wed, 26 May 2010 04:14:36 -0700 (PDT), jmoore <jmoore207(a)gmail.com>
wrote:

>Thanks for all the ideas!! I did go back and fix the opens and closes

Nice of you to say so - but did you have to quote hundreds of lines
first?

--
"In no part of the constitution is more wisdom to be found,
than in the clause which confides the question of war or peace
to the legislature, and not to the executive department."

- James Madison
From: Doug Miller on
In article <864sekFpucU1(a)mid.individual.net>, "Pete Dashwood" <dashwood(a)removethis.enternet.co.nz> wrote:
><snip>
>>> I contend that in this case the former is more applicable than the
>>> latter, because if he does what I suggested he will be no worse off
>>> than if he does nothing. In other words, it can "do no harm".
>>
>> Please explain why you believe that suppressing all diagnostic output
>> from a running program "does no harm".
>
>OK. I don't think that to be the case in every situation, but I do in this
>one.
>
>My opinion is based on the transcript of his program run, which he posted in
>the original post. Here it is again:
>
>========================================================
>SEDC Main 9K:noitems $ run pub/
>slaudit
>05/25/10 BEGIN SECURITY LIGHT AUDIT 09:19 AM
>
>DO YOU WISH TO RUN THIS PROGRAM? Y/N/S/E
>Y
>NO QUALIFYING RECORDS FOUND
>
>coblp: empty output, no spoolfile created for
>
>05/25/10 END SECURITY LIGHT AUDIT 09:19 AM
>
>================================================
>
>As you can see, there is ONE system error message and I assumed this would
>be written to STDERR, the other messages, being generated by COBOL ACCEPT
>and DISPLAY, would be written to STDOUT.
>
>(Yes, I knew there could be other system messages but in the instance given,
>there aren't.)

And you assumed that there *can't* be, won't *ever* be, any other messages.

That is a fundamentally flawed assumption.

You have *no idea* what types of exception conditions might occur when this
program is run. Suppressing stderr is acceptable only if you know, in advance,
that this specific exception condition _and no other_ exists.
[...]
>>
>> Sorry, but that's just flat wrong. If all errors are suppressed,
>> there is no indication that anything failed.
>
>Generally that may be true. In this case, it isn't.

Nonsense; of course it is. What indication of failure do you imagine might be
present if all error messages are suppressed?
>
>
>> Failure is externally
>> indistinguishable from
>> success. Other jobs may be run, based on the mistaken belief that
>> this one
>> succeeded. *Much* harm can result.
>
>Not when the application says it has ended, and cannot say that unless it
>has run to completion.

What planet do you live on, where every program that runs to completion does
so every time without encountering any errors? Redirecting stderr to dev/null
will discard *all* error messages, including those relating to non-fatal
errors. I repeat, this is *not* desirable behavior.
>
>All of my response was based on what he posted, not on things in general.

Your response was not based at all on what he posted, but rather on some very
precarious assumptions you made about what he did *not* post.
>
>
>>>
>>> I think you are underestimating your own capacity to help, Doug.
>>
>> And I think you're overestimating yours.
>
>Hardly. I made very clear my own limitations in this arena and I still
>believe you could have provided a better solution.

I certainly could have, seven years ago, when I was writing Unix shell scripts
every day. But I don't do that now, so I'm not exactly up to par. And it's
waaaaay off topic here anyhow.
>
>Perhaps we can agree that the BEST course was to go to the Unix forum.
>Unfortunately, that wasn't suggested until AFTER I had posted my attempt,
>and then only in response to it. I confess, I never thought of that because
>I didn't know the forum existed. Like I said, I claim no expertise in Unix.
>
>Nevertheless, if I hadn't posted anything, you wouldn't have posted
>anything, and there would have been no solution, good, bad, or
>indifferent... :-)

Another incorrect assumption on your part, I'm afraid. Your response had
already propagated before I saw any of the thread; if I had seen only the
original post, I would have responded to that with much the same suggestion.
As it is, though, I read the entire thread before responding to any of it. The
reason I responded to your post, instead of the original, is that the method
you proposed is demonstrably flawed.
From: Fred Mobach on
Pete Dashwood wrote:

> jmoore wrote:
>> On May 25, 9:18 am, jmoore <jmoore...(a)gmail.com> wrote:
>>> I have a program that was written in a weird structure. I was
>>> wondering if anyone knew a way to call unix to suppress an error
>>> message if the cobol print file is empty.
>>>
>>> SEDC Main 9K:noitems $ run pub/
>>> slaudit
>>> 05/25/10 BEGIN SECURITY LIGHT AUDIT 09:19 AM
>>>
>>> DO YOU WISH TO RUN THIS PROGRAM? Y/N/S/E
>>> Y
>>> NO QUALIFYING RECORDS FOUND
>>>
>>> coblp: empty output, no spoolfile created for
>>>
>>> 05/25/10 END SECURITY LIGHT AUDIT 09:19 AM
>>>
>>> I need to compress the coblp message if the print-file is empty. Any
>>> help would be appreciated. Thank you!
>>
>> Sorry I meant suppress
>
> redirect STDERR to the bit bucket... like this:
>
> SEDC Main 9K:noitems $ run pub/slaudit 2> /dev/null

Or, more specific, remove that one message with grep -v :
SEDC Main 9K:noitems $ run pub/slaudit | grep -v 'coblp: empty output,
no spoolfile created for'
--
Fred Mobach - fred(a)mobach.nl
website : https://fred.mobach.nl
.... In God we trust ....
.. The rest we monitor ..
From: uno on
Fred Mobach wrote:

>> SEDC Main 9K:noitems $ run pub/slaudit 2> /dev/null
>
> Or, more specific, remove that one message with grep -v :
> SEDC Main 9K:noitems $ run pub/slaudit | grep -v 'coblp: empty output,
> no spoolfile created for'

Or, better
SEDC Main 9K:noitems $ run pub/slaudit 2>&1 | grep -v 'coblp: empty output,
no spoolfile created for'
From: Pete Dashwood on
uno wrote:
> Fred Mobach wrote:
>
>>> SEDC Main 9K:noitems $ run pub/slaudit 2> /dev/null
>>
>> Or, more specific, remove that one message with grep -v :
>> SEDC Main 9K:noitems $ run pub/slaudit | grep -v 'coblp: empty
>> output, no spoolfile created for'
>
> Or, better
> SEDC Main 9K:noitems $ run pub/slaudit 2>&1 | grep -v 'coblp: empty
> output, no spoolfile created for'

Thanks to both you and Fred for posting improved solutions.

(I also learned much from this thread :-))

Pete.

--
"I used to write COBOL...now I can do anything."