Hi,
What cp -F crtl does is to copy the records as text, remove all the trailing blanks (0x40)s and add 0x0d,0x25 at the end.
0x0d is "\r" (carriage return) in ascii as well as in ebcdic.
0x25 is "\n" (line feed) in ebcdic, "%" is 0x25 converted from ascii to ebcdic (again!).
your editor convert the file to ebcdic that is why you see %
That means using cp -F crtl is wrong, because the original data is not ebcdic.
Assuming your file is in VB and you don't have a compiler, here is what you can do:
1. ftp with this options
- binary
-
quote site rdw
- get '//FULLY.QUALIFY.DSNAME' ./local.tmp
local.tmp will be a binary file with rdw information at the begining of each record.
2. convert with this rexx code.
- ./conv.rexx ./local.tmp ./output.txt
This discards the rdw and add a 0x0a at the end of each record.
/* rexx */parse arg fi fou=charin(fi, , 1)rdw=0len = 0call charout fo,,1do while length(u) = 1 select when rdw = 0 then do ; len = c2d(u) ; rdw = 1 ; end when rdw = 1 then do ; len = len + c2d(u) ; rdw = 2 ; end when rdw = 2 then do ; if (c2d(u) != 0) then do ; say "rdw of "fi" is broken" ; exit 1; end ; rdw = 3 ; end when rdw = 3 then do ; if (c2d(u) != 0) then do ; say "rdw of "fi" is broken" ; exit 1 ; end ; len = len - 4 ; rdw = -1 ; end otherwise if (len > 0) then do; err = charout(fo, u) ; len = len - 1 ; if len = 0 then do ; rdw = 0 ; err = charout(fo, d2c(10)) ; end end end if err != 0 then do; say fo " write error" ; exit 1 ; end u=charin(fi, , 1)end
ccw