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



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


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.