C# encoding a file in EBCDIC with packed decimals

I have to prepare a file for an outside entity, and this entity uses an IBM mainframe with COBOL and requires the file to be encoded in EBCDIC. I am creating the file in C#. I guess this is a two-part question...firstly, is the code below sufficient to ensure that the file will be generated in a manner that they can read?

StreamWriter sw = new StreamWriter(@"C:\EBCDICFileEquivalent.txt", false, Encoding.GetEncoding(37));

Secondly, several fields in the file require packed decimal, in the format S(9)13 COMP-3. Since I have already specified EBCDIC encoding, can I just write the decimal number (e.g. 1234500000001) to the file using:

sw.WriteLine("1234500000001C"); 

...and have it turn out correctly in the generated file?

Have never done anything with EBCDIC or COMP-3.

7
задан Bill Woodger 3 December 2013 в 21:32
поделиться