2017 Jan 18 1:49 PM
Hi ,
I have a requirement to read EBCDIC files in ABAP. is there any FM that converts EBCDIC to ASCII. so that we can persist the data as ASCII rather than EBCDIC.
In general suggest me what we have to do when reading EBCDIC files.
Thanks
NB
2017 Jan 18 2:27 PM
2017 Jan 25 2:22 PM
Thanks Raymond,
any idea whats the code page name for "EBCDIC IBM-1140" in ECC?. I know IBM-1140 is equivalent to IBM-0037 and IBM-0037's code page is 0123 but its not populated in TCP00A tables. Methods you suggested requires codepage name for example. 'ibm500'.
Thanks,
NB
2017 Jan 25 5:57 PM - edited 2024 Jul 10 12:15 PM
"Fun" that CL_ABAP_CODEPAGE checks this table. The obsolete class CL_ABAP_CONV_IN_CE does not check it.
DATA l_xstring TYPE xstring.
DATA l_string TYPE string.
l_xstring = '5A405A'.
PERFORM convert_xstring_to_string USING l_xstring '0123' CHANGING l_string.
ASSERT l_string = '! !'.
FORM convert_xstring_to_string
USING i_xstring TYPE xstring
i_encoding TYPE abap_encoding
CHANGING e_string TYPE string.
DATA lo_conv TYPE REF TO cl_abap_conv_in_ce.
CLEAR e_string.
lo_conv = cl_abap_conv_in_ce=>create( encoding = i_encoding
input = i_xstring ).
CALL METHOD lo_conv->read( IMPORTING data = e_string ).
ENDFORM.
2017 Jan 26 7:09 AM
2017 Feb 02 3:11 PM
Hi Sandra Rossi,
Thanks, Yes we can use these old CLs to convert the content based on the codepage 'code'.
I'm still not getting 100% correct converted content because my source content has the COBOL "Comp-3" Data Types. Convertion routines has no idea about "Packed" decimals, I think i have to add bit of logic before / after convertion to handles these.
Any Idea about How to convert the contetnt with these special types "Packed" decimals / Comp-3 data types/ Binary Converted Decimals?.
Thanks,
NB
2017 Feb 02 7:27 PM
I think you can do it via method CONVERT_STRUC, and you'll need to define a target structure, defining the character and packed fields in the same sequence of the fields from the input EBCDIC bytes.
2024 Jul 09 10:36 PM
Hello,
Were you able to find a solution for this? We have requirement to read EBCIDC file with COMP3 values.
Thanks, Anzari