• No results found

Users Guide. FTP/400 File Transfer API and Remote Command Server Version By RJS Software Systems, Inc.

N/A
N/A
Protected

Academic year: 2021

Share "Users Guide. FTP/400 File Transfer API and Remote Command Server Version By RJS Software Systems, Inc."

Copied!
31
0
0

Loading.... (view fulltext now)

Full text

(1)

FTP/400 File Transfer API and Remote Command Server

Version 1.00

Users Guide

By RJS Software Systems, Inc.

RJS Software Systems P.O. Box 19408 Minneapolis, MN 55419 (612) 822-0412 Voice (612) 822-1364 Fax Email (Internet) [email protected] (WWW) http://www.rjssoft.com

(2)

ii

Copyright

© 1995-2000 by RJS Software Systems. All rights reserved. This manual and the software described in it are

copyrighted with all rights reserved. No part of this publication may be reproduced, transmitted, transcribed, stored in a retrieval system or translated into any language in any form by any means without the written permission of RJS Software Systems.

Trademarks

FTP/400™ is a trademark of RJS Software Systems. Brand names and product names are trademarks or registered trademarks of their respective companies.

(3)

FTP/400 Version 1.00 Users Guide Contents •• i

Contents

Overview

1

Introduction ... 1 Licensing Information ... 2 Technical Support... 2

For Technical Support with FTP/400... 2

Contact Information ... 2

Chapter 1: Installation

3

Introduction ... 3

AS/400 Prerequisites... 3

PC Prerequisites for FTP Remote Command Server ... 3

AS/400 Installation ... 3

AS/400 Installation Using RSTLIB command ... 3

AS/400 Installation Using FTP... 3

AS/400 Installation Using Shared Folders ... 3

AS/400 User Authorization Code Entry... 4

Entering FTP/400 Access Code ... 4

Entering FTP/400 Remote Command Server Access Code (Optional)... 4

Entering RJS Data Export Access Code (Optional) ... 4

Installing FTP Remote Command Server on the PC ... 4

Deinstallation of FTP/400 ... 5

Removing FTP/400 from an AS/400... 5

Removing RJS Data Export from an AS/400 ... 5

Chapter 2: Getting Started

7

Introduction ... 7

Installing the FTP/400 Software... 7

Overview of FTP/400 File Transfer API ... 7

Overview of FTP/400 Remote Command Server API ... 8

Sending a File via FTP... 8

Running a PC Command with FTPRUNPC... 10

PC Steps... 10

AS/400 Steps... 10

What’s Next ? ... 11

Chapter 3: Main Menu

13

Introduction ... 13

Getting to the Main Menu... 13

Available Options ... 14

Option 1 - Enter FTP/400 License Code ... 14

(4)

ii •• Contents FTP/400 Version 1.00 Users Guide

Option 3 – Transfer Files via FTP - FTPTFR... 14

Option 4 – Retrieve Current Session IP Address - FTPIP... 14

Option 5 – Send File from IFS Directory via FTP - FTPIFSSND ... 14

Option 6 – Send AS/400 Database in CSV Format via FTP - FTPDBSND ... 14

Option 7 – Run Job on Remote Windows based PC - FTPRUNPC ... 14

Chapter 4: AS/400 Commands

15

Introduction ... 15

FTPTFR: Send/Receive Files via FTP ... 15

Description... 15

Command Parameters ... 16

Remote system ... 16

Local file’s name... 16

Remote file’s name... 16

Local path to receive MGET... 16

Remote path to receive MPUT ... 16

Transfer function... 16

User profile on remote system ... 17

Password to remote system ... 17

AS/400 File Name Format... 17

Data Format ... 17

FTP Log Option ... 17

FTP Command(s) Before Transfer (1-3) ... 17

FTP Command(s) After Transfer (1-3) ... 17

FTPIFSSND: Send File from IFS Directory via FTP ... 18

Description... 18

Command Parameters ... 18

Remote system ... 18

From IFS file name ... 18

To remote file name ... 18

User profile on remote system ... 18

Password to remote system ... 19

Data Format ... 19

FTP Log Option ... 19

FTP Command(s) Before Transfer (1-3) ... 19

FTP Command(s) After Transfer (1-3) ... 19

Example command line using FTPIFSSND ... 19

FTPDBSND: Send AS/400 Database File via FTP ... 19

Description... 19

Command Parameters ... 20

Remote system ... 20

From file name/Library ... 20

To remote file name ... 20

User profile on remote system ... 20

Password to remote system ... 20

Data Format ... 20

FTP Log Option ... 21

FTP Command(s) Before Transfer (1-3) ... 21

FTP Command(s) After Transfer (1-3) ... 21

Example command line using FTPDBSND ... 21

FTPRUNPC: Run Job on Remote Windows Based PC... 21

Description... 21

(5)

FTP/400 Version 1.00 Users Guide Contents •• iii

Remote system... 22

PC Command to Run... 22

Run Options ... 23

Example command line using FTPRUNPC to Launch Windows Notepad ... 23

Example command line using FTPRUNPC to Set Windows Clipboard Data ... 23

Example command line using FTPRUNPC to Launch MS Word ... 24

Example command line using FTPRUNPC to Open Web Site... 24

FTPIP: Retrieve Current Session IP Address ... 24

Description ... 24

Command Parameters ... 24

Device ... 24

IP Address... 24

Chapter 5: Problem Handling

25

Common Errors ... 25

(6)
(7)

FTP/400 Version 1.00 Users Guide Overview •• 1

Overview

Introduction

The FTP/400 File Transfer API software is a native OS/400 API used to quickly send and receive AS/400 library members, shared folder documents or IFS files via FTP. Files can be sent to another AS/400, Windows NT Server, Unix/Linux server or any system that runs an FTP Server.

Since the FTP/400 product is command line based, FTP file processing can be embedded in any CL, RPG or COBOL program along with error checking and logging.

The FTP/400 software can be used with or without the AS/400 FTP Server running. This means that AS/400 shops that want to send/receive files from the AS/400 don't have to open up the AS/400 FTP Server to the Internet unless required.

If used with our DataExport/400 software, any AS/400 database file can be sent via FTP in CSV format, thus eliminating the translation issues usually associated with sending AS/400 database files that contain packed data fields.

Another optional component named FTP/400 Remote Command Server can be purchased to enabled FTP on any Windows 95/98/NT/2000 PC. The FTP/400 Remote Command Server product enables FTP/400 to be able to send/receive AS/400 files to any network or Internet attached PC.

The FTP/400 Remote Command Server isn’t just a PC-based FTP server. It contains an AS/400 command called FTPRUNPC which allows PC jobs to be run from the AS/400 command line. Listed below are some examples of how the FTP/400 Remote Command Server can be used.

The FTPRUNPC command can be used to:

Launch any PC based application such as MS Word, Excel, Web Browser, etc. by calling the program directly via the command line or by calling a document name and letting Windows determine which application to launch.

Launch a web browser to have it open the selected web link. This is great for adding web site integration into existing AS/400 applications. Green screen applications can have direct access to the web browser. Pop up a simple message box on the PC. This can be useful to visually notify users of AS/400 events. Directly launch MS Word or MS Excel using special *EXCEL and *WORD keywords.

(8)

2 •• Overview FTP/400 Version 1.00 Users Guide

Launch MS Word via OLE and perform selected data merge options. This is handy if you want to launch MS Word with a selected document template and have your AS/400 application pass information into the document or perform merge functions such as replacing text at selected bookmark locations in the template document. What a great way to replace Officevision/400.

Set clipboard information from the AS/400. This allows an AS/400 application to send information directly back to the PC clipboard for pasting into any PC application.

The uses for the FTPRUNPC command functionality are endless. Make sure to tell us how you’re going to use it.

Licensing Information

FTP/400 is licensed on a per AS/400 basis.

The license allows an unlimited number of users to access the software from one licensed AS/400 system.

Technical Support

For Technical Support with FTP/400

Because of the complexity of dealing with the various AS/400 connectivity environments, please gather and organize as much information as possible on the problem prior to contacting RJS Software Systems for support.

If you have a question about a FTP/400 operation, first browse through the user’s guide to try and find your answer prior to calling RJS Software Systems.

Contact Information

Telephone support is available from 9 AM to 5 PM Central Standard time on normal business days at:

(612) 822-0412 Voice (612) 822-1364 Fax

Support is also available via Internet Email at:

[email protected] (Internet) http://www.rjssoft.com (WWW)

(9)

FTP/400 Version 1.00 Users Guide Chapter 1: Installation •• 3

Chapter 1: Installation

Introduction

This section covers the installation of the FTP/400 software on the AS/400 system.

AS/400 Prerequisites

Before installing the FTP/400 software, you must make sure that you have TCP/IP connectivity turned on. If TCP/IP is not active, the FTP/400 software will not work.

PC Prerequisites for FTP Remote Command Server

TCP/IP must be running on the PC and the RJS FTP Remote Command Server must also be installed and running on the PC.

AS/400 Installation

This section includes instructions for restoring the FTP/400 AS/400 library.

AS/400 Installation Using RSTLIB command

Put the RJS CD into the AS/400 CD Drive and sign on to the AS/400 with a user ID that has security

officer authority.

Run the following AS/400 command to restore the FTP/400 library:

RSTLIB SAVLIB(RJSFTP) DEV(OPT01)

If you will be sending AS/400 database files in CSV format you will also need to restore the RJS Data Export library as well.

Run the following AS/400 command to restore the RJS Data Export library:

RSTLIB SAVLIB(RJSEXPORT) DEV(OPT01) OPTFILE('/RJSEXP')

AS/400 Installation Using FTP

This method of installation is described in the RJS Product Catalog.

AS/400 Installation Using Shared Folders

(10)

4 •• Chapter 1: Installation FTP/400 Version 1.00 Users Guide

AS/400 User Authorization Code Entry

Sign on to the AS/400 with a user ID that has security officer authority.

Entering FTP/400 Access Code

Add the RJSFTP library to the user library list by typing: ADDLIBLE RJSFTP and pressing Enter Go to the FTP/400 main menu by typing: GO RJSFTP and pressing Enter.

Take option 1 and enter the appropriate access codes listed on the access code sheet provided by RJS Software Systems.

If you have questions or problems with entering the access codes, contact RJS Software Systems for assistance.

Entering FTP/400 Remote Command Server Access Code (Optional)

Add the RJSFTP library to the user library list by typing: ADDLIBLE RJSFTP and pressing Enter Go to the FTP/400 main menu by typing: GO RJSFTP and pressing Enter.

Take option 2 and enter the appropriate access codes listed on the access code sheet provided by RJS Software Systems.

If you have questions or problems with entering the access codes, contact RJS Software Systems for assistance.

Entering RJS Data Export Access Code (Optional)

This code is only required if you want to send AS/400 database files as CSV attachments using the FTP/400 software.

Add the RJSEXPORT library to the user library list by typing: ADDLIBLE RJSEXPORT and pressing Enter

Type the following command and press Enter to prompt for the RJS Data Export access code:

PRDSEC SECURITY() DTAARA(RJSEXPORT) DTALIB(RJSEXPORT)

Type the access code and press Enter to save the access code entry.

If you have questions or problems with entering the access codes, contact RJS Software Systems for assistance.

Installing FTP Remote Command Server on the PC

The following steps should be used to install FTP Remote Command Server on a PC. 1. Start your PC and make sure Windows is running.

(11)

FTP/400 Version 1.00 Users Guide Chapter 1: Installation •• 5

3. Click the Windows Start button and select the Run menu. When the Run dialog is shown, type

D:\VB5RUN\SETUP.EXE and click the OK button to start the VB5 Runtime installation process. When

the installation program has started, follow the on screen instructions to complete the installation. Most of the time you should be able to simply use the default settings.

4. Click the Windows Start button and select the Run menu. When the Run dialog is shown, type

D:\RJSFTPSV\SETUP.EXE and click the OK button to start the RJS FTP Server installation process.

When the installation program has started, follow the on screen instructions to complete the PC installation. Most of the time you should be able to simply use the default settings.

5. After copying files, the Setup program will build a RJS FTP Server program group and notify you when it's done.

The RJS FTP Remote Command Server can now be launched from the RJS FTP Server program group.

Deinstallation of FTP/400

The following sections describe how to remove the FTP/400 software from an AS/400 system.

Removing FTP/400 from an AS/400

To remove FTP/400 from an AS/400, perform the following individual steps.

1. Make sure the RJSFTP library is not being used.

2. Delete the RJSFTP library from the AS/400 by entering a DLTLIB RJSFTP command from an

AS/400 terminal.

Removing RJS Data Export from an AS/400

To remove RJS Data Export from an AS/400, perform the following individual steps.

1. Make sure the RJSEXPORT library is not being used.

2. Delete the RJSEXPORT library from the AS/400 by entering a DLTLIB RJSEXPORT command

(12)
(13)

FTP/400 Version 1.00 Users Guide Chapter 2: Getting Started •• 7

Chapter 2: Getting Started

Introduction

The purpose of this chapter is to describe how to quickly get started using the FTP/400 File Transfer API or the FTP Remote Command Server to start sending and receiving files from your AS/400 via FTP or interact with PC programs.

Installing the FTP/400 Software

If you haven’t installed the software yet, go back to the installation section and install the software before continuing. If you’re just reading ahead to find out what to do, then please continue.

Overview of FTP/400 File Transfer API

What is FTP ? Quite simply, FTP is a standard protocol for sending and receiving files via the Internet or an Intranet. If you're not sure whether you have a FTP server configured in your network, you will need to talk to your network administrator or contact RJS Software Systems before you start attempting to use the FTP/400 File Transfer API.

The concept behind the FTP/400 File Transfer API is that AS/400 users and application developers need an easy way to send or receive AS/400 files or documents from the Integrated File System (IFS) without requiring a lot of programming effort or configuration to do so. Most companies have the AS/400 FTP Server running and may also have the need to shuttle data to a Windows NT or Unix server. The FTP/400 API command can be utilized to quickly schedule FTP file transfers via the AS/400 job scheduler. The command can also be embedded into CL, RPG or COBOL programs to add FTP file transfer with built-in error checking to any AS/400 application.

Listed below are some of the ways that FTP/400 can be utilized in traditional AS/400 application development scenarios:

1. Data warehouse information can be sent from the AS/400 is CSV format for importing into a Windows NT or Unix based data warehouse.

2. EDI information can be quickly exchanged with suppliers.

3. AS/400 libraries can be backed up to save files and the save files can be transmitted to another AS/400 or stored on a Windows NT or Unix Server.

4. A file can be transmitted to a remote AS/400 and then a job can be run or submitted to batch on the remote AS/400 system.

(14)

8 •• Chapter 2: Getting Started FTP/400 Version 1.00 Users Guide

The possibilities for utilizing the FTP/400 file transfer API are limited only by your imagination. If you have a scenario you would like to discuss, please contact RJS Software Systems for assistance.

Overview of FTP/400 Remote Command Server API

Usually people think of FTP as simply a file transfer mechanism; however it can be much more than that. In the case of the FTP/400 Remote Command Server, we have written our own communications layer based on FTP to allow an AS/400 application to interact directly with any PC via FTP. This allows an AS/400 application to:

Launch any PC based application such as MS Word, Excel, Web Browser, etc. by calling the program directly via the command line or by calling a document name and letting Windows determine which application to launch.

Launch a web browser to have it open the selected web link. This is great for adding web site integration into existing AS/400 applications. Green screen applications can have direct access to the web browser. Pop up a simple message box on the PC. This can be useful to visually notify users of AS/400 events. Directly launch MS Word or MS Excel using special *EXCEL and *WORD keywords.

Launch MS Word via OLE and perform selected data merge options. This is handy if you want to launch MS Word with a selected document template and have your AS/400 application pass information into the document or perform merge functions such as replacing text at selected bookmark locations in the template document. What a great way to replace Officevision/400.

Set clipboard information from the AS/400. This allows an AS/400 application to send information directly back to the PC clipboard for pasting into any PC application.

The uses for the FTPRUNPC command functionality are endless. We would like to hear how you plan to use this functionality.

Sending a File via FTP

Let's begin by sending our first file from the AS/400 via FTP. This example will actually send a file from an AS/400 library into the IFS on the same AS/400 system, so you can make sure everything is working correctly.

Note: This example assumes the AS/400 FTP Server is running.

Sign on to the AS/400 system and add the RJSFTP library to your library list by using the following AS/400 command: ADDLIBLE RJSFTP.

Next type: GO RJSFTP and press enter. This will take you to the FTP/400 main menu.

Take Option 3. (Transfer Files via FTP) and the FTPTFR command prompt will be displayed.

(15)

FTP/400 Version 1.00 Users Guide Chapter 2: Getting Started •• 9

Figure 1 Send/Receive Files via FTP Command Prompt - FTPTFR

Enter the following parameters for this test. We will be sending file QCUSTCDT from library QIWS to file QCUSTCDT.TXT in the root IFS directory:

Remote system: Change this value to LOCALHOST here since we’re sending and receiving from/to the

same system.

Local file name: Enter ’/QSYS.LIB/QIWS.LIB/QCUSTCDT.FILE/CUSTCDT.MBR’

Remote file name: Enter ’/QCUSTCDT.TXT’

Transfer function: Enter PUT

User profile on remote system: Enter a valid AS/400 user ID.

Password to remote system: Enter a valid AS/400 password.

AS/400 file name format: Enter 1 to use NAMEFMT 1.

Data format: Enter ASCII so the file gets converted to ASCII.

FTP Log Option: Enter *DSP so the log will display on screen.

Press Enter to send the start the file transfer.

When the transfer has completed the log will display telling you if there were any errors. That's all there is to it. You've sent your first file via FTP.

(16)

10 •• Chapter 2: Getting Started FTP/400 Version 1.00 Users Guide

Running a PC Command with FTPRUNPC

This example will launch the Windows Notepad program from your PC.

Note: Make sure the RJS FTP Remote Command Server has been installed before continuing.

PC Steps

Start the RJS FTP Server program from the RJS FTP Server program group.

When the main RJS FTP Command Server Window is displayed, click the Start button to start the FTP Server. Then minimize the FTP Server program and it will show as a Globe icon in the system tray. The PC is now ready to run remote commands. This program only needs to be started once. It will remain running until the PC is shut down or the program is closed.

AS/400 Steps

Sign on to the AS/400 system and add the RJSFTP library to your library list by using the following AS/400 command: ADDLIBLE RJSFTP.

Next type: GO RJSFTP and press enter. This will take you to the FTP/400 main menu.

Take Option 7. (Run Job on Remote Windows based PC) and the FTPRUNPC command prompt will be displayed.

Figure 2 Run Job on Windows PC – FTPRUNPC

Enter the following parameters for this test. This example will launch the Windows Notepad program:

Remote system: Leave *CURRENT in this value so the AS/400 knows to access this PC based on the

(17)

FTP/400 Version 1.00 Users Guide Chapter 2: Getting Started •• 11 PC Command to Run: Enter NOTEPAD.EXE or C:\WINDOWS\NOTEPAD.EXE

Run options: Enter *LAUNCHEXEC

Press Enter to launch the Windows Notepad program.

If it works correctly you should see the Windows Notepad program appear on your PC.

If you have problems using the FTPRUNPC command, contact RJS Software Systems for assistance.

What’s Next ?

You should now have the basics down for sending a file via FTP and running PC commands from the AS/400. The next few chapters are a reference for each the FTP/400 commands and available parameters.

(18)
(19)

FTP/400 Version 1.00 Users Guide Chapter 3: Main Menu •• 13

Chapter 3: Main Menu

Introduction

This chapter gives an overview of the FTP/400 main menu and the available options.

Figure 3 FTP/400 Main Menu

Getting to the Main Menu

Sign on to the AS/400 system and add the RJSFTP library to your library list using the following AS/400 command: ADDLIBLE RJSFTP.

(20)

14 •• Chapter 3: Main Menu FTP/400 Version 1.00 Users Guide

Available Options

Option 1 - Enter FTP/400 License Code

This menu option is used to enter the AS/400 access code for the FTP/400 software. An access code will be provided to you by RJS Software Systems Inc.

Option 2 - Enter FTP/400 Remote Command License Code

This menu option is used to enter the AS/400 access code for the FTP/400 Remote Command Server software. An access code will be provided to you by RJS Software Systems Inc.

Option 3 – Transfer Files via FTP - FTPTFR

This menu option is used to access the FTPTFR command for sending/receiving files via FTP.

Option 4 – Retrieve Current Session IP Address - FTPIP

This menu option is used to access the FTPIP command for retrieving the IP address for an interactive AS/400 session.

Option 5 – Send File from IFS Directory via FTP - FTPIFSSND

This menu option is used to access the FTPIFSSND command for sending files from the AS/400 Integrated File System (IFS). This is a simplified version of FTPTFR with fewer parameters to enter. It can only be used for sending files.

Option 6 – Send AS/400 Database in CSV Format via FTP - FTPDBSND

This menu option is used to access the FTPDBSND command for sending AS/400 database files from the AS/400 in CSV format. This command can only be used for sending files.

Note: This command requires the DataExport/400 software library to be loaded and licensed on the AS/400.

Option 7 – Run Job on Remote Windows based PC - FTPRUNPC

This menu option is used to access the FTPRUNPC command for running PC commands from the AS/400 system.

(21)

FTP/400 Version 1.00 Users Guide Chapter 4: AS/400 Commands •• 15

Chapter 4: AS/400 Commands

Introduction

This chapter gives an overview of the FTP/400 AS/400 commands. The FTP/400 commands can be embedded in any RPG, CL or COBOL program as well as any other AS/400 language.

FTPTFR: Send/Receive Files via FTP

Description

The FTPTFR command is used to send/receive files from the AS/400 to a remote system. It has built-in error checking so if the FTP transfer fails, a CPF9898 escape message will be issued so user programs can be notified there was a transfer failure.

(22)

16 •• Chapter 4: AS/400 Commands FTP/400 Version 1.00 Users Guide

Command Parameters

Remote system

This parameter holds the IP address or Host Name of the FTP server you will be connecting to.

Local file’s name

This parameter holds the name of the local file you are sending from or receiving to.

NAMEFMT 0 Example (Library/File.member):

QIWS/QCUSTCDT.CUSTCDT

NAMEFMT 1 Example (IFS Directory path):

/QSYS.LIB/QIWS.LIB/QCUSTCDT.FILE/CUSTCDT.MBR

Remote file’s name

This parameter holds the name of the remote file you are sending to or receiving from.

NAMEFMT 0 Example (Library/File.Member):

QIWS/QCUSTCDT.CUSTCDT

NAMEFMT 1 Example (IFS Directory path):

/QSYS.LIB/QIWS.LIB/QCUSTCDT.FILE/CUSTCDT.MBR

Local path to receive MGET

This parameter holds the name of the directory path where files will get stored when the MGET directive is used.

Example path to receive files to: /TEMP

In this example, files will get received to the /TEMP directory in the AS/400 IFS. If you need help with this parameter, contact RJS Software Systems.

Remote path to receive MPUT

This parameter holds the name of the remote directory path where files will get stored when the MPUT directive is used.

Example remote path which will receive files via MPUT: /TEMP

In this example, files will get sent to the /TEMP directory on the remote system. If you need help with this parameter, contact RJS Software Systems.

Transfer function

NONE – Only remote FTP commands are being run via the FTP command parameters. No file transfer

will occur.

PUT – Send one local file to selected remote file.

GET – Receive one remote file to selected local file.

(23)

FTP/400 Version 1.00 Users Guide Chapter 4: AS/400 Commands •• 17 MGET – Receive multiple files from remote system to local directory.

User profile on remote system

Enter a valid user ID for the remote FTP server.

Password to remote system

Enter a valid password for the remote FTP server.

AS/400 File Name Format

0 – Uses the AS/400 library naming format. Example (Library/File.Member):

QIWS/QCUSTCDT.CUSTCDT

1 – Uses the AS/400 IFS file naming format. Example (IFS Directory path):

/QSYS.LIB/QIWS.LIB/QCUSTCDT.FILE/CUSTCDT.MBR

Data Format

BINARY – Do not change data formatting. Leave data in original format. This format is very useful for

transmitting AS/400 libraries or object data contained in save files. It’s also useful for storing ASCII data on the AS/400.

ASCII – Perform ASCII translation.

EBCDIC – Perform EBCDIC translation.

FTP Log Option

*DSP – Display log after processing.

*PRT – Print the log after processing.

*NONE – Do not generate a log during processing.

FTP Command(s) Before Transfer (1-3)

These parameters hold up to 3 FTP commands that can be run on the remote system before the file transfer takes place. This can be used to run AS/400 jobs, create save files, etc……

Example remote AS/400 command to add library QGPL to library list: QUOTE RCMD ADDLIBLE

QGPL

FTP Command(s) After Transfer (1-3)

These parameters hold up to 3 FTP commands that can be run on the remote system after the file transfer takes place. This can be used to run AS/400 jobs, create save files, etc……

Example remote AS/400 command to submit job on remote AS/400: SBMJOB CMD(CALL

(24)

18 •• Chapter 4: AS/400 Commands FTP/400 Version 1.00 Users Guide

FTPIFSSND: Send File from IFS Directory via FTP

Description

The FTPIFSSND command is a simplified version of the FTPTFR command used to send a file from the AS/400 IFS via FTP. It has built-in error checking so if the FTP transfer fails, a CPF9898 escape message will be issued so user programs can be notified there was a transfer failure.

Figure 5 FTPIFSSND Command

Command Parameters

Remote system

This parameter holds the IP address or Host Name of the FTP server you will be connecting to.

From IFS file name

This parameter holds the name of the local file you are sending from. Example: /QSYS.LIB/QIWS.LIB/QCUSTCDT.FILE/CUSTCDT.MBR Example: /TEMP/DATA.TXT

To remote file name

This parameter holds the name of the remote file you are sending to. Example: /QCUSTCDT.TXT

User profile on remote system

(25)

FTP/400 Version 1.00 Users Guide Chapter 4: AS/400 Commands •• 19

Password to remote system

Enter a valid password for the remote FTP server.

Data Format

BINARY – Do not change data formatting. Leave data in original format. This format is very useful for

transmitting AS/400 libraries or object data contained in save files. It’s also useful for storing ASCII data on the AS/400.

ASCII – Perform ASCII translation.

EBCDIC – Perform EBCDIC translation.

FTP Log Option

*DSP – Display log after processing.

*PRT – Print the log after processing.

*NONE – Do not generate a log during processing.

FTP Command(s) Before Transfer (1-3)

These parameters hold up to 3 FTP commands that can be run on the remote system before the file transfer takes place. This can be used to run AS/400 jobs, create save files, etc……

Example remote AS/400 command to add library QGPL to library list: QUOTE RCMD ADDLIBLE

QGPL

FTP Command(s) After Transfer (1-3)

These parameters hold up to 3 FTP commands that can be run on the remote system after the file transfer takes place. This can be used to run AS/400 jobs, create save files, etc……

Example remote AS/400 command to submit job on remote AS/400: SBMJOB CMD(CALL

PGM(TEST999)

Example command line using FTPIFSSND

FTPIFSSND RMTSYS(LOCALHOST)

IFSFILE('/QSYS.LIB/QIWS.LIB/QCUSTCDT.FILE/CUSTCDT.MBR')

RMTFIL('/QCUSTCDT.TXT') USR(QSYSOPR) PWD(QSYSOPR) FORMAT(ASCII) LOGOPT(*DSP)

FTPDBSND: Send AS/400 Database File via FTP

Description

The FTPDBSND command is used to send any AS/400 database file via FTP in CSV (Comma Separated Variable) format. Note: Requires DataExport/400 license. Almost any PC application, including MS Access, Word or Excel can read CSV files so CSV is a good common data format to use when exchanging files with remote sites.

(26)

20 •• Chapter 4: AS/400 Commands FTP/400 Version 1.00 Users Guide

Figure 6 FTPDBSND Command

Command Parameters

Remote system

This parameter holds the IP address or Host Name of the FTP server you will be connecting to.

From file name/Library

This parameter holds the AS/400 Library/File/Member you wish to send via FTP. Example File: QCUSTCDT

Example Library: QIWS ExampleMember: *FIRST

To remote file name

This parameter holds the name of the remote file you are sending to. Example: /QCUSTCDT.TXT

User profile on remote system

Enter a valid user ID for the remote FTP server.

Password to remote system

Enter a valid password for the remote FTP server.

Data Format

BINARY – Do not change data formatting. Leave data in original format. This format is very useful for

transmitting AS/400 libraries or object data contained in save files. It’s also useful for storing ASCII data on the AS/400.

(27)

FTP/400 Version 1.00 Users Guide Chapter 4: AS/400 Commands •• 21 ASCII – Perform ASCII translation.

EBCDIC – Perform EBCDIC translation.

FTP Log Option

*DSP – Display log after processing.

*PRT – Print the log after processing.

*NONE – Do not generate a log during processing.

FTP Command(s) Before Transfer (1-3)

These parameters hold up to 3 FTP commands that can be run on the remote system before the file transfer takes place. This can be used to run AS/400 jobs, create save files, etc……

Example remote AS/400 command to add library QGPL to library list: QUOTE RCMD ADDLIBLE

QGPL

FTP Command(s) After Transfer (1-3)

These parameters hold up to 3 FTP commands that can be run on the remote system after the file transfer takes place. This can be used to run AS/400 jobs, create save files, etc……

Example remote AS/400 command to submit job on remote AS/400: SBMJOB CMD(CALL

PGM(TEST999)

Example command line using FTPDBSND

FTPDBSND RMTSYS(LOCALHOST) FILE(QIWS/QCUSTCDT) MBR(*FIRST) RMTFIL('/QCUSTCDT.TXT') USR(QSYSOPR) PWD(QSYSOPR) FORMAT(ASCII) LOGOPT(*DSP)

FTPRUNPC: Run Job on Remote Windows Based PC

Description

The FTPRUNPC command is used to run PC commands on a PC attached to the AS/400 running the

RJS FTP Remote Command Server. Note: Requires FTP/400 Remote Command Server license. The

FTPRUNPC command is a great way to integrate PC applications with any AS/400 application. The FTPRUNPC command can be used to:

Launch any PC based application such as MS Word, Excel, Web Browser, etc. by calling the program directly via the command line or by calling a document name and letting Windows determine which application to launch.

Launch a web browser to have it open the selected web link. This is great for adding web site integration into existing AS/400 applications. Green screen applications can have direct access to the web browser. Pop up a simple message box on the PC. This can be useful to visually notify users of AS/400 events.

(28)

22 •• Chapter 4: AS/400 Commands FTP/400 Version 1.00 Users Guide

Directly launch MS Word or MS Excel using special *EXCEL and *WORD keywords.

Launch MS Word via OLE and perform selected data merge options. This is handy if you want to launch MS Word with a selected document template and have your AS/400 application pass information into the document or perform merge functions such as replacing text at selected bookmark locations in the template document. What a great way to replace Officevision/400.

Set clipboard information from the AS/400. This allows an AS/400 application to send information directly back to the PC clipboard for pasting into any PC application.

The uses for the FTPRUNPC command functionality are endless. We would like to hear how you plan to use this functionality.

Figure 7 FTPRUNPC Command

Command Parameters

Remote system

This parameter holds the IP address or Host Name of the FTP server you will be connecting to. If

*CURRENT is entered here, the PC where the current 5250 session is being run will be accessed. Using *CURRENT eliminates the need to know your PC’s TCP/IP address.

PC Command to Run

This parameter holds the PC command line to run. Any standard PC command line can be entered here along with command line parameters. Long PC file names and directory names are also supported. If you’re simply launching a PC document, simply include the path and location to the selected PC document.

(29)

FTP/400 Version 1.00 Users Guide Chapter 4: AS/400 Commands •• 23

Run Options

This parameter holds the selected PC function to run.

*SHELL – Launch a PC application using a specific command line. The command line must include an

exact path to the program being called.

*SHELLWAIT – Launch a PC application using a specific command line. The command line must

include an exact path to the program being called. The AS/400 command will not return until the PC command completes. This way you can delay AS/400 processing until the selected PC command completes.

*LAUNCH – Launch a selected PC document by passing the document file and path as the command

line. The associated Windows application will be launched based on the document file extension.

*LAUNCHWAIT – Launch a selected PC document by passing the document file and path as the

command line. The associated Windows application will be launched based on the document file extension. The AS/400 command will not return until the PC command completes. This way you can delay AS/400 processing until the selected PC command completes.

*LAUNCHEXEC – Launch a selected program, PC document or web link using the Windows

ShellExecute command.

*WEBSITE – Same as *LAUNCHEXEC

*WORD – Launch MS Word.

*EXCEL – Launch MS Excel.

*MSGBOX – Display a popup windows message box.

*WORDOLE –Run the selected MS Word OLE Commands.

This option is perfect for running MS Word mail merge functions. Using this option can allow you to eliminate the usage of the Officevision/400 product for word processing.

Please contact RJS Software Systems for assistance in getting started with OLE commands and we will work with you or provide a CL sample.

*CLIPCLEAR – Clear the windows clipboard.

*CLIPSET – Set new text data in the clipboard.

*CLIPAPPEND – Append new data to existing clipboard text data.

Example command line using FTPRUNPC to Launch Windows Notepad

FTPRUNPC RMTSYS(*CURRENT) CMD(NOTEPAD.EXE) OPTION(*LAUNCHEXEC)

Example command line using FTPRUNPC to Set Windows Clipboard Data

(30)

24 •• Chapter 4: AS/400 Commands FTP/400 Version 1.00 Users Guide

Example command line using FTPRUNPC to Launch MS Word

FTPRUNPC RMTSYS(*CURRENT) OPTION(*WORD)

Example command line using FTPRUNPC to Open Web Site

FTPRUNPC RMTSYS(*CURRENT) CMD('http://www.rjssoft.com') OPTION(*WEBSITE)

FTPIP: Retrieve Current Session IP Address

Description

The FTPIP API command returns the TCP/IP address for the current 5250 session. This API is used anytime an AS/400 application needs to know the IP address of the PC or terminal which is running the 5250 session. This API must be called from a CL program.

Figure 8 FTPIP Command

Command Parameters

Device

This parameter holds the AS/400 display device name. Use * to retrieve the current session’s IP address.

IP Address

(31)

FTP/400 Version 1.00 Users Guide Chapter 5: Problem Handling •• 25

Chapter 5: Problem Handling

Common Errors

If errors occur while running the FTP/400 API's, always make sure to check the AS/400 job log by using the DSPJOBLOG command from the AS/400 command line. Many times the job log will give some idea as to what is failing.

You should also use the *DSP option for the FTP Log Option on all FTP commands to troubleshoot any issues.

Other Errors

If you cannot resolve the problem you're experiencing by using the previous troubleshooting methods, you should contact RJS Software Systems for advice on solving the problems you're experiencing. See the Technical Support section at the beginning of the User's Guide for information on contacting RJS Software Systems.

References

Related documents