Author: Robert Sample
Posted: Wed Jul 27, 2016 9:25 pm (GMT 5.5)
With Enterprise COBOL, when you move a PIC X(4) variable to a PIC 9(4) variable, the compiler generates code to ensure the sign is correct and hence forces the last byte's zone to be X'F?'(which indicates an unsigned value) and F0 is an EBCDIC zero. This will actually be an issue for ANY move of PIC X to PIC 9 -- it is NOT just limited to 4-byte variables.
You have several options:
1. Get rid of the RIDICULOUS requirement that the output of the Unix program match exactly the output of the mainframe program.
2. Investigate the Unix COBOL compiler to see if it has an option to force signs like the Enterprise COBOL compiler.
3. Hard-code moves as you indicated you could -- but this can get complicated, depending upon your data.
And, by the by, a Unix system will NOT put out X'40404040' or X'404040F0' in any case -- since Unix systems use ASCII, you should be seeing X'20202020' for 4 spaces. If you are not, then you have MUCH bigger problems -- such as why is the Unix system not using ASCII?
_________________
TANSTAAFL
The first rule of code reuse is that the code needs to be worth re-using.
"We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil." -- Donald Knuth
Posted: Wed Jul 27, 2016 9:25 pm (GMT 5.5)
With Enterprise COBOL, when you move a PIC X(4) variable to a PIC 9(4) variable, the compiler generates code to ensure the sign is correct and hence forces the last byte's zone to be X'F?'(which indicates an unsigned value) and F0 is an EBCDIC zero. This will actually be an issue for ANY move of PIC X to PIC 9 -- it is NOT just limited to 4-byte variables.
You have several options:
1. Get rid of the RIDICULOUS requirement that the output of the Unix program match exactly the output of the mainframe program.
2. Investigate the Unix COBOL compiler to see if it has an option to force signs like the Enterprise COBOL compiler.
3. Hard-code moves as you indicated you could -- but this can get complicated, depending upon your data.
And, by the by, a Unix system will NOT put out X'40404040' or X'404040F0' in any case -- since Unix systems use ASCII, you should be seeing X'20202020' for 4 spaces. If you are not, then you have MUCH bigger problems -- such as why is the Unix system not using ASCII?
_________________
TANSTAAFL
The first rule of code reuse is that the code needs to be worth re-using.
"We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil." -- Donald Knuth