Skip to content

Commit

Permalink
WI #2596 Support new compiler directive VSAMOPENFS for Cobol 6.3 (#2597)
Browse files Browse the repository at this point in the history
  • Loading branch information
efr15 authored Nov 20, 2023
1 parent 58a376d commit c1fdd30
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,33 +115,36 @@
*** DIRECTIVE CBL|NOSUPPRESS|NOZC|TEST ([8,31:CBL NOSUPPRESS NOZC TEST]<COMPILER_DIRECTIVE>) ***

-- Line 39 --
[8,33:Invalid/not allowed syntax]<CommentLine>
*** DIRECTIVE CBL|VSAMOPENFS=SUCC|VS=C ([8,33:CBL VSAMOPENFS(SUCC) VS(C)]<COMPILER_DIRECTIVE>) ***

-- Line 40 --
*** DIRECTIVE INVALID SYNTAX -> CBL|AMODE=64 ([8,20:CBL AMODE(64)]<COMPILER_DIRECTIVE>) ***
[8,33:Invalid/not allowed syntax]<CommentLine>

-- Line 41 --
*** DIRECTIVE INVALID SYNTAX -> CBL|ALOWCOPYLOC ([8,22:CBL ALOWCOPYLOC]<COMPILER_DIRECTIVE>) ***
*** DIRECTIVE INVALID SYNTAX -> CBL|AMODE=64 ([8,20:CBL AMODE(64)]<COMPILER_DIRECTIVE>) ***

-- Line 42 --
*** DIRECTIVE INVALID SYNTAX -> CBL|ALOWDEFINE ([8,21:CBL ALOWDEFINE]<COMPILER_DIRECTIVE>) ***
*** DIRECTIVE INVALID SYNTAX -> CBL|ALOWCOPYLOC ([8,22:CBL ALOWCOPYLOC]<COMPILER_DIRECTIVE>) ***

-- Line 43 --
*** DIRECTIVE INVALID SYNTAX -> CBL|LP=64 ([8,17:CBL LP(64)]<COMPILER_DIRECTIVE>) ***
*** DIRECTIVE INVALID SYNTAX -> CBL|ALOWDEFINE ([8,21:CBL ALOWDEFINE]<COMPILER_DIRECTIVE>) ***

-- Line 44 --
*** DIRECTIVE INVALID SYNTAX -> CBL|LP=64 ([8,17:CBL LP(64)]<COMPILER_DIRECTIVE>) ***

-- Line 45 --
[8,21:IDENTIFICATION]<IDENTIFICATION>
[23,30:DIVISION]<DIVISION>
[31,32:. ]<PeriodSeparator>

-- Line 45 --
-- Line 46 --
[8,72:-Reason : AMEELIORATION PROCESS ACTIMAT ]<CommentLine>

-- Line 46 --
-- Line 47 --
[17,23:PERFORM]<PERFORM>
[25,49:PROCESSUS-INDEXATION-IMMO]<UserDefinedWord>
[50,51:. ]<PeriodSeparator>

-- Line 47 --
-- Line 48 --
[8,72:*** PROCESSUS DE MENAGE ]<CommentLine>

Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ CBL COPYLOC, DEFINE(compilation-variable = 1), INITCHECK(LAX), INITIAL
PROCESS SSRANGE,OFFSET
000100 CBL NOCPLC, NODEF, NOIC, INVD(FNC,NOCS), NONUMCHECK, NONC
000110 CBL NOSUPPRESS NOZC TEST
000111 CBL VSAMOPENFS(SUCC) VS(C)
000120*Invalid/not allowed syntax
000130 CBL AMODE(64)
000140 CBL ALOWCOPYLOC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,3 +191,9 @@ Line 0[1,15] <25, Error, Directives> - Invalid syntax for a CBL or PROCESS compi
*** DIRECTIVE INVALID SYNTAX -> CBL|ALOWDEFINE ([1,14:CBL ALOWDEFINE]<COMPILER_DIRECTIVE>) ***
Line 0[1,14] <25, Error, Directives> - Invalid syntax for a CBL or PROCESS compiler directive : each option should be separated by space or comma, and option parameters should be enclosed in parentheses

-- Line 61 --
*** DIRECTIVE CBL|VSAMOPENFS=S ([1,17:CBL VSAMOPENFS(S)]<COMPILER_DIRECTIVE>) ***

-- Line 62 --
*** DIRECTIVE CBL|VS=COMPAT ([1,14:CBL VS(COMPAT)]<COMPILER_DIRECTIVE>) ***

4 changes: 3 additions & 1 deletion TypeCobol.Test/Parser/Scanner/TestTokenTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,9 @@ public static void CheckCblProcessCompilerDirective()
"CBL OFFSET",
"CBL AMODE(64)",
"CBL ALOWCOPYLOC",
"CBL ALOWDEFINE"
"CBL ALOWDEFINE",
"CBL VSAMOPENFS(S)",
"CBL VS(COMPAT)"
};
string result = ScannerUtils.ScanLines(testLines);
ScannerUtils.CheckWithResultFile(result, testName);
Expand Down
14 changes: 13 additions & 1 deletion TypeCobol/Compiler/Directives/IBMCompilerOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ namespace TypeCobol.Compiler.Directives
// “MDECK” on page 332 NOMDECK NOMD|MD|MD(C|NOC)
// “OPTFILE” on page 338 None None
// “THREAD” on page 356 NOTHREAD None
// “VSAMOPENFS” on page 389 VSAMOPENFS(COMPAT) VS(C | S)
// --- Deprecated ---
// “LIB”

Expand Down Expand Up @@ -197,6 +198,7 @@ internal IBMCompilerOptionStatus(IBMCompilerOptionName name)
case IBMCompilerOptionName.THREAD: IsActivated = false; Value = null; break;
case IBMCompilerOptionName.TRUNC: IsActivated = true; Value = "STD"; break;
case IBMCompilerOptionName.VBREF: IsActivated = false; Value = null; break;
case IBMCompilerOptionName.VSAMOPENFS: IsActivated = true; Value = "COMPAT"; break;
case IBMCompilerOptionName.WORD: IsActivated = false; Value = null; break;
case IBMCompilerOptionName.XREF: IsActivated = true; Value = "FULL"; break;
case IBMCompilerOptionName.ZONECHECK: IsActivated = false; Value = null; break;
Expand Down Expand Up @@ -597,6 +599,12 @@ public class IBMCompilerOptions
/// </summary>
public IBMCompilerOptionStatus VBREF { get; private set; }

/// <summary>
/// The VSAMOPENFS option affects the user file status reported from successful VSAM OPEN statements that
/// require verified file integrity check.
/// </summary>
public IBMCompilerOptionStatus VSAMOPENFS { get; private set; }

/// <summary>
/// Use WORD(xxxx) to specify that an alternate reserved-word table is to be used during compilation.
/// </summary>
Expand All @@ -623,7 +631,7 @@ public class IBMCompilerOptions
public IBMCompilerOptionStatus ZWB { get; private set; }

// Conversion of option words in source text to option name enumeration
private readonly IDictionary<string, IBMCompilerOptionStatus> optionWordToOptionName = new Dictionary<string, IBMCompilerOptionStatus>(194, StringComparer.OrdinalIgnoreCase);
private readonly IDictionary<string, IBMCompilerOptionStatus> optionWordToOptionName = new Dictionary<string, IBMCompilerOptionStatus>(196, StringComparer.OrdinalIgnoreCase);

// Deprecated options which are not supported anymore with the corresponding warning message to be displayed
private static readonly IDictionary<string, string> deprecatedOptions = new Dictionary<string, string>(1, StringComparer.OrdinalIgnoreCase);
Expand Down Expand Up @@ -705,6 +713,7 @@ public IBMCompilerOptions()
THREAD = new IBMCompilerOptionStatus(IBMCompilerOptionName.THREAD);
TRUNC = new IBMCompilerOptionStatus(IBMCompilerOptionName.TRUNC);
VBREF = new IBMCompilerOptionStatus(IBMCompilerOptionName.VBREF);
VSAMOPENFS = new IBMCompilerOptionStatus(IBMCompilerOptionName.VSAMOPENFS);
WORD = new IBMCompilerOptionStatus(IBMCompilerOptionName.WORD);
XREF = new IBMCompilerOptionStatus(IBMCompilerOptionName.XREF);
ZONECHECK = new IBMCompilerOptionStatus(IBMCompilerOptionName.ZONECHECK);
Expand Down Expand Up @@ -779,6 +788,7 @@ public IBMCompilerOptions()
optionWordToOptionName["THREAD"] = THREAD; optionWordToOptionName["NOTHREAD"] = THREAD;
optionWordToOptionName["TRUNC"] = TRUNC;
optionWordToOptionName["VBREF"] = VBREF; optionWordToOptionName["NOVBREF"] = VBREF;
optionWordToOptionName["VSAMOPENFS"] = VSAMOPENFS; optionWordToOptionName["VS"] = VSAMOPENFS;
optionWordToOptionName["WORD"] = WORD; optionWordToOptionName["WD"] = WORD; optionWordToOptionName["NOWORD"] = WORD; optionWordToOptionName["NOWD"] = WORD;
optionWordToOptionName["XREF"] = XREF; optionWordToOptionName["X"] = XREF; optionWordToOptionName["NOXREF"] = XREF; optionWordToOptionName["NOX"] = XREF;
optionWordToOptionName["ZONECHECK"] = ZONECHECK; optionWordToOptionName["ZC"] = ZONECHECK; optionWordToOptionName["NOZONECHECK"] = ZONECHECK; optionWordToOptionName["NOZC"] = ZONECHECK;
Expand Down Expand Up @@ -992,6 +1002,8 @@ public enum IBMCompilerOptionName
TRUNC,
/* Use VBREF to get a cross-reference between all verbs used in the source program and the line numbers in which they are used. VBREF also produces a summary of the number of times each verb was used in the program. */
VBREF,
/* The VSAMOPENFS option affects the user file status reported from successful VSAM OPEN statements that require verified file integrity check. */
VSAMOPENFS,
/* Use WORD(xxxx) to specify that an alternate reserved-word table is to be used during compilation. */
WORD,
/* Use XREF to produce a sorted cross-reference listing. */
Expand Down

0 comments on commit c1fdd30

Please sign in to comment.