diff --git a/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/parsing/ast/indicators.kt b/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/parsing/ast/indicators.kt index 450939bb2..d992296f4 100644 --- a/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/parsing/ast/indicators.kt +++ b/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/parsing/ast/indicators.kt @@ -47,6 +47,30 @@ enum class IndicatorType(val range: IntRange) { OC(102..102), OF(103..103), OV(104..104), + KA(105..105), + KB(106..106), + KC(107..107), + KD(108..108), + KE(109..109), + KF(110..110), + KG(111..111), + KH(112..112), + KI(113..113), + KJ(114..114), + KK(115..115), + KL(116..116), + KM(117..117), + KN(118..118), + KP(119..119), + KQ(120..120), + KR(121..121), + KS(122..122), + KT(123..123), + KU(124..124), + KV(125..125), + KW(126..126), + KX(127..127), + KY(128..128), ; companion object { diff --git a/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/parsing/parsetreetoast/misc.kt b/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/parsing/parsetreetoast/misc.kt index 1657ca755..1c5215fa0 100644 --- a/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/parsing/parsetreetoast/misc.kt +++ b/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/parsing/parsetreetoast/misc.kt @@ -955,8 +955,8 @@ private fun annidatedReferenceExpression( } } if (text.uppercase(Locale.getDefault()).startsWith("*IN")) { - val index = text.uppercase(Locale.getDefault()).removePrefix("*IN").toInt() - return IndicatorExpr(index, position) + val index = text.uppercase(Locale.getDefault()).removePrefix("*IN") + return IndicatorExpr(index.toIndicatorKey(), position) } var expr: Expression 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 b8f2c6e4d..73c302d56 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 @@ -2255,6 +2255,15 @@ Test 6 assertEquals(expected, "INDIC02".outputOf()) } + @Test + fun executeINDIC03() { + val expected = listOf( + "*INKA(0) *IN01(1)", + "*INKA(1) *IN01(0)" + ) + assertEquals(expected, "INDIC03".outputOf()) + } + @Test fun executeBIFCHECK() { assertEquals(listOf("ok"), outputOf("BIFCHECK")) 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 a80076ca4..50a07a060 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 @@ -522,4 +522,10 @@ open class SmeupInterpreterTest : AbstractTest() { ) assertEquals(expected, "smeup/T02_A50_P09".outputOf()) } + + @Test + fun executeT60_A10_P01() { + val expected = listOf("KA(0)KB(0)KC(0)KD(0)KE(0)KF(0)KG(0)KH(0)KI(0)KJ(0)KK(0)KL(0)KM(0)KN(0)KP(0)KQ(0)KR(0)KS(0)KT(0)KU(0)KV(0)KW(0)KX(0)KY(0)") + assertEquals(expected, "smeup/T60_A10_P01".outputOf(configuration = smeupConfig)) + } } \ No newline at end of file diff --git a/rpgJavaInterpreter-core/src/test/resources/INDIC03.rpgle b/rpgJavaInterpreter-core/src/test/resources/INDIC03.rpgle new file mode 100644 index 000000000..e0098755b --- /dev/null +++ b/rpgJavaInterpreter-core/src/test/resources/INDIC03.rpgle @@ -0,0 +1,18 @@ + D £DBG_Str S 50 VARYING + + C MOVEL *ON *IN01 + C MOVEL *OFF *INKA + * + C EVAL £DBG_Str= '*INKA('+%CHAR(*INKA)+')' + C +' *IN01('+%CHAR(*IN01)+')' + C £DBG_Str DSPLY + * result: '*INKA(0) *IN01(1)' + * + C MOVEL *OFF *IN01 + C MOVEL *ON *INKA + * + C EVAL £DBG_Str= '*INKA('+%CHAR(*INKA)+')' + C +' *IN01('+%CHAR(*IN01)+')' + C £DBG_Str DSPLY + * result: '*INKA(1) *IN01(0)' + C SETON LR diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/T60_A10_P01.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/T60_A10_P01.rpgle new file mode 100644 index 000000000..6c4a3982c --- /dev/null +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/T60_A10_P01.rpgle @@ -0,0 +1,108 @@ + D £DBG_Str S 250 + D $OP S 1N INZ(*ON) + + D* Test sugli indicatori delle chiavi KA-KY (F01-F24) + C EVAL £DBG_Str='' + C IF $OP=*OFF + C OPEN MLNGT60V + C ENDIF + C KA EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KA(1) ' + C NKA EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KA(0) ' + C KB EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KB(1) ' + C NKB EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KB(0) ' + C KC EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KC(1) ' + C NKC EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KC(0) ' + C KD EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KD(1) ' + C NKD EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KD(0) ' + C KE EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KE(1) ' + C NKE EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KE(0) ' + C KF EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KF(1) ' + C NKF EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KF(0) ' + C KG EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KG(1) ' + C NKG EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KG(0) ' + C KH EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KH(1) ' + C NKH EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KH(0) ' + C KI EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KI(1) ' + C NKI EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KI(0) ' + C KJ EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KJ(1) ' + C NKJ EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KJ(0) ' + C KK EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KK(1) ' + C NKK EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KK(0) ' + C KL EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KL(1) ' + C NKL EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KL(0) ' + C KM EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KM(1) ' + C NKM EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KM(0) ' + C KN EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KN(1) ' + C NKN EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KN(0) ' + C KP EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KP(1) ' + C NKP EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KP(0) ' + C KQ EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KQ(1) ' + C NKQ EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KQ(0) ' + C KR EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KR(1) ' + C NKR EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KR(0) ' + C KS EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KS(1) ' + C NKS EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KS(0) ' + C KT EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KT(1) ' + C NKT EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KT(0) ' + C KU EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KU(1) ' + C NKU EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KU(0) ' + C KV EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KV(1) ' + C NKV EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KV(0) ' + C KW EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KW(1) ' + C NKW EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KW(0) ' + C KX EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KX(1) ' + C NKX EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KX(0) ' + C KY EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KY(1)' + C NKY EVAL £DBG_Str=%TRIM(£DBG_Str)+ + C 'KY(0)' + C IF $OP=*OFF + C CLOSE MLNGT60V + C ENDIF + C £DBG_Str DSPLY \ No newline at end of file diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/metadata/MLNGT60V.json b/rpgJavaInterpreter-core/src/test/resources/smeup/metadata/MLNGT60V.json new file mode 100644 index 000000000..27ba6b1a4 --- /dev/null +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/metadata/MLNGT60V.json @@ -0,0 +1,19 @@ +{"name": "MLNGT60V", + "tableName": "MULANGTF", + "recordFormat": "", + "fields": [ + { "fieldName": "*IN62", + "type":{"type":"com.smeup.rpgparser.interpreter.StringType","length":1, "varying":false}} + , { "fieldName": "*IN96", + "type":{"type":"com.smeup.rpgparser.interpreter.StringType","length":1, "varying":false}} + , { "fieldName": "*IN97", + "type":{"type":"com.smeup.rpgparser.interpreter.StringType","length":1, "varying":false}} + , { "fieldName": "£RASDI", + "type":{"type":"com.smeup.rpgparser.interpreter.StringType","length":15, "varying":false}} + , { "fieldName": "£PDSNP", + "type":{"type":"com.smeup.rpgparser.interpreter.StringType","length":10, "varying":false}} + , { "fieldName": "£PDSJN", + "type":{"type":"com.smeup.rpgparser.interpreter.StringType","length":10, "varying":false}} + , { "fieldName": "£PDSNU", + "type":{"type":"com.smeup.rpgparser.interpreter.StringType","length":10, "varying":false}} + ], "accessFields": []}