Quantcast
Channel: SCN: Message List - ABAP Connectivity
Viewing all articles
Browse latest Browse all 3125

Re: rsftp002 and eof marker

$
0
0

I stumbled upon your post, this is probably too late, but this is how we solved the problem of  converting an EBDCIC file to ASCII & folding to the correct record length.

 

 

REPORT z_ebcdic_to_ascii_fold LINE-SIZE 255 LINE-COUNT 65.
*
* Convert EBDCIC to ASCII & fold to record length = p_fold
*
DATA: w_unix_cmd(255).
** Table for Unix messages
DATA: BEGIN OF isys OCCURS 0,
   line(255),
END OF isys.
*
*
selection-screen skip 1.
parameters: p_ebcdic(132LOWER CASE   obligatory  " input file path/name
                default  '/sapdata/DEV/home/msp_gl/ext0239.20120618'.

selection-screen skip 1.

parameters: p_ascii(132) lower case  obligatory " output file path/name
                default '/sapdata/DEV/home/msp_gl/ext0239.20120618_ascii'.

selection-screen skip 1.

parameters: p_fold(5) type n obligatory default 80.
**
** unix_cmd =
** dd if=/...EBCDIC_file   | fold -w80  >  /...ASCII_80_length_file
**


w_unix_cmd =
   'dd if=%EBCDIC_file% conv=ascii | fold -w%FOLD%  >  %ASCII_file%'.

REPLACE FIRST OCCURRENCE OF '%EBCDIC_file%' IN w_unix_cmd
                                             WITH p_ebcdic.

REPLACE FIRST OCCURRENCE OF '%FOLD%'        IN w_unix_cmd
                                             WITH p_fold.

REPLACE FIRST OCCURRENCE OF '%ASCII_file%' IN w_unix_cmd
                                            WITH p_ascii.
*
call 'SYSTEM' id 'COMMAND' field w_unix_cmd
               id 'TAB' field isys-*sys*.

*Note: sy-subrc is always zero, messages returned is meaningless!
*
skip 1.
write: / 'UNIX command executed is:'.
skip 1.
write: / w_unix_cmd.


Viewing all articles
Browse latest Browse all 3125

Trending Articles