[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Undesired CCSID conversion by FTPAPI



Hi Werner.

You are most welcome. Your problem is very interesting indeed. I will dig around some more. Hopefully Scott can shed some more light on the issue as well. Especially as this is an ftp from an Iseries to an Iseries I cannot see why it would change the CCSID, unless of course as usual IBM doesn't tell you everything about their special little codes. I know CCSID 500 is the DRDA standard for DB2 but it should still be recognizable to an Iseries. 

I am going to go and play around a little. :) 

Ronnie Visser



-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Werner Noll (Gefis)
Sent: Tuesday, December 06, 2011 3:22 PM
To: 'HTTPAPI and FTPAPI Projects'
Subject: AW: Undesired CCSID conversion by FTPAPI

Hi Ronnie,

I used your program sent this morning and did my FTP test.
But I got the same result as by my program. The source streamfile has CCSID
500 and the transferred target file gets CCSID 819.
Here is the FTP log of my test:

***************Datenanfang*****************         
FTP started on - date: 2011-12-06 time: 14.09.09     
 Parms:                                              
 Server                  - INFORTST                  
 Username                - SAPTRANS                  
 Remote directory        - /saptrans/ssq/ar/4500     
 Local directory         - /saptrans/ssq/ar/4500     
 Action                  - N                         
   (A)rchive             -                           
   (D)elete              -                           
   (N)othing             -                           
 Complete directory      - N                         
 Include sub directories - N                         
 Write a log file        - Y                         
 Clear logfile           - Y                         
 File name               - AMFI20110809040314        
 Log file                - /saptrans/ssq/ar/4500.txt 
 Archive folder          -                           
220-QTCP at TPIS06C.                                 
220-QTCP at TPIS06C.                                         
220 Connection will close if idle more than 30 minutes.      
> USER SAPTRANS                                              
331 Enter password.                                          
> PASS **********                                            
230 SAPTRANS logged on.                                      
> CWD /saptrans/ssq/ar/4500                                  
250-NAMEFMT set to 1.                                        
250 "/saptrans/ssq/ar/4500" is current directory.            
                                                             
File started : 2011-12-06-14.09.10.050000                    
> TYPE I                                                     
200 Representation type is binary IMAGE.                     
> PORT 10,12,40,41,243,124                                   
200 PORT subcommand request successful.                      
> STOR AMFI20110809040314                                    
150 Sending file to /saptrans/ssq/ar/4500/AMFI20110809040314 
226 File transfer completed successfully.                    
File ended : 2011-12-06-14.09.10.212000                      
File ended : 2011-12-06-14.09.10.212000          
Success!                                         
 Return Code    - 0                              
 Return Message -                                
FTP ended on - date: 2011-12-06 time: 14.09.10   
 ***************Datenende*******************     


Well, the usage of CCSID 500 is not often in our shop. Therefore it's o.k.
for me to change always the CCSID by CHGOBJ command after transmission.

Nevertheless many thanks for your support on this problem.

Regards,

Werner Noll
Gesellschaft für Individual-Software mbH
Ludwigstrasse 15
63739 Aschaffenburg
Germany
Geschäftsführer: Werner Noll, Bernd Schröder
HR Aschaffenburg HRB 6020
Phone: +49-6021-299880
Fax: +49-6021-299882
e-mail: werner.noll@xxxxxxxxx
-----Ursprüngliche Nachricht-----
Von: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] Im Auftrag von Ronnie
Gesendet: Dienstag, 6. Dezember 2011 08:44
An: HTTPAPI and FTPAPI Projects
Betreff: RE: Undesired CCSID conversion by FTPAPI

Hi Werner.

Please find attached a general ftp program that I have put together from all
of Scott's advice and examples and ways of doing things (All Kudos to
Scott). It will ftp effectively from any as400 to any ftp server including
other as400s.

It requires some parameters to run.

IPFTPSERVER (Destination server ip)
IPUSERNAME (Username) 
IPPASSWORD (Password)
IPRETURNCODE (Error code returned if any encountered) 
IPRETURNMSG (Error message returned if any encountered)
IPREMOTEDIR (Remote directory name, where you are ftp'ing to  eg.
/Tmp/test/ftp)
IPLOCALDIR (Local directory Where the file you want to ftp is on your
machine eg /tmp/test/ftp/source)
IPACTION (Action to take with the file once it has finished ftping 'N' for
nothing, 'A' for archive, 'D' for delete)
IPCOMPLETEDIR (Whether you want to ftp the complete directory Y/N)
IPSUBDIRS (Whether you want the ftp to include sub directories as well Y/N)
IPWRITELOG (Do you want a log file Y/N)
IPCLEARLOG (Do you want the log file cleared before the ftp starts Y/N)
IPFILENAME (Complete filename of you want to ftp only a specific file eg
TESTFTPSINGLEFILE.PDF or A mask which will ftp files that meet the criteria
eg TEST will ftp all files with TEST in the name in the local directory)
IPLOGFILE (Location of the log file eg /tmp/test/testlogfile.txt
IPARCHIVE (Location of the archive if archive selected for option IPACTION)

Could you run this program ftp'ing your file with a log file and see what
the resulting CCSID is. I would be very interested.

Thanks

Ronnie Visser


-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Werner Noll
(Gefis)
Sent: Monday, December 05, 2011 3:35 PM
To: 'HTTPAPI and FTPAPI Projects'
Subject: AW: Undesired CCSID conversion by FTPAPI

Hi Ronnie,

I'm little bit confused about the mentioned command STOR ...
I only use the FTP-APIs and cannot find there any STOR procedure.
What I'm doing in my RPG program (snippets after connect):

Step 1:
// Set Name Format                                     
If FTP_NamFmt(fd:1) < *zeros;                          
   CallP(E) FTP_Quit(fd);       //  Close FTP session  
   *inLR = *on;                                        
   Return;                                             
EndIf;                                                 

Step 2:
CallP(E) FTP_BinaryMode(fd:*ON);


Step 3 (after reading the directory entries from a temp file):
If FTP_Put(fd:%trimr(#PthLvl3):%trimr(#PthLvl3))         
   < *zeros;                                             
   r$FTPErrMsg = FTP_Error();                            
   FTP_Quit(fd);                 // Quit FTP-Session     
   *inLR = *on;                                          
   Return;                                               
EndIf;                                                   

Step 4:
// And now we reset the CCSID to 500

p$FTPCmd = 'CHGATR OBJ(''' + %trimr(#PthLvl3) +          
           ''') ATR(*CCSID) VALUE(500)';                 
If FTP_RmtCmd(fd:%trimr(p$FTPCmd)) < *zeros;             
   *inLR = *on;                                          
   Return;                                               
EndIf;

This works fine for me. But nevertheless I wonder why the CCSID of the
target file was different to the source file although I used binary mode.
Probably the FTP_BinaryMode procedure fails somewhere, but I didn't find an
error yet. 

Regards,
                                                   
Werner Noll
Gesellschaft für Individual-Software mbH
Ludwigstrasse 15
63739 Aschaffenburg
Germany
Geschäftsführer: Werner Noll, Bernd Schröder
HR Aschaffenburg HRB 6020
Phone: +49-6021-299880
Fax: +49-6021-299882
e-mail: werner.noll@xxxxxxxxx

-----Ursprüngliche Nachricht-----
Von: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] Im Auftrag von Ronnie
Gesendet: Montag, 5. Dezember 2011 09:43
An: HTTPAPI and FTPAPI Projects
Betreff: RE: Undesired CCSID conversion by FTPAPI

Hi Werner.

If FTP in binary mode were to change the CCSID of the destination file there
would be mayor implications for all ftp users to as400. I think your binary
mode setting is failing for some reason. 

We would be very interested in the result of the STOR command from FTPAPI
which should look something like this :

> STOR INLY01JNB1124124036.txt
150 Opening BINARY mode data connection for INLY01JNB1124124036.txt.

If it does not say " BINARY mode data connection " its not a binary ftp.
FTPAPI uses Raw ftp command "TYPE I" for binary transfers.

Can you supply a log file of your ftp.

Thanks



-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of
thomas.raddatz@xxxxxx
Sent: Monday, December 05, 2011 9:40 AM
To: ftpapi@xxxxxxxxxxxxxxxxxxxxxx
Subject: AW: Undesired CCSID conversion by FTPAPI


Werner,

You may also try to explicitly set the CCSID of your data with the

following AS/400 specific FTP command before sending the file:

   quote type c 1252
   put ...

It works well for me.

Thomas.

ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx schrieb am 04.12.2011 16:13:22:

> Von: werner.noll@xxxxxxxxx
> An: ftpapi@xxxxxxxxxxxxxxxxxxxxxx
> Datum: 04.12.2011 16:26
> Betreff: AW: Undesired CCSID conversion by FTPAPI
> Gesendet von: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
>

> Hello Dennis,
>

> it took some time get the FTP_QUOTE or FTP_RMTCMD API executed on the

target
> iSeries system as there were a couple of additional security programs
> running which prohibited the access.
> Now it's working fine. I used FTP_RMTCMD but it would probably also run

with
> FTP_QUOTE.
>

> Many thanks for your help.
> Regards,

>

> Werner Noll
> Gesellschaft für Individual-Software mbH
> Ludwigstrasse 15
> 63739 Aschaffenburg
> Germany
> Geschäftsführer: Werner Noll, Bernd Schröder
> HR Aschaffenburg HRB 6020
> Phone: +49-6021-299880
> Fax: +49-6021-299882
> e-mail: werner.noll@xxxxxxxxx
> -----Ursprüngliche Nachricht-----
> Von: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] Im Auftrag von Dennis
> Lovelady
> Gesendet: Freitag, 25. November 2011 15:27
> An: 'HTTPAPI and FTPAPI Projects'
> Betreff: RE: Undesired CCSID conversion by FTPAPI

>

> Hello, Werner:
>

> Scott and others can describe much more clearly than I why the FTP

server on
> the remote system does not (apparently) use the CCSID of the user

profile
> when creating a new IFS file.  (I assume this is to go into IFS.)
>

> But as for resolution, if there is no way to get the system to create

these
> files with the desired CCSID, I would follow the transfer with a call to
> FTP_QUOTE() to set the desired CCSID.  There are lots of other ways to

go
> about the same thing, such as creating the file beforehand, and using
> FTP_APPEND instead of FTP_PUT, et cetera....  Since these actions
> effectively become a part of the transfer, the concern about being a

batch
> process should be satisfied.
>

> I hope this helps.
>

> Dennis Lovelady
> http://www.linkedin.com/in/dennislovelady
> --
> "We lived for days on nothing but food and water."
>         -- W.C. Fields

>

> > I use Scott Klement?s FTP APIs with great success for many years but I
> always
> > used them for communication with systems other than iSeries.
> >

> > Now I need to transfer a streamfile with CCSID 500 from one iSeries to
> another.
> >

> > It?s done on the source system by a special user profile with CCSID

500
> and
> > the user profile on the target system is specified identical.
> >

> > Although I set explicitly binary mode to *ON the file becomes after
> > transmission CCSID 819 and the data is unreadable.
> >

> > Of course it?s possible to change the CCSID by CHGATR command but it?s

not
> > practical as this transfer should be part of a batch process.
> >

> >

> >

> > Can anyone give me some hints on my problem?
> >

> > Many thanks in advance.
> >

> >

> >

> > Regards,
> >

> >

> >

> > Werner Noll
> > Gesellschaft für Individual-Software mbH Ludwigstrasse 15
> >

> > 63739 Aschaffenburg
> >

> > Germany
> >

> > Geschäftsführer: Werner Noll, Bernd Schröder
> >

> > HR Aschaffenburg HRB 6020
> > Phone: +49-6021-299880
> > Fax: +49-6021-299882
> >

> > e-mail: werner.noll@xxxxxxxxx
> >

> >

>

>

> -----------------------------------------------------------------------
> This is the FTPAPI mailing list.  To unsubscribe, please go to:
> http://www.scottklement.com/mailman/listinfo/ftpapi
> -----------------------------------------------------------------------
>

> -----------------------------------------------------------------------
> This is the FTPAPI mailing list.  To unsubscribe, please go to:
> http://www.scottklement.com/mailman/listinfo/ftpapi
> -----------------------------------------------------------------------


--
IMPORTANT NOTICE:
This email is confidential, may be legally privileged, and is for the
intended recipient only. Access, disclosure, copying, distribution, or
reliance on any of it by anyone else is prohibited and may be a criminal
offence. Please delete if obtained in error and email confirmation to the
sender.
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------