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



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

Follow-Ups:
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.