01 VLG-1.
02 VLG-1-ODOOBJ PIC 9 VALUE IS 5.
02 VLG-1-GR.
03 VLG-1-ODO PIC X OCCURS 1 TO 9 TIMES
DEPENDING ON VLG-1-ODOOBJ.
77 S-1 PIC X(20) VALUE IS ALL "123456789".
UNSTRING S-1
INTO VLG-1
END-UNSTRING
UNSTRING S-1
INTO VLG-1(1:LENGTH OF VLG-1)
END-UNSTRING
This form forces the actual length of vlg-1 at the beginning of the UNSTRING statement to be used.
This correction is not affected by the presence of any of the optional phrases of the UNSTRING statement (DELIMITED BY, WITH POINTER, ON OVERFLOW) and it applies equally to all flagged identifiers in any one UNSTRING statement.
For an UNSTRING statement to be affected by this change, the flagged DELIMITED BY operand must depend on one of the INTO receivers.
01 DEL
02 OCC-DEL-1 PIC X OCCURS 9 TIMES.
02 VLEN-DEL-2-ODOOBJ PIC 9 VALUE IS 5.
02 VLEN-DEL-2.
03 VLEN-DEL-2-ODO PIC X OCCURS 1 TO 9 TIMES
DEPENDING ON VLEN-DEL-2-ODOOBJ.
77 S-1 PIC X(20) VALUE IS ALL "123456789".
77 R-1 PIC X(20) VALUE IS SPACES.
77 R-2 PIC X(20) VALUE IS SPACES.
77 SUB-5 PIC 99 VALUE IS 5.
UNSTRING S-1
DELIMITED BY OCC-DEL-1(SUB-5) OR VLEN-DEL-2,
INTO R-1 DELIMITER IN OCC-DEL-1(SUB-5 + 1)
COUNT IN VLEN-DEL-2-ODOOBJ,
R-2,
END-UNSTRING
No corrections are required for items flagged with message 3211.
For an UNSTRING statement to be affected by this change, the flagged INTO identifier must depend on one of the receivers in a preceding INTO phrase.
01 REC.
02 R-1 PIC X(20) VALUE IS SPACES.
02 R-2-SUB PIC 9 VALUE IS 9.
02 OCC-R-2-GR.
03 OCC-R-2 PIC X OCCURS 9 TIMES.
02 R-3-ODOOBJ PIC 9 VALUE IS 9.
02 ODO-R-3.
03 FILLER PIC X OCCURS 1 TO 9 TIMES
DEPENDING ON R-3-ODOOBJ.
77 S-3 PIC X(20) VALUE IS "12 345 6789 .....".
UNSTRING S-3
DELIMITED BY ALL SPACES,
INTO R-1 COUNT IN R-2-SUB,
OCC-R-2(R-2-SUB) COUNT IN R-3-ODOOBJ,
ODO-R-3,
END-UNSTRING
This UNSTRING statement will generate different results under CMPR2 and NOCMPR2 because the subscript of the second INTO receiver is modified by the COUNT IN receiver of the first INTO phrase. In addition, the length of the third INTO receiver is modified by the COUNT IN receiver of the second INTO phrase.
Under CMPR2, the values that are moved to the COUNT IN identifiers will be used for the subsequent INTO phrases. Under NOCMPR2, the values in effect at the beginning of the execution of the UNSTRING statement will be used for all INTO phrases.
77 PTR PIC 99.
MOVE 1 TO PTR
UNSTRING S-3
DELIMITED BY ALL SPACES,
INTO R-1 COUNT IN R-2-SUB,
WITH POINTER PTR,
END-UNSTRING
UNSTRING S-3
DELIMITED BY ALL SPACES,
INTO OCC-R-2(R-2-SUB) COUNT IN R-3-ODOOBJ,
WITH POINTER PTR,
END-UNSTRING
UNSTRING S-3
DELIMITED BY ALL SPACES,
INTO ODO-R-3,
WITH POINTER PTR,
END-UNSTRING
For an UNSTRING statement to be affected by this change, the flagged DELIMITER IN identifier must depend on one of the receivers in a preceding INTO phrase.
01 DEL.
02 D-2-SUB PIC 9 VALUE IS 9.
02 OCC-D-2-GR.
03 OCC-D-2 PIC X OCCURS 9 TIMES.
02 D-3-ODOOBJ PIC 9 VALUE IS 9.
02 ODO-D-3.
03 FILLER PIC X OCCURS 1 TO 9 TIMES
DEPENDING ON D-3-ODOOBJ.
77 S-4 PIC X(20) VALUE IS "12 345 6789 .....".
77 R-1 PIC X(20) VALUE IS SPACES.
77 R-2 PIC X(20) VALUE IS SPACES.
77 R-3 PIC X(20) VALUE IS SPACES.
UNSTRING S-4
DELIMITED BY ALL SPACES,
INTO R-1 COUNT IN D-2-SUB,
R-2 DELIMITER IN OCC-D-2(D-2-SUB)
COUNT IN D-3-ODOOBJ,
R-3 DELIMITER IN ODO-D-3,
END-UNSTRING
This UNSTRING statement will generate different results under CMPR2 and NOCMPR2 because the subscript of the DELIMITER IN identifier of the second INTO phrase is modified by the COUNT IN receiver of the first INTO phrase. In addition, the length of the DELIMITER IN identifier of the third INTO phrase is modified by the COUNT IN receiver of the second INTO phrase.
With CMPR2 behavior, the values that are moved to the COUNT IN identifiers will be used for the subsequent INTO phrases. With NOCMPR2, the values in effect at the beginning of the execution of the UNSTRING statement will be used for all INTO phrases.
Any UNSTRING statement flagged with message 3213 must be broken into multiple UNSTRING statements; a separate UNSTRING statement must be used for each dependent INTO phrase.
77 PTR PIC 99.
MOVE 1 TO PTR
UNSTRING S-4
DELIMITED BY ALL SPACES,
INTO R-1 COUNT IN D-2-SUB,
WITH POINTER PTR,
END-UNSTRING
UNSTRING S-4
DELIMITED BY ALL SPACES,
INTO R-2 DELIMITER IN OCC-D-2(D-2-SUB)
COUNT IN D-3-ODOOBJ,
WITH POINTER PTR,
END-UNSTRING
UNSTRING S-4
DELIMITED BY ALL SPACES,
INTO R-3 DELIMITER IN ODO-D-3,
WITH POINTER PTR,
END-UNSTRING
For an UNSTRING statement to be affected by this change, the flagged COUNT IN identifier must depend on one of the receivers in a preceding INTO phrase.
01 C-2.
02 C-2-SUB PIC 9 VALUE IS 9.
02 OCC-C-2-GR.
03 OCC-C-2 PIC 9 OCCURS 9 TIMES.
77 S-5 PIC X(20) VALUE IS "12 345 6789........".
77 R-1 PIC X(20) VALUE IS SPACES.
77 R-2 PIC X(20) VALUE IS SPACES.
UNSTRING S-5
DELIMITED BY ALL SPACES,
INTO R-1 COUNT IN C-2-SUB,
R-2 COUNT IN OCC-C-2(C-2-SUB),
END-UNSTRING
This UNSTRING statement will generate different results under CMPR2 and NOCMPR2 because the subscript of the COUNT IN identifier of the second INTO phrase is modified by the COUNT IN receiver of the first INTO phrase.
With CMPR2 behavior, the values that are moved to the COUNT IN identifier in the first INTO phrase will be used for the second INTO phrase. With NOCMPR2, the value in effect at the beginning of execution of the UNSTRING statement will be used.
Any UNSTRING statement flagged with message 3214 must be broken into multiple UNSTRING statements; a separate UNSTRING statement must be used for each dependent INTO phrase.
77 PTR PIC 99.
MOVE 1 TO PTR
UNSTRING S-5
DELIMITED BY ALL SPACES,
INTO R-1 COUNT IN C-2-SUB,
WITH POINTER PTR,
END-UNSTRING
UNSTRING S-5
DELIMITED BY ALL SPACES,
INTO R-2 COUNT IN OCC-C-2(C-2-SUB),
WITH POINTER PTR,
END-UNSTRING