From 0d8e2407b4cde57e523f1689c0a3c3d8ef541306 Mon Sep 17 00:00:00 2001 From: cosentino-smeup <32836304+cosentino-smeup@users.noreply.github.com> Date: Fri, 9 Feb 2024 13:39:02 +0000 Subject: [PATCH 1/4] Implement %CHECK BIF --- .../smeup/rpgparser/interpreter/Evaluator.kt | 1 + .../interpreter/ExpressionEvaluation.kt | 22 ++++ .../parsing/ast/builtin_functions.kt | 11 ++ .../rpgparser/parsing/ast/serialization.kt | 1 + .../rpgparser/parsing/parsetreetoast/bif.kt | 10 ++ .../evaluation/SmeupInterpreterTest.kt | 23 ++++ .../src/test/resources/smeup/T04_A15.rpgle | 110 ++++++++++++++++++ 7 files changed, 178 insertions(+) create mode 100644 rpgJavaInterpreter-core/src/test/resources/smeup/T04_A15.rpgle diff --git a/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/Evaluator.kt b/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/Evaluator.kt index 5da23544d..ebfe57b89 100644 --- a/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/Evaluator.kt +++ b/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/Evaluator.kt @@ -51,6 +51,7 @@ interface Evaluator { fun eval(expression: NotExpr): BooleanValue fun eval(expression: ScanExpr): Value fun eval(expression: SubstExpr): Value + fun eval(expression: CheckExpr): Value fun eval(expression: SubarrExpr): Value fun eval(expression: LenExpr): Value fun eval(expression: OffRefExpr): BooleanValue diff --git a/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/ExpressionEvaluation.kt b/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/ExpressionEvaluation.kt index fce6cd237..f807849e4 100644 --- a/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/ExpressionEvaluation.kt +++ b/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/ExpressionEvaluation.kt @@ -325,6 +325,28 @@ class ExpressionEvaluation( val result = source.indexOf(value, startIndex) return IntValue(if (result == -1) 0 else result.toLong() + 1) } + override fun eval(expression: CheckExpr): Value { + var startpos = 0 + if (expression.start != null) { + startpos = expression.start.evalWith(this).asInt().value.toInt() + if (startpos > 0) { + startpos -= 1 + } + } + val comparator = expression.value.evalWith(this).asString().value + val base = expression.source.evalWith(this).asString().value.toCharArray() + + var result = 0 + for (i in startpos until base.size) { + val currChar = base[i] + if (!comparator.contains(currChar)) { + result = i + 1 + break + } + } + + return IntValue(result.toLong()) + } override fun eval(expression: SubstExpr): Value { val length = if (expression.length != null) expression.length.evalWith(this).asInt().value.toInt() else 0 diff --git a/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/parsing/ast/builtin_functions.kt b/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/parsing/ast/builtin_functions.kt index dfcd8ba39..cac6ad7e8 100644 --- a/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/parsing/ast/builtin_functions.kt +++ b/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/parsing/ast/builtin_functions.kt @@ -50,6 +50,17 @@ data class ScanExpr( override fun evalWith(evaluator: Evaluator): Value = evaluator.eval(this) } +// %CHECK +@Serializable +data class CheckExpr( + var value: Expression, + val source: Expression, + val start: Expression? = null, + override val position: Position? = null +) : Expression(position) { + override fun evalWith(evaluator: Evaluator): Value = evaluator.eval(this) +} + // %XLATE @Serializable data class TranslateExpr( diff --git a/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/parsing/ast/serialization.kt b/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/parsing/ast/serialization.kt index ce0574210..d6028443e 100644 --- a/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/parsing/ast/serialization.kt +++ b/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/parsing/ast/serialization.kt @@ -106,6 +106,7 @@ private val modules = SerializersModule { subclass(AssignmentExpr::class) subclass(BlanksRefExpr::class) subclass(CharExpr::class) + subclass(CheckExpr::class) subclass(DataRefExpr::class) subclass(DecExpr::class) subclass(DiffExpr::class) diff --git a/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/parsing/parsetreetoast/bif.kt b/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/parsing/parsetreetoast/bif.kt index 8aab790e8..59a0dfce1 100644 --- a/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/parsing/parsetreetoast/bif.kt +++ b/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/parsing/parsetreetoast/bif.kt @@ -31,6 +31,7 @@ internal fun RpgParser.BifContext.toAst(conf: ToAstConfiguration = ToAstConfigur this.bif_lookup() != null -> this.bif_lookup().toAst(conf) this.bif_xlate() != null -> this.bif_xlate().toAst(conf) this.bif_scan() != null -> this.bif_scan().toAst(conf) + this.bif_check() != null -> this.bif_check().toAst(conf) this.bif_trim() != null -> this.bif_trim().toAst(conf) this.bif_trimr() != null -> this.bif_trimr().toAst(conf) this.bif_triml() != null -> this.bif_triml().toAst(conf) @@ -213,6 +214,15 @@ internal fun RpgParser.Bif_scanContext.toAst(conf: ToAstConfiguration = ToAstCon ) } +internal fun RpgParser.Bif_checkContext.toAst(conf: ToAstConfiguration = ToAstConfiguration()): CheckExpr { + return CheckExpr( + value = this.comparator.toAst(conf), + source = this.base.toAst(conf), + start = this.start?.toAst(conf), + toPosition(conf.considerPosition) + ) +} + internal fun RpgParser.Bif_xlateContext.toAst(conf: ToAstConfiguration = ToAstConfiguration()): TranslateExpr { return TranslateExpr( this.from.toAst(conf), diff --git a/rpgJavaInterpreter-core/src/test/kotlin/com/smeup/rpgparser/evaluation/SmeupInterpreterTest.kt b/rpgJavaInterpreter-core/src/test/kotlin/com/smeup/rpgparser/evaluation/SmeupInterpreterTest.kt index f060f8edc..89ed03370 100644 --- a/rpgJavaInterpreter-core/src/test/kotlin/com/smeup/rpgparser/evaluation/SmeupInterpreterTest.kt +++ b/rpgJavaInterpreter-core/src/test/kotlin/com/smeup/rpgparser/evaluation/SmeupInterpreterTest.kt @@ -319,4 +319,27 @@ open class SmeupInterpreterTest : AbstractTest() { "CALL(MULANGTC30, 7 , 0)") assertEquals(expected, "smeup/T10_A60_P04-P07".outputOf()) } + + @Test + fun executeT04_A15() { + val expected = listOf( + "P01_01(8)", + "P01_02(13)", + "P01_03(16)", + "P01_04(2)", + "P01_05(1)", + "P01_06(1)", + "P01_07(0)", + "P01_08(2)", + "P01_09(2)", + "P01_10(1)", + "P01_11(2)", + "P01_12(0)", + "P02_01(10)", + "P02_02(6)", + "P03_01(0)", + "P03_02(1)" + ) + assertEquals(expected, "smeup/T04_A15".outputOf()) + } } \ No newline at end of file diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/T04_A15.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/T04_A15.rpgle new file mode 100644 index 000000000..6e96f9e66 --- /dev/null +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/T04_A15.rpgle @@ -0,0 +1,110 @@ + D name S 30A + D name2 S 4A + D pos S 5U 0 + D £DBG_Str S 30 + D £DBG_Pas S 3 + D alphabet C 'ABCDEFGHIJKLMNOPQRSTUVWXYZ + + D abcdefghijklmnopqrstuvwxyz + + D 0123456789+/' + * + C EXSR SEZ_T04_A15 + * + C SETON LR + *--------------------------------------------------------------- + RD* Errori programma MULANGT04 sezione A15 + *--------------------------------------------------------------* + C SEZ_T04_A15 BEGSR + OA* A&.BIFN(%CHECK) + D* %CHECK semplice + C EVAL £DBG_Pas='P01' + * + C EVAL name = ' Amit Jaiswal' + C EVAL pos = %check(' ' : name) + C EVAL £DBG_Str='P01_01('+%char(pos)+')' + C £DBG_Str DSPLY + * + C EVAL name = ' Amit Jaiswal' + C EVAL pos = %check(' Atim' : name) + C EVAL £DBG_Str='P01_02('+%char(pos)+')' + C £DBG_Str DSPLY + * + C EVAL name = ' Amit Jaiswal' + C EVAL pos = %check(' Amit Jai' : name) + C EVAL £DBG_Str='P01_03('+%char(pos)+')' + C £DBG_Str DSPLY + * + C EVAL name = 'Amit Jaiswal' + C EVAL pos = %check('A' : name) + C EVAL £DBG_Str='P01_04('+%char(pos)+')' + C £DBG_Str DSPLY + * + C EVAL name = 'Amit Jaiswal' + C EVAL pos = %check('a' : name) + C EVAL £DBG_Str='P01_05('+%char(pos)+')' + C £DBG_Str DSPLY + * + C EVAL name = 'Amit Jaiswal' + C EVAL pos = %check('ab' : name) + C EVAL £DBG_Str='P01_06('+%char(pos)+')' + C £DBG_Str DSPLY + * + C EVAL name2 = 'abab' + C EVAL pos = %check('ab' : name2) + C EVAL £DBG_Str='P01_07('+%char(pos)+')' + C £DBG_Str DSPLY + * + C EVAL name2 = 'abab' + C EVAL pos = %check('ac' : name2) + C EVAL £DBG_Str='P01_08('+%char(pos)+')' + C £DBG_Str DSPLY + * + C EVAL name2 = 'abab' + C EVAL pos = %check('acd' : name2) + C EVAL £DBG_Str='P01_09('+%char(pos)+')' + C £DBG_Str DSPLY + * + C EVAL name2 = 'abab' + C EVAL pos = %check('cd' : name2) + C EVAL £DBG_Str='P01_10('+%char(pos)+')' + C £DBG_Str DSPLY + * + C EVAL name2 = 'abab' + C EVAL pos = %check('ca' : name2) + C EVAL £DBG_Str='P01_11('+%char(pos)+')' + C £DBG_Str DSPLY + * + C EVAL name2 = 'abab' + C EVAL pos = %check('cab' : name2) + C EVAL £DBG_Str='P01_12('+%char(pos)+')' + C £DBG_Str DSPLY + * + OA* A&.BIFN(%CHECK) + D* %CHECK con posizione + C EVAL £DBG_Pas='P02' + * + C EVAL name = 'Amit Jaiswal' + C EVAL pos = %check('Jais' : name:6) + C EVAL £DBG_Str='P02_01('+%char(pos)+')' + C £DBG_Str DSPLY + * + C EVAL name = 'Amit Jaiswal' + C EVAL pos = %check('A' : name:6) + C EVAL £DBG_Str='P02_02('+%char(pos)+')' + C £DBG_Str DSPLY + * + * + OA* A&.BIFN(%CHECK) + D* %CHECK ricerca in alfabeto + C EVAL £DBG_Pas='P03' + * + C EVAL name = 'Amit Jaiswal' + C EVAL pos = %check(alphabet: name) + C EVAL £DBG_Str='P03_01('+%char(pos)+')' + C £DBG_Str DSPLY + * + C EVAL name = '££ t abc1234' + C EVAL pos = %check(alphabet: name) + C EVAL £DBG_Str='P03_02('+%char(pos)+')' + C £DBG_Str DSPLY + * + C ENDSR \ No newline at end of file From 986fc24ba40a0081613e6edc9829627b2e0e6631 Mon Sep 17 00:00:00 2001 From: cosentino-smeup <32836304+cosentino-smeup@users.noreply.github.com> Date: Fri, 9 Feb 2024 14:13:09 +0000 Subject: [PATCH 2/4] add IF test with %CHECK --- .../com/smeup/rpgparser/evaluation/SmeupInterpreterTest.kt | 3 ++- .../src/test/resources/smeup/T04_A15.rpgle | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/rpgJavaInterpreter-core/src/test/kotlin/com/smeup/rpgparser/evaluation/SmeupInterpreterTest.kt b/rpgJavaInterpreter-core/src/test/kotlin/com/smeup/rpgparser/evaluation/SmeupInterpreterTest.kt index 89ed03370..8c2a9ceef 100644 --- a/rpgJavaInterpreter-core/src/test/kotlin/com/smeup/rpgparser/evaluation/SmeupInterpreterTest.kt +++ b/rpgJavaInterpreter-core/src/test/kotlin/com/smeup/rpgparser/evaluation/SmeupInterpreterTest.kt @@ -338,7 +338,8 @@ open class SmeupInterpreterTest : AbstractTest() { "P02_01(10)", "P02_02(6)", "P03_01(0)", - "P03_02(1)" + "P03_02(1)", + "P03_03(ok)" ) assertEquals(expected, "smeup/T04_A15".outputOf()) } diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/T04_A15.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/T04_A15.rpgle index 6e96f9e66..5f13082c0 100644 --- a/rpgJavaInterpreter-core/src/test/resources/smeup/T04_A15.rpgle +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/T04_A15.rpgle @@ -105,6 +105,13 @@ C EVAL name = '££ t abc1234' C EVAL pos = %check(alphabet: name) C EVAL £DBG_Str='P03_02('+%char(pos)+')' + C £DBG_Str DSPLY + * + C IF %CHECK(alphabet: 'Antonio Cosentino')= 0 + C EVAL £DBG_Str='P03_03(ok)' + C ELSE + C EVAL £DBG_Str='P03_03(ko)' + C ENDIF C £DBG_Str DSPLY * C ENDSR \ No newline at end of file From 92bfc5c7e40a9a4390bf2a3e5ad83d3c9d60d5c2 Mon Sep 17 00:00:00 2001 From: cosentino-smeup <32836304+cosentino-smeup@users.noreply.github.com> Date: Tue, 13 Feb 2024 10:30:20 +0000 Subject: [PATCH 3/4] add BIFCHECK --- .../smeup/rpgparser/evaluation/InterpreterTest.kt | 5 +++++ .../src/test/resources/BIFCHECK.rpgle | 15 +++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 rpgJavaInterpreter-core/src/test/resources/BIFCHECK.rpgle diff --git a/rpgJavaInterpreter-core/src/test/kotlin/com/smeup/rpgparser/evaluation/InterpreterTest.kt b/rpgJavaInterpreter-core/src/test/kotlin/com/smeup/rpgparser/evaluation/InterpreterTest.kt index 1425e8d06..ef4519653 100644 --- a/rpgJavaInterpreter-core/src/test/kotlin/com/smeup/rpgparser/evaluation/InterpreterTest.kt +++ b/rpgJavaInterpreter-core/src/test/kotlin/com/smeup/rpgparser/evaluation/InterpreterTest.kt @@ -2222,4 +2222,9 @@ Test 6 val expected = listOf("0", "1", "0", "1", "0", "1", "0", "1", "0", "1", "0", "1") assertEquals(expected, "INDIC02".outputOf()) } + + @Test + fun executeBIFCHECK() { + assertEquals(listOf("ok"), outputOf("BIFCHECK")) + } } diff --git a/rpgJavaInterpreter-core/src/test/resources/BIFCHECK.rpgle b/rpgJavaInterpreter-core/src/test/resources/BIFCHECK.rpgle new file mode 100644 index 000000000..93faeadbb --- /dev/null +++ b/rpgJavaInterpreter-core/src/test/resources/BIFCHECK.rpgle @@ -0,0 +1,15 @@ + D name S 30A + D name2 S 4A + D pos S 5U 0 + D £DBG_Str S 30 + D £DBG_Pas S 3 + D alphabet C 'ABCDEFGHIJKLMNOPQRSTUVWXYZ + + D abcdefghijklmnopqrstuvwxyz + + D 0123456789+/' + * + C IF %CHECK(alphabet: 'Antonio Cosentino 123')= 0 + C EVAL £DBG_Str='ok' + C ELSE + C EVAL £DBG_Str='ko' + C ENDIF + C £DBG_Str DSPLY From 9a6e99bcb578348104e8fae52d31bbb202d52ba3 Mon Sep 17 00:00:00 2001 From: cosentino-smeup <32836304+cosentino-smeup@users.noreply.github.com> Date: Tue, 13 Feb 2024 10:42:13 +0000 Subject: [PATCH 4/4] split T04_15 into 3 tests --- .../evaluation/SmeupInterpreterTest.kt | 22 ++++++-- .../{T04_A15.rpgle => T04_A15_P01.rpgle} | 51 +------------------ .../test/resources/smeup/T04_A15_P02.rpgle | 18 +++++++ .../test/resources/smeup/T04_A15_P03.rpgle | 28 ++++++++++ 4 files changed, 65 insertions(+), 54 deletions(-) rename rpgJavaInterpreter-core/src/test/resources/smeup/{T04_A15.rpgle => T04_A15_P01.rpgle} (60%) create mode 100644 rpgJavaInterpreter-core/src/test/resources/smeup/T04_A15_P02.rpgle create mode 100644 rpgJavaInterpreter-core/src/test/resources/smeup/T04_A15_P03.rpgle diff --git a/rpgJavaInterpreter-core/src/test/kotlin/com/smeup/rpgparser/evaluation/SmeupInterpreterTest.kt b/rpgJavaInterpreter-core/src/test/kotlin/com/smeup/rpgparser/evaluation/SmeupInterpreterTest.kt index 8c2a9ceef..fe10c6e46 100644 --- a/rpgJavaInterpreter-core/src/test/kotlin/com/smeup/rpgparser/evaluation/SmeupInterpreterTest.kt +++ b/rpgJavaInterpreter-core/src/test/kotlin/com/smeup/rpgparser/evaluation/SmeupInterpreterTest.kt @@ -321,7 +321,7 @@ open class SmeupInterpreterTest : AbstractTest() { } @Test - fun executeT04_A15() { + fun executeT04_A15_P01() { val expected = listOf( "P01_01(8)", "P01_02(13)", @@ -334,13 +334,27 @@ open class SmeupInterpreterTest : AbstractTest() { "P01_09(2)", "P01_10(1)", "P01_11(2)", - "P01_12(0)", + "P01_12(0)" + ) + assertEquals(expected, "smeup/T04_A15_P01".outputOf()) + } + + @Test + fun executeT04_A15_P02() { + val expected = listOf( "P02_01(10)", - "P02_02(6)", + "P02_02(6)" + ) + assertEquals(expected, "smeup/T04_A15_P02".outputOf()) + } + + @Test + fun executeT04_A15_P03() { + val expected = listOf( "P03_01(0)", "P03_02(1)", "P03_03(ok)" ) - assertEquals(expected, "smeup/T04_A15".outputOf()) + assertEquals(expected, "smeup/T04_A15_P03".outputOf()) } } \ No newline at end of file diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/T04_A15.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/T04_A15_P01.rpgle similarity index 60% rename from rpgJavaInterpreter-core/src/test/resources/smeup/T04_A15.rpgle rename to rpgJavaInterpreter-core/src/test/resources/smeup/T04_A15_P01.rpgle index 5f13082c0..ce86bdbd9 100644 --- a/rpgJavaInterpreter-core/src/test/resources/smeup/T04_A15.rpgle +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/T04_A15_P01.rpgle @@ -3,19 +3,6 @@ D pos S 5U 0 D £DBG_Str S 30 D £DBG_Pas S 3 - D alphabet C 'ABCDEFGHIJKLMNOPQRSTUVWXYZ + - D abcdefghijklmnopqrstuvwxyz + - D 0123456789+/' - * - C EXSR SEZ_T04_A15 - * - C SETON LR - *--------------------------------------------------------------- - RD* Errori programma MULANGT04 sezione A15 - *--------------------------------------------------------------* - C SEZ_T04_A15 BEGSR - OA* A&.BIFN(%CHECK) - D* %CHECK semplice C EVAL £DBG_Pas='P01' * C EVAL name = ' Amit Jaiswal' @@ -78,40 +65,4 @@ C EVAL £DBG_Str='P01_12('+%char(pos)+')' C £DBG_Str DSPLY * - OA* A&.BIFN(%CHECK) - D* %CHECK con posizione - C EVAL £DBG_Pas='P02' - * - C EVAL name = 'Amit Jaiswal' - C EVAL pos = %check('Jais' : name:6) - C EVAL £DBG_Str='P02_01('+%char(pos)+')' - C £DBG_Str DSPLY - * - C EVAL name = 'Amit Jaiswal' - C EVAL pos = %check('A' : name:6) - C EVAL £DBG_Str='P02_02('+%char(pos)+')' - C £DBG_Str DSPLY - * - * - OA* A&.BIFN(%CHECK) - D* %CHECK ricerca in alfabeto - C EVAL £DBG_Pas='P03' - * - C EVAL name = 'Amit Jaiswal' - C EVAL pos = %check(alphabet: name) - C EVAL £DBG_Str='P03_01('+%char(pos)+')' - C £DBG_Str DSPLY - * - C EVAL name = '££ t abc1234' - C EVAL pos = %check(alphabet: name) - C EVAL £DBG_Str='P03_02('+%char(pos)+')' - C £DBG_Str DSPLY - * - C IF %CHECK(alphabet: 'Antonio Cosentino')= 0 - C EVAL £DBG_Str='P03_03(ok)' - C ELSE - C EVAL £DBG_Str='P03_03(ko)' - C ENDIF - C £DBG_Str DSPLY - * - C ENDSR \ No newline at end of file + C SETON LR \ No newline at end of file diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/T04_A15_P02.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/T04_A15_P02.rpgle new file mode 100644 index 000000000..d54c7dbf4 --- /dev/null +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/T04_A15_P02.rpgle @@ -0,0 +1,18 @@ + D name S 30A + D pos S 5U 0 + D £DBG_Str S 30 + D £DBG_Pas S 3 + * + C EVAL £DBG_Pas='P02' + * + C EVAL name = 'Amit Jaiswal' + C EVAL pos = %check('Jais' : name:6) + C EVAL £DBG_Str='P02_01('+%char(pos)+')' + C £DBG_Str DSPLY + * + C EVAL name = 'Amit Jaiswal' + C EVAL pos = %check('A' : name:6) + C EVAL £DBG_Str='P02_02('+%char(pos)+')' + C £DBG_Str DSPLY + * + C SETON LR \ No newline at end of file diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/T04_A15_P03.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/T04_A15_P03.rpgle new file mode 100644 index 000000000..e763b132d --- /dev/null +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/T04_A15_P03.rpgle @@ -0,0 +1,28 @@ + D name S 30A + D pos S 5U 0 + D £DBG_Str S 30 + D £DBG_Pas S 3 + D alphabet C 'ABCDEFGHIJKLMNOPQRSTUVWXYZ + + D abcdefghijklmnopqrstuvwxyz + + D 0123456789+/' + * + C EVAL £DBG_Pas='P03' + * + C EVAL name = 'Amit Jaiswal' + C EVAL pos = %check(alphabet: name) + C EVAL £DBG_Str='P03_01('+%char(pos)+')' + C £DBG_Str DSPLY + * + C EVAL name = '££ t abc1234' + C EVAL pos = %check(alphabet: name) + C EVAL £DBG_Str='P03_02('+%char(pos)+')' + C £DBG_Str DSPLY + * + C IF %CHECK(alphabet: 'Antonio Cosentino')= 0 + C EVAL £DBG_Str='P03_03(ok)' + C ELSE + C EVAL £DBG_Str='P03_03(ko)' + C ENDIF + C £DBG_Str DSPLY + * + C SETON LR \ No newline at end of file