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



So, in my brilliance here, I'm not actually setting errno to anything and then displaying it as an error without knowing anything but the PASE call returned non-zero? Wow. I wonder how that happened? Let me go play with that a bit. Thanks!
--
Sean Porterfield


-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Peter Dow
Sent: Thursday, August 16, 2012 15:35
To: Midrange Systems Technical Discussion
Subject: Re: sftp error in batch when no files to transfer

Hi Sean,

Maybe you should change things a bit:

Result = Qp2RunPase( SHELL_PGM...)

then check the result (see
http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=%2Fapis%2Fqp2runpase.htm)
<http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=%2Fapis%2Fqp2runpase.htm>

And check the value of errno.

Also, look at stderr. I'd be interested myself to know where stderr output goes when a PASE script is called from RPGLE. Maybe an ovrprtf?

--
*Peter Dow* /
Dow Software Services, Inc.
909 793-9050
petercdow@xxxxxxxxx <mailto:petercdow@xxxxxxxxx> /


On 8/16/2012 11:18 AM, Porterfield, Sean wrote:
This may end up being an RPG question, but it starts with sftp in PASE. I have a scheduled download that runs a shell script which is just a batch sftp retrieve and delete. I put in a check in case there is an error (host not found, bad login, etc.) but apparently the shell script ends in error if there are no files to retrieve. In its current state, my program ends due to the error. Ordinarily, that's probably not a big deal. If, however, I have files that have been downloaded but not processed, they cannot get processed because the program ends after the sftp shell script.


If Qp2RunPase( SHELL_PGM
: *NULL
: *NULL
: 0
: 819
: argv
: envp ) <> 0;
// Error on sftp command
EscErrno(errno);
Else;
// Process files
endif;

This manifests as the following in my joblog:

From procedure . . . . . . : ESCERRNO
Statement . . . . . . . . . : 3042100
Message . . . . : Text not available for message CPE0000 file QCPFMSG.
Recovery . . . : Add the message description (ADDMSGD) to the message file.
If this is an inquiry message and you need to reply to it, attempt to enter
a valid reply (if you know what it is for this message ID). Otherwise, enter
*N for the system default, or delete the message and the system default will
be sent.

It's not much of a useful error message. It's exactly the same if the error is "Permission denied (publickey,password)."

Is there a way to get a more meaningful error that I can then check in the program? It might be that expect is the answer, though I am not well versed in it. Either that or just ignore the error and hope for the best, but that doesn't sound great either.
--
Sean Porterfield


This email is confidential, intended only for the named recipient(s) above and may contain information that is privileged. If you have received this message in error or are not the named recipient(s), please notify the sender immediately and delete this email message from your computer as any and all unauthorized distribution or use of this message is strictly prohibited. Thank you.

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.