1

I want to fill my Input file with data manually.

What i'm supposed to put in a field with type PIC 9(11) COMP-3.

Can anyone help me ?

Compo
  • 36,585
  • 5
  • 27
  • 39
Ahmed SEDDIK
  • 149
  • 12
  • Note: this is a follow-up to https://stackoverflow.com/questions/76181950/s0c7-while-moving-pic-911-comp-3-to-pic-911/76182282. It still should be self-contained so please edit the question adding the record structure. – Simon Sobisch May 05 '23 at 14:09
  • A COMP-3 field is packed decimal. As an example, zero with a PIC 9(11) COMP-3 looks like 00000000000F, where each character represents a byte. The F represents an unsigned value. – Gilbert Le Blanc May 05 '23 at 14:16
  • Is your question answered? If yes please mark one answer as "works for me", if not leave comments. – Simon Sobisch May 11 '23 at 08:35

2 Answers2

1

Answer to "how do I place PACKED-DECIMAL data into a file that is read by COBOL, with the record including a table of COMP-3 variables":

You don't. Define the file with only USAGE DISPLAY or USAGE NATIONAL to be able to easily adjust the file. You may use a COBOL conversion program (or external sort program) on the file to convert it to using COMP-3 in the output file.

Or you do, then use an hex editor to add packed-decimal values in like 0x01234f (which would be 1234 unsigned, with whatever decimal place the COBOL definition has). In this case take care to match the defined structure exactly.

Simon Sobisch
  • 6,263
  • 1
  • 18
  • 38
0

You can EDIT your input file with an editor that supports HEX edition, and put the values at the required offset. Remember that packed-values are expressed with two digits per byte. If you're using TSO, you will see something like that bellow. the value 00000001234 represented in three different formats: (col 1:6) PIC 9(11) COMP-3. (col 7:6) PIC S9(11) COMP-3. (col 13:11) PIC 9(11).

As you can see, the first line is what you get when you're viewing the data in standard output (at this line values can be edited just at columns that is not packed). The second and third lines are showing the packed-value (at those lines you can modify the packed-values).

Rui Vieira
  • 125
  • 1
  • 4