You can look at Scott Klement's website for using Expect and sFTP which
   relates to pExpect.
   BTW we are using RSA keys and not userid/passw for authentication.
   Jerry
   On 5/2/2022 10:02 AM, Alan Shore via MIDRANGE-L wrote:
 Thanks for your reply markus
 I will look into both of these suggestions
 Alan Shore
 Solutions Architect
 IT Supply Chain Execution
 [NHScsignaturelogo]
 60 Orville Drive
 Bohemia, NY 11716
 Phone [O] : (631) 200-5019
 Phone [C] : (631) 880-8640
 E-mail : [1]ASHORE@xxxxxxxxxxxxxxxxxxxx
 'If you're going through hell, keep going.'
 Winston Churchill
 From: MIDRANGE-L [[2]mailto:midrange-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of Jerry Draper
 Sent: Monday, May 2, 2022 1:00 PM
 To: Midrange Systems Technical Discussion [3]<midrange-l@xxxxxxxxxxxxxxxxxx>
 Subject: [EXTERNAL] Re: Checking for sftp errors
 We have done extensive error checking of sFTP routines.
 Our routines run in PASE (QP2BATCH) and are driven by a Python pgm using
 pExpect.
 This gives us granular control of all aspects of the sFTP session.
 We also utilize standard error for BASH errors.
 These routines are run from a CL wrapper so we get feedback as to any
 errors.
 Jerry
 On 5/1/2022 11:34 PM, Markus Neuhold via MIDRANGE-L wrote:
 I think the only real way is to query the (error) output of the sftp command ...
 Did you consider to forward the sftp (QSH command) errors to an IFS-file? Just add "2> /ifs/path/errors.txt" to the command in PASE.
 Or you can forward the QSH output to a file. Use Envvar QIBM_QSH_CMD_OUTPUT ([1][4]
https://www.ibm.com/docs/en/i/7.4?topic=qshell-running-commands-from-cl<
https://www.ibm.com/docs/en/i/7.4?topic=qshell-running-commands-from-cl>)
 Or you write a PASE shell script that handles your sftp and all the errors... ([2][5]
https://www.ibm.com/docs/en/i/7.4?topic=qshell-pdf-file<
https://www.ibm.com/docs/en/i/7.4?topic=qshell-pdf-file>)
 LG
 Markus
 -----Original Message-----
 From: MIDRANGE-L [3]<[6]midrange-l-bounces@xxxxxxxxxxxxxxxxxx<mailto:midrange-l-bounces@xxxxxxxxxxxxxxxxxx>> On Behalf Of Alan Shore via MIDRANGE-L
 Sent: Samstag, 30. April 2022 18:36
 To: [[7]4]midrange-l@xxxxxxxxxxxxxxxxxx[8]<mailto:midrange-l@xxxxxxxxxxxxxxxxxx>
 Cc: Alan Shore [5]<[9]ashore@xxxxxxxx<mailto:ashore@xxxxxxxx>>
 Subject: Checking for sftp errors
 Hi everyone
 Before I forget, we are on V7r3
 I have created a CLLE program using sftp to transfer files from an external system, into the iSeries This works on our development system This has now been transferred/promoted into our production system, but it is reporting that there are errors Looking at the log - the only thing that I can see is that (at this moment) there are no files to transfer. For the next month or so - that is possible The program creates a script (using mget), and upon execution of that script checks for error in the following way
 /* perform sftp */
 QSH CMD(&COMMAND)
 MONMSG MSGID(QSH0000) EXEC(DO)
 I realize that using QSH0000 is ALL encompassing, so my question is - does anyone have a "better" way of capturing sftp errors
 Alan Shore
 Solutions Architect
 IT Supply Chain Execution
 [NHScsignaturelogo]
 60 Orville Drive
 Bohemia, NY 11716
 Phone [O] : (631) 200-5019
 Phone [C] : (631) 880-8640
 E-mail : [[10]6]ASHORE@xxxxxxxxxxxxxxxxxxxx[11]<mailto:ASHORE@xxxxxxxxxxxxxxxxxxxx>
 'If you're going through hell, keep going.'
 Winston Churchill
 --
 This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: [[12]7]MIDRANGE-L@xxxxxxxxxxxxxxxxxx[13]<mailto:MIDRANGE-L@xxxxxxxxxxxxxxxxxx> To subscribe, unsubscribe, or change list options,
 visit: [8][14]
https://urldefense.com/v3/__https://lists.midrange.com/mailman/listinfo/midrange-l__;!!CqVFughQ-RE!gpAlaMfKjJHxs5_RWUiafJI2Wa4vKF9jCu5EBFRPDu7L0U-_FqeL6Hv2gjjtkDR6FyVKA2-xoIFt7B_JPQsgITOYkZwVSUk$<
https://urldefense.com/v3/__https://lists.midrange.com/mailman/listinfo/midrange-l__;!!CqVFughQ-RE!gpAlaMfKjJHxs5_RWUiafJI2Wa4vKF9jCu5EBFRPDu7L0U-_FqeL6Hv2gjjtkDR6FyVKA2-xoIFt7B_JPQsgITOYkZwVSUk$>
 or email: [[15]9]MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx[16]<mailto:MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx>
 Before posting, please take a moment to review the archives at [10][17]
https://urldefense.com/v3/__https://archive.midrange.com/midrange-l__;!!CqVFughQ-RE!gpAlaMfKjJHxs5_RWUiafJI2Wa4vKF9jCu5EBFRPDu7L0U-_FqeL6Hv2gjjtkDR6FyVKA2-xoIFt7B_JPQsgITOYEYQzYdI$<
https://urldefense.com/v3/__https://archive.midrange.com/midrange-l__;!!CqVFughQ-RE!gpAlaMfKjJHxs5_RWUiafJI2Wa4vKF9jCu5EBFRPDu7L0U-_FqeL6Hv2gjjtkDR6FyVKA2-xoIFt7B_JPQsgITOYEYQzYdI$> .
 Please contact [[18]11]support@xxxxxxxxxxxxxxxxxxxx[19]<mailto:support@xxxxxxxxxxxxxxxxxxxx> for any subscription related questions.
 Help support midrange.com by shopping at amazon.com with our affiliate link: [12][20]
https://urldefense.com/v3/__https://amazon.midrange.com__;!!CqVFughQ-RE!gpAlaMfKjJHxs5_RWUiafJI2Wa4vKF9jCu5EBFRPDu7L0U-_FqeL6Hv2gjjtkDR6FyVKA2-xoIFt7B_JPQsgITOYgJK5PkA$<
https://urldefense.com/v3/__https://amazon.midrange.com__;!!CqVFughQ-RE!gpAlaMfKjJHxs5_RWUiafJI2Wa4vKF9jCu5EBFRPDu7L0U-_FqeL6Hv2gjjtkDR6FyVKA2-xoIFt7B_JPQsgITOYgJK5PkA$>
 --
 Jerry Draper, Trilobyte Software Systems, since 1976
 IBM I, Network, and Connectivity Specialists, LAN/WAN/VPN
 Representing WinTronix, Synapse, HiT, and others .....
 (415) 457-3431 . [13]www.trilosoft.com[21]<
http://www.trilosoft.com>
 References
 Visible links
 1. [22]
https://www.ibm.com/docs/en/i/7.4?topic=qshell-running-commands-from-cl<
https://www.ibm.com/docs/en/i/7.4?topic=qshell-running-commands-from-cl>
 2. [23]
https://www.ibm.com/docs/en/i/7.4?topic=qshell-pdf-file<
https://www.ibm.com/docs/en/i/7.4?topic=qshell-pdf-file>
 3. [24]mailto:midrange-l-bounces@xxxxxxxxxxxxxxxxxx
 4. [25]mailto:midrange-l@xxxxxxxxxxxxxxxxxx
 5. [26]mailto:ashore@xxxxxxxx
 6. [27]mailto:ASHORE@xxxxxxxxxxxxxxxxxxxx
 7. [28]mailto:MIDRANGE-L@xxxxxxxxxxxxxxxxxx
 8. [29]
https://urldefense.com/v3/__https://lists.midrange.com/mailman/listinfo/midrange-l__;!!CqVFughQ-RE!gpAlaMfKjJHxs5_RWUiafJI2Wa4vKF9jCu5EBFRPDu7L0U-_FqeL6Hv2gjjtkDR6FyVKA2-xoIFt7B_JPQsgITOYkZwVSUk$<
https://urldefense.com/v3/__https://lists.midrange.com/mailman/listinfo/midrange-l__;!!CqVFughQ-RE!gpAlaMfKjJHxs5_RWUiafJI2Wa4vKF9jCu5EBFRPDu7L0U-_FqeL6Hv2gjjtkDR6FyVKA2-xoIFt7B_JPQsgITOYkZwVSUk$>
 9. [30]mailto:MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
 10. [31]
https://urldefense.com/v3/__https://archive.midrange.com/midrange-l__;!!CqVFughQ-RE!gpAlaMfKjJHxs5_RWUiafJI2Wa4vKF9jCu5EBFRPDu7L0U-_FqeL6Hv2gjjtkDR6FyVKA2-xoIFt7B_JPQsgITOYEYQzYdI$<
https://urldefense.com/v3/__https://archive.midrange.com/midrange-l__;!!CqVFughQ-RE!gpAlaMfKjJHxs5_RWUiafJI2Wa4vKF9jCu5EBFRPDu7L0U-_FqeL6Hv2gjjtkDR6FyVKA2-xoIFt7B_JPQsgITOYEYQzYdI$>
 11. [32]mailto:support@xxxxxxxxxxxxxxxxxxxx
 12. [33]
https://urldefense.com/v3/__https://amazon.midrange.com__;!!CqVFughQ-RE!gpAlaMfKjJHxs5_RWUiafJI2Wa4vKF9jCu5EBFRPDu7L0U-_FqeL6Hv2gjjtkDR6FyVKA2-xoIFt7B_JPQsgITOYgJK5PkA$<
https://urldefense.com/v3/__https://amazon.midrange.com__;!!CqVFughQ-RE!gpAlaMfKjJHxs5_RWUiafJI2Wa4vKF9jCu5EBFRPDu7L0U-_FqeL6Hv2gjjtkDR6FyVKA2-xoIFt7B_JPQsgITOYgJK5PkA$>
 13. [34]
http://www.trilosoft.com/<
http://www.trilosoft.com>
 --
 This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
 To post a message email: [35]MIDRANGE-L@xxxxxxxxxxxxxxxxxx<mailto:MIDRANGE-L@xxxxxxxxxxxxxxxxxx>
 To subscribe, unsubscribe, or change list options,
 visit: [36]
https://lists.midrange.com/mailman/listinfo/midrange-l<
https://lists.midrange.com/mailman/listinfo/midrange-l>
 or email: [37]MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx<mailto:MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx>
 Before posting, please take a moment to review the archives
 at [38]
https://archive.midrange.com/midrange-l<
https://archive.midrange.com/midrange-l>.
 Please contact [39]support@xxxxxxxxxxxxxxxxxxxx<mailto:support@xxxxxxxxxxxxxxxxxxxx> for any subscription related questions.
 Help support midrange.com by shopping at amazon.com with our affiliate link: [40]
https://amazon.midrange.com<
https://amazon.midrange.com>
 --
 Jerry Draper, Trilobyte Software Systems, since 1976
 IBM I, Network, and Connectivity Specialists, LAN/WAN/VPN
 Representing WinTronix, Synapse, HiT, and others .....
 (415) 457-3431 . [41]www.trilosoft.com
References
   Visible links
   1. mailto:ASHORE@xxxxxxxxxxxxxxxxxxxx
   2. mailto:midrange-l-bounces@xxxxxxxxxxxxxxxxxx
   3. mailto:midrange-l@xxxxxxxxxxxxxxxxxx
   4. 
https://www.ibm.com/docs/en/i/7.4?topic=qshell-running-commands-from-cl
   5. 
https://www.ibm.com/docs/en/i/7.4?topic=qshell-pdf-file
   6. mailto:midrange-l-bounces@xxxxxxxxxxxxxxxxxx
   7. mailto:4]midrange-l@xxxxxxxxxxxxxxxxxx
   8. mailto:midrange-l@xxxxxxxxxxxxxxxxxx
   9. mailto:ashore@xxxxxxxx
  10. mailto:6]ASHORE@xxxxxxxxxxxxxxxxxxxx
  11. mailto:ASHORE@xxxxxxxxxxxxxxxxxxxx
  12. mailto:7]MIDRANGE-L@xxxxxxxxxxxxxxxxxx
  13. mailto:MIDRANGE-L@xxxxxxxxxxxxxxxxxx
  14. 
https://urldefense.com/v3/__https://lists.midrange.com/mailman/listinfo/midrange-l__;!!CqVFughQ-RE!gpAlaMfKjJHxs5_RWUiafJI2Wa4vKF9jCu5EBFRPDu7L0U-_FqeL6Hv2gjjtkDR6FyVKA2-xoIFt7B_JPQsgITOYkZwVSUk$
  15. mailto:9]MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
  16. mailto:MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
  17. 
https://urldefense.com/v3/__https://archive.midrange.com/midrange-l__;!!CqVFughQ-RE!gpAlaMfKjJHxs5_RWUiafJI2Wa4vKF9jCu5EBFRPDu7L0U-_FqeL6Hv2gjjtkDR6FyVKA2-xoIFt7B_JPQsgITOYEYQzYdI$
  18. mailto:11]support@xxxxxxxxxxxxxxxxxxxx
  19. mailto:support@xxxxxxxxxxxxxxxxxxxx
  20. 
https://urldefense.com/v3/__https://amazon.midrange.com__;!!CqVFughQ-RE!gpAlaMfKjJHxs5_RWUiafJI2Wa4vKF9jCu5EBFRPDu7L0U-_FqeL6Hv2gjjtkDR6FyVKA2-xoIFt7B_JPQsgITOYgJK5PkA$
  21. 
http://www.trilosoft.com/
  22. 
https://www.ibm.com/docs/en/i/7.4?topic=qshell-running-commands-from-cl
  23. 
https://www.ibm.com/docs/en/i/7.4?topic=qshell-pdf-file
  24. mailto:midrange-l-bounces@xxxxxxxxxxxxxxxxxx
  25. mailto:midrange-l@xxxxxxxxxxxxxxxxxx
  26. mailto:ashore@xxxxxxxx
  27. mailto:ASHORE@xxxxxxxxxxxxxxxxxxxx
  28. mailto:MIDRANGE-L@xxxxxxxxxxxxxxxxxx
  29. 
https://urldefense.com/v3/__https://lists.midrange.com/mailman/listinfo/midrange-l__;!!CqVFughQ-RE!gpAlaMfKjJHxs5_RWUiafJI2Wa4vKF9jCu5EBFRPDu7L0U-_FqeL6Hv2gjjtkDR6FyVKA2-xoIFt7B_JPQsgITOYkZwVSUk$
  30. mailto:MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
  31. 
https://urldefense.com/v3/__https://archive.midrange.com/midrange-l__;!!CqVFughQ-RE!gpAlaMfKjJHxs5_RWUiafJI2Wa4vKF9jCu5EBFRPDu7L0U-_FqeL6Hv2gjjtkDR6FyVKA2-xoIFt7B_JPQsgITOYEYQzYdI$
  32. mailto:support@xxxxxxxxxxxxxxxxxxxx
  33. 
https://urldefense.com/v3/__https://amazon.midrange.com__;!!CqVFughQ-RE!gpAlaMfKjJHxs5_RWUiafJI2Wa4vKF9jCu5EBFRPDu7L0U-_FqeL6Hv2gjjtkDR6FyVKA2-xoIFt7B_JPQsgITOYgJK5PkA$
  34. 
http://www.trilosoft.com/
  35. mailto:MIDRANGE-L@xxxxxxxxxxxxxxxxxx
  36. 
https://lists.midrange.com/mailman/listinfo/midrange-l
  37. mailto:MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
  38. 
https://archive.midrange.com/midrange-l
  39. mailto:support@xxxxxxxxxxxxxxxxxxxx
  40. 
https://amazon.midrange.com/
  41. 
http://www.trilosoft.com/
As an Amazon Associate we earn from qualifying purchases.