cobol - Change display format from character mode to numeric mode -
the value in variable var -1, , when trying write file, gets displayed j(character mode), equivalent -1.
the var defined in cobol program copybook below:
10 var pic s9(1).
is there way, change display format character "j" -1, in output file.
the information found googling below:
value +0 character {
value -0 character }
value +1 character a
to convert zoned ascii field results ebcdic ascii character translation leading sign numeric field, inspect last digit in field. if it's "{" replace last digit 0 , make number positive. if it's "a" replace last digit 1 , make number positive, if it's "b" replace last digit 2 , make number positive, etc., etc. if last digit "}" replace last digit 0 , make number negative. if it's "j" replace last digit 1 , make number negative, if it's "k" replace last digit 2 , make number negative, etc., etc. follow these rules possible values. look-up table or if or case statements. use whatever method suits best language using. in cases should put sign before first digit in field. called floating sign, , pc programs expect. example, if field 6 bytes, value -123 should read " -123" not "- 123".
it might simpler move ebcdic output (display) field ebcdic characters, , convert ascii , write it.
for example
10 var pic s9(1). 10 ws-sepsign pic s9(1) sign leading separate. 10 ws-disp redefines ws-sepsign pic xx. move var ws-sepsign.
then convert ws-out ascii using standard lookup table , write file.
Comments
Post a Comment