Try this in your cl. Also I believe it is case sensitive so SFTP is not
the same as sftp.

CHGVAR VAR(&TOFILE) VALUE('/home/' *TCAT &USER +
*TCAT '/ftpscript.txt')

CHGVAR VAR(&CMD) VALUE('/QOpenSys/bin/sftp' *BCAT +
'-b' *BCAT &tofile *BCAT &login)

/* Invoke QSHELL to run SFTP script */

CALL PGM(QP2SHELL) PARM('/QOpenSys/usr/bin/-sh' +
'-c' &CMD)

Vilena


message: 1
date: Wed, 5 May 2010 10:12:20 -0400
from: "Versfelt, Charles" <CVERSFELT@xxxxxxxxx>
subject: SFTP in batch


Hi,

I now have SFTP working interactively but am having issues making it
work in batch.

I am able to do the SFTP when done step by step. (call QPTERM, then
SFTP)

The following command also works when run from a command line (or placed
in a CL program which is called from a command line.)

QSH CMD('/QOpenSys/bin/sftp -b/home/CHARLIE/sftpcmd.txt
tsu8v5s6@xxxxxxxxxxxxxx')


That command doesn't work in batch though.

(In all these attempts, I'm signed on the same way when submitting the
job in batch as I was signed on when I ran it interactively.)

Spool file says
qsh: 001-0012 Error found starting child process. System resources not
available to complete request.


Batch Attempt 2:
I checked Scott Klement's article entitled "The SSH, SCP, and SFTP Tools
from OpenSSH" and found the batch method which uses a different command.

I set this up in my CL program, per that documentation.

DCL VAR(&CMD) TYPE(*CHAR) LEN(1000)

CHGVAR VAR(&CMD) VALUE('SFTP -B +
/home/charlie/sftpcmd.txt +
tsu8v5s6@xxxxxxxxxxxxxx')

CALL PGM(QP2SHELL) PARM('/QOpenSys/usr/bin/sh' '-c' &CMD)

I submit the job, and I get this error in the resultant spool file.
/QOpenSys/usr/bin/sh: SFTP: not found.

Batch attempt 3:

I noticed that the path to the command was different in my QSH command
that worked interactively.

/QOpenSys/bin/sftp instead of /QOpenSys/usr/bin/sh

So I decided to try that path in my batch call to QP2SHELL.

I changed my CL program to use this call to QP2SHELL:

CALL PGM(QP2SHELL) PARM('/QOpenSys/bin' '-c' &CMD)

This time, the job blew up with the following error, which I dumped.

CPFB9C0 received by FTPSNDECK3 at 4300. (C D I R)
Reply . . : D

Additional Message Information


Message ID . . . . . . : CPDB9F0 Severity . . . . . . . : 30

Message type . . . . . : Diagnostic

Date sent . . . . . . : 05/05/10 Time sent . . . . . . :
09:19:04


Message . . . . : Not authorized to i5/OS PASE program /QOpenSys/bin.

Cause . . . . . : You must have execute authority for the file and
every
directory in the path. You may also need read authority to the file if
it is
on a remote file system or a local file system other than the root
file
system or QOpenSys file system.

Recovery . . . : Verify that you have read and execute authority to
the
file, and execute authority to all directories in the path, then try
the
request again.

Technical description . . . . . . . . : The error occurred loading
Portable
Application Solutions Environment program /QOpenSys/bin.


I have been going back and forth with my operations manager. He has
tried granting authority to every file in the directory as far as he can
determine, but has so far the attempts have been unsuccessful and the
authority message comes up every time.
Is there something we're missing?

I also do not understand why the path in the documentation is different
than the path that seems to find the program, but doesn't seem to have
authority to it.

Charles Versfelt






As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.