SidusBrist
SidusBrist

Reputation: 45

C++ interpreting Cobol "Comp-3" values

I'm making a C++ program that, given a Cobol copy and a sequential file, plots the content of the sequential file into a table.

The problem with this is that, for example, "+12345" value in Cobol Comp-3 variables that are structured like this:

 05  COPY-FIELD        PIC S9(05)        COMP-3.

Results in this:

4\

135
24C

If I read the string in C++ and convert it to HEX i get the first byte missing and some differences between what I expected from Cobol, so I can't read the other fields. How could I read the clear bytes from a text file still considering it a string?

Upvotes: 0

Views: 318

Answers (0)

Related Questions