FIlling a zone with S9(5)V9(8) COMP-3

96 views Asked by At

I want to fill a file with this type of data.

01 FILE-LINE.
    05   VAR1   PIC S9(5)V9(8) COMP-3.
    05   VAR2   PIC S9(15)V99 COMP-3.

Can anyone help me to fill this lines When i put All '0' on these fields and i test IS NUMERIC, it said that they are not numeric

2

There are 2 answers

1
Rui Vieira On

Because variables VAR1 and VAR2 are packed (COMP-3) and belongs to a group level, you can't move ZEROS to group level FILE-LINE. Instead, you must move ZEROS to VAR1 and VAR2, explicitly.

Moving ALL '0' to FILE-LINE results in X'F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0'.

Moving ZEROS to VAR1 VAR2 results in X'0000000000000C00000000000000000C'.

0
cschneid On

You could try Initialize FILE-LINE.

The rules for INITIALIZE are a bit complicated, but flexibility begets complexity so there you are.

In this case, because you have numeric data items and they don't have VALUE clauses, INITIALIZE will do the equivalent of Move Zeroes To VAR1 and Move Zeroes To VAR2.