Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
I have a field S9(7)V99 COMP-3 in a file.when i browse that file the value of thet field is like +64.00 ,-64.00,-2395.00.
I have to write it in output file in the same format taht is like
Please suggest me a solution.
Those values are you softwares interpretation of the values not the way they are in the file. if you want COMP-3 values in your file then just define the field as pic s9(7)v99 comp-3 and move the data from the input to the output. If you want like +64.00 ,-64.00,-2395.00 then define it as numeric edited in your output file PIC +,+++,++0.99 and move the data from the input to the output.
Joined: 20 Oct 2006 Posts: 6968 Location: porcelain throne
a PIC S9(7)V99 COMP-3 field containing +64.00 will be a 5 byte field containing X'000006400C'.
if you want the field in the file to look like +64.00 you need to define 2 edit masks: PIC ++++++9.99 and PIC ------9.99.
based on the positive or negative value of the comp-3 field you need to move to one or the other edit mask. an edit mask will only show - or +. not both (used to be). maybe the new cobols provide a multifunction editmask.
I would suggest defining your editmask in the output file definition.
if you want the file to contain a COMP-3 field, then define the output file definition with a comp-3 field.