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



Thanks Kevin

-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of Kevin Bucknum
Sent: Friday, November 27, 2020 9:38 AM
To: midrange-l@xxxxxxxxxxxxxxxxxx
Subject: Re: SFTP Script halting

Try putting a dash in front of your put commands.

-put crd*.txt

From the man page on linux:

-b batchfile
Batch mode reads a series of commands from an input batchfile instead of stdin. Since it lacks user interaction it should be used in conjunction with non-interactive authentica‐
tion to obviate the need to enter a password at connection time (see sshd(8) and ssh-keygen(1) for details).

A batchfile of ‘-’ may be used to indicate standard input. sftp will abort if any of the following commands fail: get, put, reget, reput, rename, ln, rm, mkdir, chdir, ls, lchdir,
chmod, chown, chgrp, lpwd, df, symlink, and lmkdir.

Termination on error can be suppressed on a command by command basis by prefixing the command with a ‘-’ character (for example, -rm /tmp/blah*). Echo of the command may be sup‐
pressed by prefixing the command with a ‘@’ character. These two prefixes may be combined in any order, for example -@ls<mailto:-@ls> /bsd.


On Fri, 2020-11-27 at 14:35 +0000, 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




[https://www.medtronsoftware.com/img/MedtronMinilogo.bmp] Kevin Bucknum
Senior Programmer Analyst
MEDDATA / MEDTRON
120 Innwood Drive
Covington LA 70433
Local: 985-893-2550
Toll Free: 877-893-2550
https://www.medtronsoftware.com



CONFIDENTIALITY NOTICE

This document and any accompanying this email transmission contain confidential information, belonging to the sender that is legally privileged. This information is intended only for the use of the individual or entity named above. The authorized recipient of this information is prohibited from disclosing this information to any other party and is required to destroy the information after its stated need has been fulfilled. If you are not the intended recipient, or the employee of agent responsible to deliver it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or action taken in reliance on the contents of these documents is STRICTLY PROHIBITED. If you have received this email in error, please notify the sender immediately to arrange for return or destruction of these documents.

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.