First, you need to understand the FORMAT option for a FS COPY service. The 
STAF User's Guide at 
http://staf.sourceforge.net/current/STAFUG.htm#HDRFSGETFILE defines the 
FORMAT option as follows:

FORMAT specifies the end-of-line character(s) to use. This option will 
resolve variables. 
If the TEXT option is specified, the following formats are supported: 
NATIVE specifies to convert line-ending characters in the file(s) to those 
of the target machine so that the line-ending characters are appropriate 
to the target platform. This is the default. 
UNIX specifies to converts line-ending characters in the file(s) to the 
line-ending characters for Unix. 
WINDOWS specifies to convert line-ending characters in the file(s) to the 
line-ending characters for Windows. 
ASIS specifies that no conversion of line-ending characters in the file be 
done. This value is only supported for a GET FILE request. Note that prior 
to STAF V2.5, this was the default (as the TEXT option was not yet 
implemented). 
<String> specifies to convert line-ending characters in the file(s) to the 
specified string. 

So, by specifying FORMAT EBCIDIC, you are specifying to convert each 
line-ending character in the file to string "EBCIDIC", which is not what 
you want to do.

The TEXT option is defined as follows:

TEXT specifies to convert line-ending characters in the file being copied 
as specified via the FORMAT option and to perform codepage conversion. 
This option should only be specified for a text file, not a binary file. 

So, you should specify a command like the following to copy the file as a 
text file converting each character in the source file on machine blackcat 
from the codepage that STAFProc is running with on machine blackcat to the 
IBM-437 codepage that STAFProc is running with on machine rpitkintc8212.

STAF blackcat.swg.usma.ibm.com FS COPY FILE "/afiseries/notesdata/pid.nbf" 
TODIRECTORY "c:\tmp" TOMACHINE rpitkintc8212.swg.usma.ibm.com TEXT

Note that its the TEXT option that specifies to perform codepage 
conversion for text files.  STAF assumes that the codepage of  the text 
file being copied (the "from" file) is the codepage that STAFProc is using 
on the source machine and that the codepage that the "to" file on the 
destination machine will be converted to is the codepage that STAFProc is 
using on the destination machine. Note that STAF variable 
STAF/Config/CodePage shows the codepage that STAFProc is using so you can 
see the codepage that STAFProc is using on a machine by doing:

 STAF <machine> VAR RESOLVE STRING {STAF/Config/CodePage}

You can override the codepage used by STAF by setting the 
STAFCODEPAGEOVERRIDE environment variable to a codepage that does support 
the data in the file and then re-start STAFProc.

Section "2.7 Strings and Codepages" in the STAF Users Guide at 
http://staf.sourceforge.net/current/STAFUG.htm#HDRSTRINGCON talks about 
STAF codepages.

There is a feature open to be able to specify the codepage to use on a FS 
COPY request if it is not the same as the codepage that STAFProc is using 
(it has not yet been implemented).   See 
http://sourceforge.net/tracker/?func=detail&aid=896050&group_id=33142&atid=407384
 
for more information about Feature #896050 "FS to support explicit 
codepage conversion".

Check what codepage STAFProc is running with on machines blackcat and 
rpitkintc8212.  I see that the STAFcodepage for machine rpitkintc8212 is 
IBM-437.

# STAF rpitkintc8212.swg.usma.ibm.com VAR RESOLVE STRING 
{STAF/Config/CodePage}
Response
--------
IBM-437

But what is the codepage that STAFProc is running with on machine 
blackcat.swg.usma.ibm.com?  Any STAF command that I submit to that machine 
is fails as follows.  Perhaps you need to restart STAFProc on that 
machine?

# staf blackcat.swg.usma.ibm.com ping ping
Error submitting request, RC: 1917127178

Also, note that STAF does not currently support converting strings to or 
from the EBCIDIC codepage.

On an iSeries machine that we run STAF on, its STAF codepage is ISO8859-1 
(LATIN_1),  We can copy text files such as the STAF.cfg file from our 
iSeries machine (just using the TEXT option on a FS COPY request) to Linux 
machines and they are readable.

In looking at the codepage used in the i PASE environment (which is how 
STAFProc is run on a iSeries machine), it appears that QOpenSys is the 
receiving file system files are transferred using an ASCII codepage (e.g. 
LATIN_1) when using FTP.  See 
http://publib.boulder.ibm.com/iseries/v5r2/ic2924/index.htm?info/rzaiq/rzaiqreferencedt8b.htm
.

Are you sure that file /afiseries/notsedata/pid.nbf really uses codepage 
EBCDIC?

If you try copying the file as binary (so that no codepage conversion is 
performed) by not specifying the TEXT option on a FS COPY request, does 
the copied file look correct then?  For example:

STAF blackcat.swg.usma.ibm.com FS COPY FILE "/afiseries/notesdata/pid.nbf" 
TODIRECTORY "c:\tmp" TOMACHINE rpitkintc8212.swg.usma.ibm.com

--------------------------------------------------------------
Sharon Lucas
IBM Austin,   luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313




From:   Richard Pitkin/Westford/IBM@Lotus
To:     staf-users@lists.sourceforge.net
Date:   01/24/2011 07:13 PM
Subject:        [staf-users] Format for copy file from iSeries (EBCDIC) to 
Windows (ASCII)



I am trying to copy a file that is in EBCDIC format on an iSeries to a 
window machine in ASCII formation having the encoding changed by staf and 
this is not working. 

The iSeries machine is : 
3 [C:\tmp\blackcat] staf blackcat.swg.usma.ibm.com misc version 
Response 
-------- 
3.4.2 

The Windows machine is: 
3 [C:\tmp\blackcat] staf rpitkintc8212.swg.usma.ibm.com misc version 
Response 
-------- 
3.4.2 

I have tried the following two commands: 
3 [C:\tmp\blackcat] staf blackcat.swg.usma.ibm.com FS COPY FILE 
"/afiseries/notesdata/pid.nbf" TODIRECTORY "c:\tmp" TOMACHINE 
rpitkintc8212. 
swg.usma.ibm.com TEXT FORMAT EBCDIC 
Response 
-------- 


3 [C:\tmp\blackcat] type c:\tmp\pid.nbf 
ñ@÷ô÷@÷ô⌂@⌂⌂⌂éâ⌂æ⌂@@@@@@@@@@@@@@@@@@@@@@@@@@@@@% 

3 [C:\tmp\blackcat] staf blackcat.swg.usma.ibm.com FS COPY FILE 
"/afiseries/notesdata/pid.nbf" TODIRECTORY "c:\tmp" TOMACHINE 
rpitkintc8212. 
swg.usma.ibm.com TEXT FORMAT ASCII 
Response 
-------- 


3 [C:\tmp\blackcat] type c:\tmp\pid.nbf 
ñ@÷ô÷@÷ô⌂@⌂⌂⌂éâ⌂æ⌂@@@@@@@@@@@@@@@@@@@@@@@@@@@@@% 


neither resulted in the file being in ASCII format. 

Suggestions?? 

Richard Pitkin 
Lotus Software, IBM Software Group
978-899-3157  t/l 276-3157
richard_pit...@us.ibm.com

"For a successful technology, reality must take precedence over public 
relations, for nature cannot be fooled."  R. P. Feynman, "Report of the 
Presidential Commission on the Space Shuttle Challenger 
Accident"[attachment "smime.p7s" deleted by Sharon Lucas/Austin/IBM] 
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better 
price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users


------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to