Q

Send an AS/400 database file as an attachment to an e-mail

Is there a way to send an AS/400 database file as an attachment to an e-mail with the snddst (or other) command? I currently FTP the file to our server and then e-mail through our Exchange server. I would like to automate the process by sending the e-mail off of the AS/400 with the file attached. Currently when I try, the file is received in my e-mail, but it is not in a "readable" format. Thank you.


I believe the reason why this file is unreadable when directly sent via SNDDST, is because it is being sent using an EBCDIC CCSID instead of an ASCII CCSID. When you FTP the file to your Windows server it is translated to ASCII.

Wouldn't it be nice if you could just copy this file to your PC server and then execute a program on your AS/400 that would e-mail it... Well, you can.

Create a directory in the IFS and share it via NETSERVER.

From your Windows based server, map this directory as a remote drive.

Install CA/400 Express on the server. Enable remote command support...

To enable remote command support on a Win2K server:

Select: Control Panel, Administrative Tools, Services On the Services screen look for "client Access Express Run Remote Command" and double click on it. Then select the start button to start the process on the PC. Make a note of the IP address for this server, you will need it later.

Create a program on your AS/400 that:

1. Uses the Copy to Stream File command (CPYTOSTMF) to create an ASCII copy of your file to the shared directory in the IFS.

For example:

 CPYTOSTMF FROMMBR('/qsys.lib/mylib.lib/myfile.file/mymbr.mbr')
          TOSTMF('/home/mydir/file.txt')
          STMFCODPAG(*PCASCII)    

2. Utilizing the Run Remote Command (RUNRMTCMD), your CLP, running on the AS/400 could then execute some program on the PC server that would e-mail the ASCII version of your file....

For example:

 RUNRMTCMD CMD(PC_COMMAND) RMTLOCNAME('nnn.nnn.nnn.nnn' *IP) RMTUSER(userid)
RMTPWD(password) 

Where nnn = the IP address of the PC server, user ID and password are the user ID and password for the PC.

The process would still be utilizing a Windows server, but it would all be controlled via a program running on your AS/400.


This was first published in May 2001

Dig deeper on Past Releases

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchEnterpriseLinux

SearchDataCenter

Close