Pl I To Cobol Converter Money

Active5 years, 5 months ago
  1. Free Cobol Converter
  2. Pl I To Cobol Converter Money Online

I have an EBCDIC flat file to be processed from a mainframe into a C module. What can be a good process in converting the COMP and COMP-3 values into readable values? Do I have to convert the ebcdic characters to ascii then hex for COMP-3? What about for COMP? Thanks

entendezEJentendezEJ
Pl I To Cobol Converter Money

Format the decimal field to the Currency Field as mentioned in the example below and then convert to varchar. Format to the Currency Field. Code or VB or COBOL. There’s more involved in COBOL to Java conversion than modern languages, IDEs, components, and platforms. Large organizations often have millions of lines of COBOL. It encapsulates decades of business processes, lessons and protocols. RE: S9(9)V99, convert to currency SkipVought (Programmer) 27 Apr 09 20:20 Or better yet, have a COBOL programmer, convert the packed decimal to decimal, in the flat file.

2 Answers

Free Cobol Converter

Bill Woodger has given you some very good advice through his comments to your question, actually he answered the question and should haveposted his comments as an answer.

I would like to reiterate a few of his points and expand on a few others.

Pl I To Cobol Converter Money Online

If you need to convert a file created from what is probably a COBOL application so it may be readby some other non-COBOL program, possibly on a machine with an architecture unlike the one where it was created, thenyou should demand that the file be created using only display formatted data (i.e. all character data). Mashing non-display(binary, packed, encoded) data outside of the operating environment where it was created is just a formula forlong term pain. You will be subjected to the joys of sorting out various endianness issuesbetween architectures and code page conversions. These are the things thatfile transfer protocols are designed to manage - they do it well so don't try to reinvent them. Short answer, use FTP orsimilar file transport mechanism to move data between machines. And only transport display (character) based data.

Packed Decimal (COMP-3) data types occupy a varying number of bytes depending on their specific PICTURE layout. The position of the decimal pointis implied so cannot be determined without reference to the PICTURE used to define it. Packed Decimal fields may be either signedor unsigned. If signed, the sign is imbedded in the low 4 bits of the least significant digit. Each byte of a Packed Decimaldata type contains two digits, except possibly the first and last bytes. The first byte contains only 1 digit if the field is signedand contains an even number of digits. The last byte contains 2 digits if unsigned but only 1 if signed. There are several other subtlies thatyou need to be aware of if you want to do your own Packed Decimal to character conversions. At this point I hope you can seethat this is not going to be a trivial exercise.

Binary (COMP) data types have a different but no less complex set of issues to resolve. Again, not a trivial exercise.

So what should you be doing? Basically, do as Bill suggested. Have the program that generates this file use display formatsfor output (meaning you have to do nothing). Or, failing that, use a utility program such as DFSORT/SYNCSORT do the conversions for you. Going the utilityroute still requires that you have the original COBOL file layout (and that you understand it) in order to do the conversion.The last resort is simply writing a simple read-a-record-write-a-record COBOL program that takes in the unformatted data, MOVEeseach COMP-whatever field to a corresponding DISPLAY field and write it out again.

As Bill said, if the group that produced this file tells you that it is too difficult/expensive to produce a DISPLAY formattedoutput file they are lying to you or they are incompetent or just too lazy todo the job they were hired to do. I can think of no other excuses.


Use XML to transport data.

That is, write a program that converts your file into characters (if on mainframe, stay with the EBCIDIC but numeric fields are unpacked, etc.) and then enclose each record and each field in XML tags.

This avoids formatting issues (what field is in column 1, what field in column 2, are the delimters spaces or commas or either, etc. ad nauseum).

Then transmit the XML file with your favorite utility that converts from EBCIDIC to ASCII.

JackCColemanJackCColeman
3,4001 gold badge11 silver badges18 bronze badges

Not the answer you're looking for? Browse other questions tagged cmainframeflat-file or ask your own question.