When trying to make a Date readable we sometimes use numeric-edited field,e.g.
01 Date-Readable pic 99.99.99.
Decimal-Point is comma is in effect. Although this solution is not how the decimal point is meant to be it works for us.
In the following example there are different types of moving values in the numeric-edit field.
The result for the first three examples ist what we expected, but the last example (move from group) behaves different, although group is defined as alphanumeric.
SO we expected that the "move from group" delivers the same result as the "move from alphanumeric". Any ideas for this result?
We are using Visual COBOL for Eclipse 9.0 Version 9.0.00179, Update level PU 06
IDENTIFICATION DIVISION.
PROGRAM-ID.
ALB0034.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SPECIAL-NAMES.
DECIMAL-POINT IS COMMA.
DATA DIVISION.
WORKING-STORAGE SECTION.
* numeric edited
01 ws-date-with-point-ne pic 99.99.99.
* numeric
01 ws-date-without-point-n pic 9(06) value 210525.
* alphanumeric
01 ws-date-without-point-a pic x(06) value '210525'.
* group (alphanumeric)
01 ws-date-group.
05 filler pic 9(02) value 21.
05 filler pic 9(02) value 05.
05 filler pic 9(02) value 25.
*=================================================================
PROCEDURE DIVISION.
S000-Steuerung SECTION.
S000-01.
move ws-date-without-point-n to ws-date-with-point-ne
display "move numeric: " ws-date-with-point-ne
*
move ws-date-without-point-a to ws-date-with-point-ne
display "move alpha: " ws-date-with-point-ne
*
compute ws-date-with-point-ne
= ws-date-without-point-n
display "compute: " ws-date-with-point-ne
*
move ws-date-group to ws-date-with-point-ne
display "move group: " ws-date-with-point-ne
.
S000-99.
stop run.
END PROGRAM ALB0034.
**Result:
move numeric: 21.05.25
move alpha: 21.05.25
compute: 21.05.25
move group: 210525
I think you are running into behavior of group moves where conversions are not done for you. If you read the documentation for the MOVE statement very carefully you will see there are conversions performed for elementary moves but your third MOVE statement is not an elementary move so those conversions are not performed. See rule #5 under "General Rules for All Formats".
If you instead code...
IDENTIFICATION DIVISION.
PROGRAM-ID.
ALB0034.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SPECIAL-NAMES.
DECIMAL-POINT IS COMMA.
DATA DIVISION.
WORKING-STORAGE SECTION.
* numeric edited
01 ws-date-with-point-ne pic 99.99.99.
* numeric
01 ws-date-without-point-n pic 9(06) value 210525.
* alphanumeric
01 ws-date-without-point-a pic x(06) value '210525'.
* group (alphanumeric)
01 ws-date-group.
05 filler pic 9(02) value 21.
05 filler pic 9(02) value 05.
05 filler pic 9(02) value 25.
* elementary version of group (alphanumeric) NOTE redefinition
01 ws-date-group-r redefines ws-date-group pic 9(6).
*=================================================================
PROCEDURE DIVISION.
S000-Steuerung SECTION.
S000-01.
move ws-date-without-point-n to ws-date-with-point-ne
display "move numeric: " ws-date-with-point-ne
*
move ws-date-without-point-a to ws-date-with-point-ne
display "move alpha: " ws-date-with-point-ne
*
compute ws-date-with-point-ne
= ws-date-without-point-n
display "compute: " ws-date-with-point-ne
*
* NOTE move of redefined group
move ws-date-group-r to ws-date-with-point-ne
display "move group: " ws-date-with-point-ne
.
S000-99.
stop run.
END PROGRAM ALB0034.
...then I believe you will get the result you want. Tested with GNUCOBOL 3.2.0.