David,

I sent this posting and it got rejected as a non-member but that email midrange-l@xxxxxxxxxxxxx is a member.

Wondering why.  I am sending from my home PC with that good member address.

J


Our need for 100% reliable sFTP transmissions led us to create a Python wrapper that uses pExpect to manage all  aspects of our sFTP jobs.


All parameters are stored in .json files so that creating a new instance is simple and we don't have to touch the wrapper.

Beyond that with file receive pgms we do byte count checks on what we get vs what was on the server.

For sending we either send to a "temp" folder or as a "dotted" file (hidden) and then rename it when complete to avoid a process grabbing an incomplete file.

It goes on.  Every time we got hosed we created a check.  Now we are comfortable.

Jerry

On 11/29/2020 10:07 AM, Steinmetz, Paul via MIDRANGE-L wrote:
Different but related issue.
If the file being SFTP is empty, and replace option is used, the transmission is stated successful, but the empty file does not replace the existing file on remote server.
Thus, I receive a call from remote vendor stating they did not receive today's file, file is equal to yesterday's file.

Anyone from the group experiencing this issue?

Paul

-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Sam_L
Sent: Sunday, November 29, 2020 12:26 PM
To: midrange-l@xxxxxxxxxxxxxxxxxx
Subject: Re: SFTP Script halting

How about putting one file at a time? I suppose there is a slight overhead on the connection, but maybe not noticeable?

Sam

On 11/27/2020 9:35 AM, Greg Wilburn wrote:
I have an SFTP script that is running within a CL program. It puts several transaction files on a server (these text files are created on the IFS by an RPG program).

I recently discovered that the script halts if one of the files is not present (put crd*.txt).

Is there any way around this? I'd like for the script to ignore the error and keep going - sometimes there are simply no transactions.

The CL looks like this:
CHGVAR VAR(&CMD) VALUE('/QOpenSys/usr/bin/touch ' *CAT &LOG)
STRQSH CMD(&CMD)
/* CHGVAR VAR(&SFTP) VALUE('/QOpenSys/usr/bin/sftp -vvv -b') */
CHGVAR VAR(&SFTP) VALUE('/QOpenSys/usr/bin/sftp -b')
CHGVAR VAR(&CMD) VALUE(&SFTP *BCAT '/home/' *CAT +
&USER *TCAT '/sftpput.txt' *BCAT &USER +
*TCAT '@coro-appli-01.ecritel.net > ' *TCAT &LOG +
*BCAT '2>&1')

STRQSH CMD(&CMD)

RCVMSG MSGTYPE(*COMP) MSGDTA(&MSGDTA) MSGID(&MSGID)
IF COND(&MSGID *NE 'QSH0005' *OR %BIN(&MSGDTA) +
*NE 0) THEN(DO)
SNDPGMMSG MSGID(CPF9897) MSGF(QCPFMSG) MSGDTA('SFTP +
script failed!') MSGTYPE(*ESCAPE)
ENDDO

The script looks like this:
cd customers
put cus*.txt
ls
cd
cd orders
put ord*.txt
ls
cd
cd invoices
put invoic*.txt
put crd*.txt
ls
cd
cd inventory
put invsit*.txt
put inttrx*.txt
ls
cd
cd payment
put paymen*.txt
ls
quit

This is the log
sftp> cd customers
sftp> put cus*.txt
sftp> ls
Save custom201126.txt
sftp> cd
sftp> cd orders
sftp> put ord*.txt
sftp> ls
Save orders201126.txt
sftp> cd
sftp> cd invoices
sftp> put invoic*.txt
stat invoic*.txt: No such file or directory

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com

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.