Midrange News for the IBM i Community


Posted by: KS Shiva
FTP Spool file containing Arabic
has no ratings.
Published: 06 Dec 2011
Revised: 23 Jan 2013 - 1646 days ago
Last viewed on: 27 Jul 2017 (5349 views) 

Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.

FTP Spool file containing Arabic Published by: KS Shiva on 06 Dec 2011 view comments(14)

Hi

We have a spool file which contains Arabic Characters (I think CCSID 420).

I want to FTP the SPLF to a different operating system.

Please let me know the format of the FTP file and procedure.

Thank you very much.

Regards

Shiva

Return to midrangenews.com home page.
Sort Ascend | Descend

COMMENTS

(Sign in to Post a Comment)
Posted by: KSShiva
Premium member *
Comment on: FTP Spool file containing Arabic
Posted: 5 years 7 months 21 days 23 hours 33 minutes ago
Edited: Thu, 08 Dec, 2011 at 02:51:50 (2058 days ago)

Bob

Will RPGxTools help this ?

Thanks

Shiva

Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: FTP Spool file containing Arabic
Posted: 5 years 7 months 21 days 11 hours 8 minutes ago
Edited: Wed, 07 Dec, 2011 at 08:54:07 (2059 days ago)

xTools? No.

But the SNDTCPSPLF CL command included in the OS might be what you want. Here's an example:

SNDTCPSPLF RMTSYS('192.168.1.101') PRTQ(MYOUTQ) FILE(QPRINT)
    JOB(010234/COZZI/DSP02) DESTTYP(*AS400) TRANSFORM(*NO)  

Just make sure you specify TRANSFORM(*NO) and DESTTYP(*AS400) or you'll get crap on the other end.

Posted by: DaleB
Premium member *
Reading, PA
Comment on: FTP Spool file containing Arabic
Posted: 5 years 7 months 21 days 10 hours 55 minutes ago

Leave it to Bob. I'm thinking save *OUTQ to SAVF, FTP as binary, restore. Or CPYSPLF to flat file *FCFC, FTP, OVRPRTF for *FCFC, CPYF to printer file (all the while keeping CCSID's straight). And Bob comes out with LPR. D'oh!

Posted by: KSShiva
Premium member *
Comment on: FTP Spool file containing Arabic
Posted: 5 years 7 months 21 days 9 hours 41 minutes ago
Edited: Thu, 08 Dec, 2011 at 02:53:10 (2058 days ago)

Thank you verymuch Bob and Dale.

Bob> I feel SNDTCPSPLF would work fine. 

When I  tried the command I got the following error.

Message . . . . :   Remote host system rejected the open attempt.            
Cause . . . . . :   This may have occurred because the remote host does not  
  have ports available for use or does not support TELNET.                   
Recovery  . . . :   Try the request again or contact the system administrator.

My local system IP is 192.168.1.2 which is connected through a router.

I am using Windows 7, but I have enabled TelnetClient and TelnetServer through Control Panel> Programs > Trurn Windows Features on or off > Telnet Clinet.

Thanks

Shiva

Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: FTP Spool file containing Arabic
Posted: 5 years 7 months 21 days 9 hours 27 minutes ago
Edited: Wed, 07 Dec, 2011 at 11:29:31 (2059 days ago)

You do understand that this is an AS/400 to AS/400 transfer example right? Not a PC to AS/40 transfer.

The two system are both AS/400 systems, right? (Meaning IBM System i or "POWER on i" boxes?)  If not, then you can't use the DESTTYP(*AS400) parameter and probably not the TRANSFORM parameter.

Posted by: KSShiva
Premium member *
Comment on: FTP Spool file containing Arabic
Posted: 5 years 7 months 21 days 9 hours 23 minutes ago
Edited: Thu, 08 Dec, 2011 at 02:53:36 (2058 days ago)

Well Bob, I need to FTP the SPOOL FILE (NOT PF) data to a non AS400 System as Unicode/Excel/CSV file which contains both English and Arabic Characters.

Thank you.

Posted by: DaleB
Premium member *
Reading, PA
Comment on: FTP Spool file containing Arabic
Posted: 5 years 7 months 21 days 8 hours 39 minutes ago
Edited: Wed, 07 Dec, 2011 at 11:18:38 (2059 days ago)

Ah, there's the rub. You can't FTP spooled files, only data files. The file that you FTP can be PF-DTA, PF-SRC, SAVF, or something from IFS.

So what you're going to need to figure out is how to convert your spooled file to a data file. You can CPYSPLF to a PF-DTA, but it will be a flat file, just containing the text of each line of the spooled file.

If you really need CSV or Excel, you're going to need to do some programming. I often get requests along the lines of, "can you take such-and-such a report and send it in e-mail as a CSV?" Generally I modify the original report program and write to a stream file as an additional output, or sometimes as the only output, depending on the request. CSV is fairly easy. Excel is a little trickier, but if you're up for it, there are open source Java classes that can help.

Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: FTP Spool file containing Arabic
Posted: 5 years 7 months 21 days 8 hours 29 minutes ago

Okay, you did say "different system" and that's why I wanted to clarify what your issue is.

Did you try it without the parameters I indicated (DESTTYP and TRANSFORM) which I customized in the example for AS/400 to AS/400 transfer. If you're going to a PC from an AS/400, then the default settings may be what you need. If not, play with those two settings to see if changing them can help.

Unless you copy the Spool File to a database file, you can't directly FTP the SPLF.

Once it is in a db format, you'll need a PC program that can interpret it or were you expecting it in text format?

If this is the case, try using CPYSPLF to copy it to a database file, then use FTPFILE (available on this website) to FTP the file. Try both binary and then TEXT transfer modes to see which one would work for your situation.

Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: FTP Spool file containing Arabic
Posted: 5 years 7 months 21 days 8 hours 28 minutes ago
Edited: Wed, 07 Dec, 2011 at 11:28:59 (2059 days ago)

Excel can read CSV and there's almost never a reason to use Excel's native format instead of CSV unless formatting is an issue.

Posted by: KSShiva
Premium member *
Comment on: FTP Spool file containing Arabic
Posted: 5 years 7 months 21 days 7 hours 40 minutes ago
Edited: Thu, 08 Dec, 2011 at 02:54:10 (2058 days ago)

I understand SPLF can not be directly sent by FTP.  Is it possible to convert the SPLF into Unicode (Not ASCII) so I can preserve the Arabic Characters which can be stored in IFS Folder?

ASCII converts Arabic Letters to ?????? in AS400 Display.

Copying to PF and sending the file in binary format will also not help as the destination system is not AS400. 

The expected data should be in Unicode / Excel so, the arabic charecters can be viewed and processed.

Thank you

Shiva

Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: FTP Spool file containing Arabic
Posted: 5 years 7 months 21 days 3 hours 18 minutes ago

Try creating a physical file with the Unicode CCSID and copy the SPLF to it. Then FTP the PF to the target system... sounds like you're going to have to play with it using trial/error.

Posted by: KSShiva
Premium member *
Comment on: FTP Spool file containing Arabic
Posted: 5 years 7 months 20 days 17 hours 9 minutes ago
Edited: Thu, 08 Dec, 2011 at 02:51:33 (2058 days ago)

 

Bob, I tried to create a PF and copied the SPLF to the PF.  Then I did CPYTOSTMF to IFS Folder. (Sending PF through FTP using SAVF will not be of any help)

When I received data in Windows using FTP, the transfer was successful but data was some junk characters.

As Bob mentioned will do various trial and error options playing aroung with CCSID and see the results.   In the mean time, if any one suggest me with the appropriate settings pleaase do so.

Ultimately what I want is to Convert the SPLF Data (Arabic + English) into a Stream File which can be sent by FTP to Non AS400, say Windows/Unix. 

Thanks in Advance.

 

Posted by: DaleB
Premium member *
Reading, PA
Comment on: FTP Spool file containing Arabic
Posted: 5 years 7 months 20 days 11 hours 46 minutes ago
Edited: Thu, 08 Dec, 2011 at 08:10:48 (2058 days ago)

After CPYSPLF to PF, verify the CCSID is what you think with DSPFD and DSPFFD. And you should probably DSPPFM and [F10] to see in hex, to make sure it's actually Unicode.

Then after CPYTOSTMF, WRKLNK option 8 to see the attributes of the *STMF, again verifying that it's Unicode. If the *STMF is still Unicode, FTP it as BINary; otherwise the remote system may try to convert text to some local code page, thus possibly corrupting the Unicode characters.

I'd like to suggest again that it's probably easier, in the long run, to have the program that creates the report just write the *STMF directly.

Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: FTP Spool file containing Arabic
Posted: 5 years 7 months 20 days 9 hours 54 minutes ago
Edited: Thu, 08 Dec, 2011 at 10:08:06 (2058 days ago)

An old RPGWorld page has the CCSID conversion tables on them.

  • UTF-8 is CCSID(1208)
  • UTF-16 is CCSID(1200)

If a portion of the SPLF is 37 and another portion is 420... challenging.

Is the SPLF itself created with an Arabic EBCDIC CCSID? If so, which one?

Another choice is to create a PF with CCSID(420) and copy the SPLF to it.

Look at the file and see if it looks okay on your system (i.e., converted okay)

Then try FTP to the target PC as ASCII. ASCII transfer will translate the CCSID, whereas Binary will not.

If that doesn't work... is CCSID 420 multi-byte? If so, try doing the following:

Create a 2nd file that is CCSID(1200) (UTF-16) try copying the SPLF directly to it and see if it maps correctly. If NOT, then try this:

Create the CCSID(420) PF and copy your spool file to it.

Then copy the PF to a new PF that is created with CCSID(1200); the system should map the CCSIDs correctly. 

Then try to FTP that file using FTP BINARY/IMAGE mode so it doesn't convert anything.

Then look at the image on the PC and see if it worked.

If you have a recent version of Windows it should be able to view UTF-16 data. Try opening the PC file using the web browser instead of a text editor. The web browsers are a bit smarter than Notepad.