Don,

Please don't reply to an existing thread when you want to start a new discussion.. I nearly missed your message because it's a reply to a Kelly Cookson message that I didn't read.

Also, your question doesn't seem related to web... so would be more appropriate on Midrange-L

Also, it's not clear what sort of a log you're looking for? Why would there be a log of this?

You mention that you're using SCP because you have only one file to transfer -- please be aware that SCP is capable of transferring multiple files at once, this is not a reason to choose SCP or SFTP, both can do multiple files. The advantage to SFTP is that it can do other things like delete, rename, etc. SCP can only copy files, nothing else, it can't do those other things. The advantage to SCP is that it's simpler.

-SK




On 8/27/2015 11:18 PM, Don Brown wrote:
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
SCP or SFTP.
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 */
GetProfile('*CURRENT':'*NOPWD':OrigUser:dsEC);
GetProfile('SFTPUSER':'*NOPWD':SftpUser:dsEC);
SetProfile(SftpUser:dsEC)

/* Set environment variable for output file name */
cmd = 'ADDENVVAR ENVVAR(QIBM_QSH_CMD_OUTPUT) +
VALUE(''FILE=/qsys.lib/xapdta.lib/poslogpf.file/poslogpf.mbr'') +
REPLACE(*YES)';
ExecCmd(cmd:cmdlen);

/*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''' ' +

''''/home/sftpuser/CCL-B-20150808a.csv''')';
ExecCmd(cmd:cmdlen);


Thank you for your assistance.



Don Brown



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.