Since the sftp ssh and scp are all "ported" from AIX, you might want to look at the AIX documentation to see what is available.


Don Brown wrote on 8/28/2015 12:18 AM:
Could someone assist in my understanding of what logging is available when
running Secure File Transfer..

First, what am I trying to do ?
I need to establish a secure connection to a bank and download file(s) on
a daily basis. If the download fails or succeeds I want a program to be
able to record a log of what happened.

I have created user: SFTPUSER
I have generated my rsa keys and the public key sent to the bank
I can successfully connect and transfer files between the bank and the 400
- Both interactively and in Batch
I have not been able to generate a log for any transfers.

As the process can be run by a number of different users I am switching
user profile to SFTPUSER (see sample code below)

I am setting the environment variable QIBM_QSH_CMD_OUTPUT assigning a log
output file

I am now using the QSH command, previously I was using a call to QP2SHELL
to run SCP
With the amount I have read I am now more confused if I should be using
I am using SCP as there is only a single file to be transferred at a time
and therefore saw no need to create a script file - Do I have to use a
script file to get a log ? and then use SFTP instead of SCP ?

I know I can use environment variable QIBM_QSH_CMD_ESCAPE_MSG to enable an
*Escape message to be sent if the transfer fails and I can monitor for
this in my program BUT this does not provide a reason for the failure.

If someone could point me in the right direction or has a working sample
it would really be appreciated.

Sample/Sudo code
d GetProfile PR extpgm('QSYGETPH')
d UserID 10A const
d Password 10A const
d Handle 12A
d ErrorCode 32766A options(*varsize)

d SetProfile PR extpgm('QWTSETP')
d Handle 12A
d ErrorCode 32766A options(*varsize)

d RlsProfile PR extpgm('QSYRLSPH')
d Handle 12A
d ErrorCode 32766A options(*varsize)

d ExecCmd PR extpgm('QCMDEXC')
d cmd 265 options(*varsize) const
d cmdlen 15p 5 const

/* Retrieve user profile handles and switch to SFTPUSER */

/* Set environment variable for output file name */
VALUE(''FILE=/qsys.lib/xapdta.lib/poslogpf.file/poslogpf.mbr'') +

/*Retrieve file from the bank */
cmd = 'QSH CMD('''
'/QOpenSys/QIBM/ProdData/SC1/OpenSSH/openssh-4.7p1/bin/scp''' ' +
'''-B'' ' +
'''-v'' ' +
''''-i /home/sftpuser/.ssh/id_rsa''' ' +
''''BANKUSER@xxxxxxxxxxxxxxx:/IN/CCL-B-20150808.csv''' ' +


Thank you for your assistance.

Don Brown

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2020 by 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].