×
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.
Reposted to Midrange L (Originally incorrectly posted on Web400)
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 the download of the file working But I am unable to get any logging
from the transfer.
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''' ' +
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. DB Thanks will not do in the
future.
Also, your question doesn't seem related to web... so would be more
appropriate on Midrange-L DB I have reported 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?
DB I thought by specifying the environment variable QIBM_QSH_CMD_OUTPUT
and
requesting verbose logging on the scp command I would get a detail log of
the transfer.
If a transfer fails i would like to know why, rather than just monitoring
for a failure message.
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
DB Reading between the lines I think either scp or sftp would be suitable
for my requirement.
I also think that either would provide suitable logging if I can determine
why I am not getting anything.
Is there any way to debug not getting a log after setting the environment
variable ?
As an Amazon Associate we earn from qualifying purchases.
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.