diff --git a/TypeCobol.Test/Parser/Memory/MemoryNational.MEM.txt b/TypeCobol.Test/Parser/Memory/MemoryNational.MEM.txt index ae3373a7c..492922dbd 100644 --- a/TypeCobol.Test/Parser/Memory/MemoryNational.MEM.txt +++ b/TypeCobol.Test/Parser/Memory/MemoryNational.MEM.txt @@ -3,7 +3,7 @@ Diagnostics None --------- FIELD LEVEL|NAME ---------- START END LENGTH -1 ZONE 1 478 478 +1 ZONE 1 514 514 5 ZONE01 1 20 20 5 ZONE02 21 108 88 10 ZONE03 21 30 10 @@ -40,3 +40,12 @@ Diagnostics 5 ZONE60 435 454 20 5 ZONE61 455 466 12 5 ZONE62 467 478 12 + 5 ZONE70 479 482 4 + 5 ZONE71 483 486 4 + 5 ZONE72 487 490 4 + 5 ZONE80 491 494 4 + 5 ZONE81 495 498 4 + 5 ZONE82 499 502 4 + 5 ZONE90 503 506 4 + 5 ZONE91 507 510 4 + 5 ZONE92 511 514 4 diff --git a/TypeCobol.Test/Parser/Memory/MemoryNational.pgm b/TypeCobol.Test/Parser/Memory/MemoryNational.pgm index de5f6051f..c5063b5ee 100644 --- a/TypeCobol.Test/Parser/Memory/MemoryNational.pgm +++ b/TypeCobol.Test/Parser/Memory/MemoryNational.pgm @@ -41,6 +41,15 @@ WORKING-STORAGE SECTION. 05 ZONE60 PIC N(10) USAGE NATIONAL. 05 ZONE61 PIC 9(03).99 USAGE IS NATIONAL. 05 ZONE62 PIC ZZ9.99 USAGE IS NATIONAL. + 05 ZONE70 PIC BN. + 05 ZONE71 PIC 0N. + 05 ZONE72 PIC /N. + 05 ZONE80 PIC BN USAGE IS NATIONAL. + 05 ZONE81 PIC 0N USAGE IS NATIONAL. + 05 ZONE82 PIC /N USAGE IS NATIONAL. + 05 ZONE90 PIC N(2) USAGE IS DISPLAY-1. + 05 ZONE91 PIC G(2) USAGE IS DISPLAY-1. + 05 ZONE92 PIC GB USAGE IS DISPLAY-1. Procedure Division. goback diff --git a/TypeCobol/Compiler/Types/PictureType.cs b/TypeCobol/Compiler/Types/PictureType.cs index be6a08e9a..73dd96567 100644 --- a/TypeCobol/Compiler/Types/PictureType.cs +++ b/TypeCobol/Compiler/Types/PictureType.cs @@ -113,6 +113,10 @@ public override int Length { add = Sequence.Sum(c => c.SpecialChar == SC.B ? c.Count : 0); } + else if (Category == PictureCategory.NationalEdited) + { + add = Sequence.Sum(c => c.SpecialChar == SC.B || c.SpecialChar == SC.ZERO || c.SpecialChar == SC.SLASH ? c.Count : 0); + } return Size + add; } if (Category == PictureCategory.ExternalFloatingPoint) @@ -169,6 +173,7 @@ public override int Length case SC.S: break; case SC.B: + // Category cannot be NationalEdited if Usage is DISPLAY-1 if (Category == PictureCategory.DBCS) { len += c.Count;//double the size of B. @@ -197,9 +202,11 @@ public override int Length case SC.A: case SC.B: case SC.Z: + case SC.ZERO: case SC.NINE: case SC.DOT: case SC.COMMA: + case SC.SLASH: len += c.Count;//double the size. break; }