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



Here is an example of one I used to use to get a file from the iSeries,
encrypt it, and send it back. We have since moved gpg into the pase and
don't use this method anymore, but it may give you some ideas.

Batch file on the PC:
@ECHO OFF
REM Televox encyrption script

REM Do some setup
cd c:\gnupg
if exist aptbk del aptbk
if exist televox.asc del televox.asc

REM Parms are used to control access and determine where to get the
files.
REM %1 is USER on the iSeries.
REM %2 is PASSWORD for that user.
REM %3 is Library to get the file from and send it to.
REM %4 is IP address to connect to.

Echo Getting the file from the iSeries
REM Build the script - Download
if exist script.ftp del script.ftp
script.ftp ECHO open %4
script.ftp ECHO %1
script.ftp ECHO %2
script.ftp ECHO CD %3
script.ftp ECHO ascii
script.ftp ECHO get aptbk
script.ftp ECHO quit

REM Run the script to download and encrypt the file.
ftp -v -s:C:\gnupg\script.ftp > ftp.log
Echo Encrypting the file
gpg -ar ASP@xxxxxxxxxxx -e --batch -o televox.asc aptbk

Echo Sending encyrpted file to the iSeries
REM Build the script - Upload
if exist script.ftp del script.ftp
script.ftp ECHO open %4
script.ftp ECHO %1
script.ftp ECHO %2
script.ftp ECHO CD %3
script.ftp ECHO ascii
script.ftp ECHO put televox.asc
script.ftp ECHO quit

REM Run the upload.
ftp -v -s:C:\gnupg\script.ftp > ftp.log

if exist aptbk del aptbk
if exist televox.asc del televox.asc
if exist script.ftp del script.ftp
if exist ftp.log del ftp.log

Calling it from the iSeries:
CHGVAR VAR(&CMD) VALUE('C:\GNUPG\TELEVOX.BAT ' *CAT +
&USERPC *CAT ' ' *CAT &PASSWORDPC *CAT ' +
' *CAT &CURLIB *CAT ' ' *CAT &IPADDRPC)
STRPCCMD PCCMD(&CMD) PAUSE(*NO)

Fill in the variables with the information you need.

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Lim Hock-Chai
Sent: Thursday, November 29, 2007 9:06 AM
To: RPG programming on the AS400 / iSeries
Subject: RE: Send_File API versus Send API over a Socket

Since we are at this topic, I wonder what would be the best method to
handle a business requirement where user wants to be able to press a
command key on a green screen that will allow him to save a AS400 DB
file on his/her workstation in csv format?

Since FTP, HTTP.. server does not usually run on user's pc, I'm
assuming
that FTP, HTTP will not work under this requirement.

I thinking instead of green screen app doing a ftp put, maybe it can
just run a remote pc command of ftp get. However, I'm not sure how to
handle AS400 login and how to run a ftp script using remote pc
command.

Just wonder, not that I need it.




-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Wednesday, November 28, 2007 5:55 PM
To: RPG programming on the AS400 / iSeries
Subject: Re: Send_File API versus Send API over a Socket

Hi Walden,

I agree with your opinion that it doesn't make sense to write your own
proprietary file transfer protocol when there are so many good ones
already available. Why re-invent the wheel?

Having said that, there are situations (albeit, rare ones) where
something custom designed makes sense. FTP, NFS and SMB (and SFTP as
well) are NOT program-to-program communications, they're "program to
file system" communications which are not suitable in many cases.
HTTP
does offer a nice option for program to program -- but the stateless
nature isn't suitable for every purpose under the sun. So there are
rare occasions where it makes sense to design you own tool.

I TOTALLY disagree with your assessment that RPG is a bad language to
do
system-level stuff. Although it wasn't really designed for it, todays
RPG language is a great language for some kinds of lower-level
programming. I'm sorry, but C requires too much work to get the job
done a lot of the time, and RPG is certainly more suitable to system
level stuff than Cobol, CL, Java, or PHP.

On that score, I come from a position of experience... i write a lot
of
lower-level stuff in both RPG and C, and I find RPG easier. Granted,
I
don't go all the way down to the hardware level, but neither is
Shannon
in this situation...



Walden H. Leverich wrote:
Shannon,

"custom code", "because my manager said so" and all that jazz aside,
you realize you're attempting to re-write some very basic file
handing

code in a language that wasn't designed to do system-level stuff,
right?

Given that you can use FTP, NFS, HTTP, SMB, and probably 7 or 8
other
existing, coded, tested, trusted protocols for transferring a file
between two machines, why the heck would you even consider writing
your own?

Seriously!? Not trying to be a pain.

-Walden


--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.


--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



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.