From 33b073e3ad4ed693d778c3edaa14d336f4b27d81 Mon Sep 17 00:00:00 2001 From: Davide Palladino Date: Thu, 24 Oct 2024 15:09:17 +0200 Subject: [PATCH 01/12] Implemented tests --- .../rpgparser/smeup/MULANGT10BaseCodopTest.kt | 60 +++++++++++++++++++ .../test/resources/smeup/MUDRNRAPU00135.rpgle | 32 ++++++++++ .../test/resources/smeup/MUDRNRAPU00136.rpgle | 32 ++++++++++ .../test/resources/smeup/MUDRNRAPU00137.rpgle | 31 ++++++++++ .../test/resources/smeup/MUDRNRAPU00138.rpgle | 31 ++++++++++ .../test/resources/smeup/MUDRNRAPU00139.rpgle | 32 ++++++++++ .../test/resources/smeup/MUDRNRAPU00140.rpgle | 32 ++++++++++ 7 files changed, 250 insertions(+) create mode 100644 rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00135.rpgle create mode 100644 rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00136.rpgle create mode 100644 rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00137.rpgle create mode 100644 rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00138.rpgle create mode 100644 rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00139.rpgle create mode 100644 rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00140.rpgle diff --git a/rpgJavaInterpreter-core/src/test/kotlin/com/smeup/rpgparser/smeup/MULANGT10BaseCodopTest.kt b/rpgJavaInterpreter-core/src/test/kotlin/com/smeup/rpgparser/smeup/MULANGT10BaseCodopTest.kt index bc5ac505b..dd7a39767 100644 --- a/rpgJavaInterpreter-core/src/test/kotlin/com/smeup/rpgparser/smeup/MULANGT10BaseCodopTest.kt +++ b/rpgJavaInterpreter-core/src/test/kotlin/com/smeup/rpgparser/smeup/MULANGT10BaseCodopTest.kt @@ -406,4 +406,64 @@ open class MULANGT10BaseCodopTest : MULANGTTest() { val expected = listOf("OK") assertEquals(expected, "smeup/MUDRNRAPU00134".outputOf(configuration = smeupConfig)) } + + /** + * MOVEL an integer array to another. The size of first is lower than destination. + * @see #LS24004606 + */ + @Test + fun executeMUDRNRAPU00135() { + val expected = listOf("1", "1", "1", "1", "1", "1", "2", "2") + assertEquals(expected, "smeup/MUDRNRAPU00135".outputOf(configuration = smeupConfig)) + } + + /** + * MOVEL an integer array to another. The size of first is greater than destination. + * @see #LS24004606 + */ + @Test + fun executeMUDRNRAPU00136() { + val expected = listOf("1", "1", "1", "1", "1", "1", "1", "1") + assertEquals(expected, "smeup/MUDRNRAPU00136".outputOf(configuration = smeupConfig)) + } + + /** + * MOVEL a decimal array to integer. + * @see #LS24004606 + */ + @Test + fun executeMUDRNRAPU00137() { + val expected = listOf("1.200", "1.200", "1.200", "1200", "1200", "1200", "2", "2") + assertEquals(expected, "smeup/MUDRNRAPU00137".outputOf(configuration = smeupConfig)) + } + + /** + * MOVEL an integer array to decimal. + * @see #LS24004606 + */ + @Test + fun executeMUDRNRAPU00138() { + val expected = listOf("1", "1", "1", "0.001", "0.001", "0.001", "2.200", "2.200") + assertEquals(expected, "smeup/MUDRNRAPU00138".outputOf(configuration = smeupConfig)) + } + + /** + * MOVEL a decimal array to integer. The number of digits of first are greater than second. + * @see #LS24004606 + */ + @Test + fun executeMUDRNRAPU00139() { + val expected = listOf("12.345", "12.345", "12.345", "123", "123", "123", "9", "9") + assertEquals(expected, "smeup/MUDRNRAPU00139".outputOf(configuration = smeupConfig)) + } + + /** + * MOVEL a decimal array to integer. The number of digits of first are greater than second. + * @see #LS24004606 + */ + @Test + fun executeMUDRNRAPU00140() { + val expected = listOf("123", "123", "123", "12.300", "12.300", "12.300", "9.900", "9.900") + assertEquals(expected, "smeup/MUDRNRAPU00140".outputOf(configuration = smeupConfig)) + } } \ No newline at end of file diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00135.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00135.rpgle new file mode 100644 index 000000000..efce38330 --- /dev/null +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00135.rpgle @@ -0,0 +1,32 @@ + V* ============================================================== + V* 24/10/2024 APU001 Creation + V* ============================================================== + O * PROGRAM GOAL + O * MOVEL an integer array to another. The size of first is lower + O * than destination. + V* ============================================================== + O * JARIKO ANOMALY + O * Before the fix, the error occurred was + O * `Cannot set an array as factor 2 in MOVEL/MOVEL(P) statement' + V* ============================================================== + D ARR_1 S 1 0 DIM(3) INZ(1) + D ARR_2 S 1 0 DIM(5) INZ(2) + D TMP S 2 + D COUNT S 2 0 INZ(1) + + C COUNT DOUEQ 4 + C EVAL TMP=%CHAR(ARR_1(COUNT)) + C TMP DSPLY + C EVAL COUNT=COUNT+1 + C ENDDO + + C MOVEL ARR_1 ARR_2 #Cannot set an array as factor 2 in MOVEL/MOVEL(P) statement + + C EVAL COUNT=1 + C COUNT DOUEQ 6 + C EVAL TMP=%CHAR(ARR_2(COUNT)) + C TMP DSPLY + C EVAL COUNT=COUNT+1 + C ENDDO + + C SETON LR \ No newline at end of file diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00136.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00136.rpgle new file mode 100644 index 000000000..46bf9d3f4 --- /dev/null +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00136.rpgle @@ -0,0 +1,32 @@ + V* ============================================================== + V* 24/10/2024 APU001 Creation + V* ============================================================== + O * PROGRAM GOAL + O * MOVEL an integer array to another. The size of first is + O * greater than destination. + V* ============================================================== + O * JARIKO ANOMALY + O * Before the fix, the error occurred was + O * `Cannot set an array as factor 2 in MOVEL/MOVEL(P) statement' + V* ============================================================== + D ARR_1 S 1 0 DIM(5) INZ(1) + D ARR_2 S 1 0 DIM(3) INZ(2) + D TMP S 2 + D COUNT S 2 0 INZ(1) + + C COUNT DOUEQ 6 + C EVAL TMP=%CHAR(ARR_1(COUNT)) + C TMP DSPLY + C EVAL COUNT=COUNT+1 + C ENDDO + + C MOVEL ARR_1 ARR_2 #Cannot set an array as factor 2 in MOVEL/MOVEL(P) statement + + C EVAL COUNT=1 + C COUNT DOUEQ 4 + C EVAL TMP=%CHAR(ARR_2(COUNT)) + C TMP DSPLY + C EVAL COUNT=COUNT+1 + C ENDDO + + C SETON LR \ No newline at end of file diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00137.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00137.rpgle new file mode 100644 index 000000000..4311df590 --- /dev/null +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00137.rpgle @@ -0,0 +1,31 @@ + V* ============================================================== + V* 24/10/2024 APU001 Creation + V* ============================================================== + O * PROGRAM GOAL + O * MOVEL a decimal array to integer. + V* ============================================================== + O * JARIKO ANOMALY + O * Before the fix, the error occurred was + O * `Cannot set an array as factor 2 in MOVEL/MOVEL(P) statement' + V* ============================================================== + D ARR_1 S 5 3 DIM(3) INZ(1.2) + D ARR_2 S 5 0 DIM(5) INZ(2) + D TMP S 5 + D COUNT S 2 0 INZ(1) + + C COUNT DOUEQ 4 + C EVAL TMP=%CHAR(ARR_1(COUNT)) + C TMP DSPLY + C EVAL COUNT=COUNT+1 + C ENDDO + + C MOVEL ARR_1 ARR_2 #Cannot set an array as factor 2 in MOVEL/MOVEL(P) statement + + C EVAL COUNT=1 + C COUNT DOUEQ 6 + C EVAL TMP=%CHAR(ARR_2(COUNT)) + C TMP DSPLY + C EVAL COUNT=COUNT+1 + C ENDDO + + C SETON LR \ No newline at end of file diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00138.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00138.rpgle new file mode 100644 index 000000000..188f5fa4c --- /dev/null +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00138.rpgle @@ -0,0 +1,31 @@ + V* ============================================================== + V* 24/10/2024 APU001 Creation + V* ============================================================== + O * PROGRAM GOAL + O * MOVEL a decimal array to integer. + V* ============================================================== + O * JARIKO ANOMALY + O * Before the fix, the error occurred was + O * `Cannot set an array as factor 2 in MOVEL/MOVEL(P) statement' + V* ============================================================== + D ARR_1 S 5 0 DIM(3) INZ(1) + D ARR_2 S 5 3 DIM(5) INZ(2.2) + D TMP S 5 + D COUNT S 2 0 INZ(1) + + C COUNT DOUEQ 4 + C EVAL TMP=%CHAR(ARR_1(COUNT)) + C TMP DSPLY + C EVAL COUNT=COUNT+1 + C ENDDO + + C MOVEL ARR_1 ARR_2 #Cannot set an array as factor 2 in MOVEL/MOVEL(P) statement + + C EVAL COUNT=1 + C COUNT DOUEQ 6 + C EVAL TMP=%CHAR(ARR_2(COUNT)) + C TMP DSPLY + C EVAL COUNT=COUNT+1 + C ENDDO + + C SETON LR \ No newline at end of file diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00139.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00139.rpgle new file mode 100644 index 000000000..e0fbff183 --- /dev/null +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00139.rpgle @@ -0,0 +1,32 @@ + V* ============================================================== + V* 24/10/2024 APU001 Creation + V* ============================================================== + O * PROGRAM GOAL + O * MOVEL a decimal array to integer. The number of digits + O * of first are greater than second. + V* ============================================================== + O * JARIKO ANOMALY + O * Before the fix, the error occurred was + O * `Cannot set an array as factor 2 in MOVEL/MOVEL(P) statement' + V* ============================================================== + D ARR_1 S 5 3 DIM(3) INZ(12.345) + D ARR_2 S 3 0 DIM(5) INZ(9) + D TMP S 7 + D COUNT S 2 0 INZ(1) + + C COUNT DOUEQ 4 + C EVAL TMP=%CHAR(ARR_1(COUNT)) + C TMP DSPLY + C EVAL COUNT=COUNT+1 + C ENDDO + + C MOVEL ARR_1 ARR_2 #Cannot set an array as factor 2 in MOVEL/MOVEL(P) statement + + C EVAL COUNT=1 + C COUNT DOUEQ 6 + C EVAL TMP=%CHAR(ARR_2(COUNT)) + C TMP DSPLY + C EVAL COUNT=COUNT+1 + C ENDDO + + C SETON LR \ No newline at end of file diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00140.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00140.rpgle new file mode 100644 index 000000000..aa30577b9 --- /dev/null +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00140.rpgle @@ -0,0 +1,32 @@ + V* ============================================================== + V* 24/10/2024 APU001 Creation + V* ============================================================== + O * PROGRAM GOAL + O * MOVEL a integer array to decimal. The number of digits + O * of first are lower than second. + V* ============================================================== + O * JARIKO ANOMALY + O * Before the fix, the error occurred was + O * `Cannot set an array as factor 2 in MOVEL/MOVEL(P) statement' + V* ============================================================== + D ARR_1 S 3 0 DIM(3) INZ(123) + D ARR_2 S 5 3 DIM(5) INZ(9.9) + D TMP S 7 + D COUNT S 2 0 INZ(1) + + C COUNT DOUEQ 4 + C EVAL TMP=%CHAR(ARR_1(COUNT)) + C TMP DSPLY + C EVAL COUNT=COUNT+1 + C ENDDO + + C MOVEL ARR_1 ARR_2 #Cannot set an array as factor 2 in MOVEL/MOVEL(P) statement + + C EVAL COUNT=1 + C COUNT DOUEQ 6 + C EVAL TMP=%CHAR(ARR_2(COUNT)) + C TMP DSPLY + C EVAL COUNT=COUNT+1 + C ENDDO + + C SETON LR \ No newline at end of file From 64f89b17cef94a354738931586f01c9af60cd7c9 Mon Sep 17 00:00:00 2001 From: Davide Palladino Date: Thu, 24 Oct 2024 15:41:12 +0200 Subject: [PATCH 02/12] First refactoring about `movel` for next implementation about array to array --- .../com/smeup/rpgparser/interpreter/movel.kt | 78 +++++++++++-------- 1 file changed, 45 insertions(+), 33 deletions(-) diff --git a/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/movel.kt b/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/movel.kt index f928e6e10..9d6e04ade 100644 --- a/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/movel.kt +++ b/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/movel.kt @@ -34,44 +34,56 @@ fun movel( ): Value { if (value !is FigurativeConstantRef) { if (value.type() is ArrayType) { - throw UnsupportedOperationException("Cannot set an array as factor 2 in MOVEL/MOVEL(P) statement") + if (target.type() !is ArrayType) { + throw UnsupportedOperationException("Not implemented MOVEL/MOVEL(P) statement between Factor 2 as ${value.type()} to Result as ${target.type()}.") + } } - if (value.type() is DateType) { - return interpreterCore.assign(target, dateToString(value, dataAttributes, interpreterCore)) - } + return movelFactorAsScalar(operationExtender, target, value, dataAttributes, interpreterCore) + } else { + return interpreterCore.assign(target, interpreterCore.eval(value)) + } +} - val valueToMove: String = getStringOfValue(target, interpreterCore, value) - if (target.type() is ArrayType) { - // for each element of array apply move - val arrayValue: ConcreteArrayValue = interpreterCore.eval(target) as ConcreteArrayValue - val valueToApplyMoveElementType: Type = (target.type() as ArrayType).element - arrayValue.elements.forEachIndexed { index, el -> - arrayValue.setElement( - index + 1, stringToValue( - movel( - valueToMove, - valueToString(el, valueToApplyMoveElementType), - valueToApplyMoveElementType, - operationExtender != null - ), - valueToApplyMoveElementType - ) - ) - } - return interpreterCore.assign(target, arrayValue) - } else { - val valueToApplyMove: String = valueToString(interpreterCore.eval(target), target.type()) - return interpreterCore.assign( - target, - stringToValue( - movel(valueToMove, valueToApplyMove, target.type(), operationExtender != null), - target.type() +fun movelFactorAsScalar( + operationExtender: String?, + target: AssignableExpression, + value: Expression, + dataAttributes: Expression?, + interpreterCore: InterpreterCore +): Value { + if (value.type() is DateType) { + return interpreterCore.assign(target, dateToString(value, dataAttributes, interpreterCore)) + } + + val valueToMove: String = getStringOfValueBaseOfTarget(target, interpreterCore, value) + if (target.type() is ArrayType) { + // for each element of array apply move + val arrayValue: ConcreteArrayValue = interpreterCore.eval(target) as ConcreteArrayValue + val valueToApplyMoveElementType: Type = (target.type() as ArrayType).element + arrayValue.elements.forEachIndexed { index, el -> + arrayValue.setElement( + index + 1, stringToValue( + movel( + valueToMove, + valueToString(el, valueToApplyMoveElementType), + valueToApplyMoveElementType, + operationExtender != null + ), + valueToApplyMoveElementType ) ) } + return interpreterCore.assign(target, arrayValue) } else { - return interpreterCore.assign(target, interpreterCore.eval(value)) + val valueToApplyMove: String = valueToString(interpreterCore.eval(target), target.type()) + return interpreterCore.assign( + target, + stringToValue( + movel(valueToMove, valueToApplyMove, target.type(), operationExtender != null), + target.type() + ) + ) } } @@ -85,7 +97,7 @@ fun move( if (value.type() is ArrayType) { throw UnsupportedOperationException("Cannot set an array as factor 2 in MOVE/MOVE(P) statement") } - val valueToMove: String = getStringOfValue(target, interpreterCore, value) + val valueToMove: String = getStringOfValueBaseOfTarget(target, interpreterCore, value) if (target.type() is ArrayType) { // for each element of array apply move val arrayValue: ConcreteArrayValue = interpreterCore.eval(target) as ConcreteArrayValue @@ -119,7 +131,7 @@ fun move( } } -private fun getStringOfValue( +private fun getStringOfValueBaseOfTarget( target: AssignableExpression, interpreterCore: InterpreterCore, value: Expression From 6b0695c0ceae2952f87883e5a65d54170d4feef3 Mon Sep 17 00:00:00 2001 From: Davide Palladino Date: Fri, 25 Oct 2024 08:27:07 +0200 Subject: [PATCH 03/12] Applied fix for `MUDRNRAPU00135`, `MUDRNRAPU00136` --- .../com/smeup/rpgparser/interpreter/movel.kt | 43 +++++++++++++++++-- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/movel.kt b/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/movel.kt index 9d6e04ade..3f403b671 100644 --- a/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/movel.kt +++ b/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/movel.kt @@ -6,6 +6,7 @@ import com.smeup.rpgparser.parsing.parsetreetoast.isDecimal import com.smeup.rpgparser.parsing.parsetreetoast.isInt import com.smeup.rpgparser.parsing.parsetreetoast.toDecimal import java.math.BigDecimal +import kotlin.math.min private fun clear(value: String, type: Type): String { return when (type) { @@ -34,17 +35,51 @@ fun movel( ): Value { if (value !is FigurativeConstantRef) { if (value.type() is ArrayType) { - if (target.type() !is ArrayType) { - throw UnsupportedOperationException("Not implemented MOVEL/MOVEL(P) statement between Factor 2 as ${value.type()} to Result as ${target.type()}.") - } + return movelFactorAsArray(operationExtender, target, value, dataAttributes, interpreterCore) } - return movelFactorAsScalar(operationExtender, target, value, dataAttributes, interpreterCore) } else { return interpreterCore.assign(target, interpreterCore.eval(value)) } } +fun movelFactorAsArray( + operationExtender: String?, + target: AssignableExpression, + source: Expression, + dataAttributes: Expression?, + interpreterCore: InterpreterCore +): Value { + return when (target.type()) { + is ArrayType -> { + val arraySourceValue: ConcreteArrayValue = interpreterCore.eval(source) as ConcreteArrayValue + val arrayTargetValue: ConcreteArrayValue = interpreterCore.eval(target) as ConcreteArrayValue + val arraySourceType: Type = (source.type() as ArrayType).element + val arrayTargetType: Type = (target.type() as ArrayType).element + + val maxSize = min(arraySourceValue.elements.size, arrayTargetValue.elements.size) + for (i in 1 until maxSize + 1) { + val valueToMove: String = valueToString(arraySourceValue.getElement(i), arraySourceType) + arrayTargetValue.setElement( + i, stringToValue( + movel( + valueToMove, + valueToString(arrayTargetValue.getElement(i), arrayTargetType), + arrayTargetType, + operationExtender != null + ), + arrayTargetType + ) + ) + } + interpreterCore.assign(target, arrayTargetValue) + } + else -> { + throw UnsupportedOperationException("Not implemented MOVEL/MOVEL(P) statement between Factor 2 as ${source.type()} to Result as ${target.type()}.") + } + } +} + fun movelFactorAsScalar( operationExtender: String?, target: AssignableExpression, From e4f8ccb7577227bdfd055441d98cc1cbb215cd3f Mon Sep 17 00:00:00 2001 From: Davide Palladino Date: Fri, 25 Oct 2024 08:39:24 +0200 Subject: [PATCH 04/12] Applied fix for `MUDRNRAPU00137` --- .../main/kotlin/com/smeup/rpgparser/interpreter/coercing.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/coercing.kt b/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/coercing.kt index 9d79a9e5f..854691d9a 100644 --- a/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/coercing.kt +++ b/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/coercing.kt @@ -248,6 +248,10 @@ fun coerce(value: Value, type: Type): Value { return DecimalValue(value.value.setScale(type.decimalDigits)) } } + is ArrayType -> { + val coercedValue = coerce(value, type.element) + ConcreteArrayValue(MutableList(type.element.size) { coercedValue }, type.element) + } else -> TODO("Converting DecimalValue to $type") } } From e5d8c4d22f6f96ac685e60e6bd49f34c5107a3f4 Mon Sep 17 00:00:00 2001 From: Davide Palladino Date: Fri, 25 Oct 2024 09:03:48 +0200 Subject: [PATCH 05/12] Typo result for `executeMUDRNRAPU00138` --- .../kotlin/com/smeup/rpgparser/smeup/MULANGT10BaseCodopTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpgJavaInterpreter-core/src/test/kotlin/com/smeup/rpgparser/smeup/MULANGT10BaseCodopTest.kt b/rpgJavaInterpreter-core/src/test/kotlin/com/smeup/rpgparser/smeup/MULANGT10BaseCodopTest.kt index dd7a39767..92636c8c2 100644 --- a/rpgJavaInterpreter-core/src/test/kotlin/com/smeup/rpgparser/smeup/MULANGT10BaseCodopTest.kt +++ b/rpgJavaInterpreter-core/src/test/kotlin/com/smeup/rpgparser/smeup/MULANGT10BaseCodopTest.kt @@ -443,7 +443,7 @@ open class MULANGT10BaseCodopTest : MULANGTTest() { */ @Test fun executeMUDRNRAPU00138() { - val expected = listOf("1", "1", "1", "0.001", "0.001", "0.001", "2.200", "2.200") + val expected = listOf("1", "1", "1", ".001", ".001", ".001", "2.200", "2.200") assertEquals(expected, "smeup/MUDRNRAPU00138".outputOf(configuration = smeupConfig)) } From b93219f44865dfd4cdec7f388f606182ffe9a0f8 Mon Sep 17 00:00:00 2001 From: Davide Palladino Date: Fri, 25 Oct 2024 11:44:49 +0200 Subject: [PATCH 06/12] Typo exception for `ArrayType` in `move` function --- .../src/main/kotlin/com/smeup/rpgparser/interpreter/movel.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/movel.kt b/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/movel.kt index 3f403b671..61fc029a2 100644 --- a/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/movel.kt +++ b/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/movel.kt @@ -130,7 +130,7 @@ fun move( ): Value { if (value !is FigurativeConstantRef) { if (value.type() is ArrayType) { - throw UnsupportedOperationException("Cannot set an array as factor 2 in MOVE/MOVE(P) statement") + throw UnsupportedOperationException("Not implemented MOVEL/MOVEL(P) statement between Factor 2 as ${value.type()} to Result as ${target.type()}.") } val valueToMove: String = getStringOfValueBaseOfTarget(target, interpreterCore, value) if (target.type() is ArrayType) { From da623f468f3059e06d3e1fa82ccc6e10052362b8 Mon Sep 17 00:00:00 2001 From: Davide Palladino Date: Fri, 25 Oct 2024 12:44:14 +0200 Subject: [PATCH 07/12] Applied refactoring for more readable and maintenance --- .../com/smeup/rpgparser/interpreter/movel.kt | 162 ++++++++++++++---- 1 file changed, 124 insertions(+), 38 deletions(-) diff --git a/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/movel.kt b/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/movel.kt index 61fc029a2..f3a91545c 100644 --- a/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/movel.kt +++ b/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/movel.kt @@ -26,6 +26,29 @@ private fun clear(value: String, type: Type): String { } } +/** + * Performs RPGLE `MOVEL` operation by assigning `value` (Factor 2) to `target`, + * handling both scalar and array types for `value`. + * + * If `value` is of type `ArrayType`, it delegates to `movelFactorAsArray` to handle array + * operations. If `value` is a scalar, it delegates to `movelFactorAsScalar`. For figurative constants, + * it directly assigns the evaluated constant to the `target`. + * + * @param operationExtender Optional modifier specifying an extender for the `MOVEL` operation. + * When non-null, enables the "clear" functionality, which clears existing target values + * before assignment. + * @param target The target `AssignableExpression` where the result of the `MOVEL` operation + * will be assigned. + * @param value The `Expression` representing Factor 2 in RPGLE. This can be a figurative constant, + * scalar, or array. + * @param dataAttributes Optional `Expression` containing additional attributes, in example for date format. + * Can be null. + * @param interpreterCore The `InterpreterCore` instance handling expression evaluation and assignment. + * + * @return The result `Value` of the `MOVEL` operation after assigning `value` to `target`. + * + * @throws IllegalArgumentException if the type of `target` or `value` does not support the `MOVEL` operation. + */ fun movel( operationExtender: String?, target: AssignableExpression, @@ -33,16 +56,37 @@ fun movel( dataAttributes: Expression?, interpreterCore: InterpreterCore ): Value { - if (value !is FigurativeConstantRef) { + return if (value !is FigurativeConstantRef) { if (value.type() is ArrayType) { - return movelFactorAsArray(operationExtender, target, value, dataAttributes, interpreterCore) + movelFactorAsArray(operationExtender, target, value, dataAttributes, interpreterCore) } - return movelFactorAsScalar(operationExtender, target, value, dataAttributes, interpreterCore) + movelFactorAsScalar(operationExtender, target, value, dataAttributes, interpreterCore) } else { - return interpreterCore.assign(target, interpreterCore.eval(value)) + interpreterCore.assign(target, interpreterCore.eval(value)) } } +/** + * Handles `MOVEL` operation when `source` (Factor 2) is an array type, assigning its elements + * to `target` (Result). Elements are transferred up to the minimum length between `source` and + * `target` arrays, applying any `operationExtender` if specified. + * + * @param operationExtender Optional modifier specifying an extender for the `MOVEL` operation. + * When non-null, enables the "clear" functionality, which clears existing target values + * before assignment. + * @param target The `AssignableExpression` target array where elements from `source` will be + * assigned. + * @param source The `Expression` source array (Factor 2) providing elements to transfer to `target`. + * @param dataAttributes Optional `Expression` containing additional attributes, in example for date format. + * Can be null. + * @param interpreterCore The `InterpreterCore` instance for evaluating, retrieving, and assigning + * expressions. + * + * @return The resulting `Value` after assigning elements from `source` to `target`. + * + * @throws UnsupportedOperationException If `target` is not an array type or if `source` and `target` + * have incompatible types for `MOVEL` operation. + */ fun movelFactorAsArray( operationExtender: String?, target: AssignableExpression, @@ -59,17 +103,12 @@ fun movelFactorAsArray( val maxSize = min(arraySourceValue.elements.size, arrayTargetValue.elements.size) for (i in 1 until maxSize + 1) { - val valueToMove: String = valueToString(arraySourceValue.getElement(i), arraySourceType) arrayTargetValue.setElement( - i, stringToValue( - movel( - valueToMove, - valueToString(arrayTargetValue.getElement(i), arrayTargetType), - arrayTargetType, - operationExtender != null - ), - arrayTargetType - ) + i, + valueToString(arraySourceValue.getElement(i), arraySourceType), + valueToString(arrayTargetValue.getElement(i), arrayTargetType), + arrayTargetType, + operationExtender ) } interpreterCore.assign(target, arrayTargetValue) @@ -80,6 +119,25 @@ fun movelFactorAsArray( } } +/** + * Performs `MOVEL` operation when `value` (Factor 2) is a scalar, assigning it to `target`. + * Handles specific transformations if `value` is a date type, and applies the value to each + * element if `target` is an array. If `operationExtender` is specified, enables clearing + * behavior during assignment. + * + * @param operationExtender Optional modifier specifying an extender for the `MOVEL` operation. + * When non-null, enables the "clear" functionality, which clears existing target values + * before assignment. + * @param target The `AssignableExpression` where the transformed `value` will be assigned. + * @param value The scalar `Expression` (Factor 2) to be moved to `target`. + * @param dataAttributes Optional `Expression` containing additional attributes, in example for date format. + * Can be null. + * @param interpreterCore The `InterpreterCore` instance used for expression evaluation and assignment. + * + * @return The resulting `Value` after the `MOVEL` operation, representing the assigned target value. + * + * @throws UnsupportedOperationException if `target` is of an incompatible type for `MOVEL`. + */ fun movelFactorAsScalar( operationExtender: String?, target: AssignableExpression, @@ -92,33 +150,32 @@ fun movelFactorAsScalar( } val valueToMove: String = getStringOfValueBaseOfTarget(target, interpreterCore, value) - if (target.type() is ArrayType) { - // for each element of array apply move - val arrayValue: ConcreteArrayValue = interpreterCore.eval(target) as ConcreteArrayValue - val valueToApplyMoveElementType: Type = (target.type() as ArrayType).element - arrayValue.elements.forEachIndexed { index, el -> - arrayValue.setElement( - index + 1, stringToValue( - movel( - valueToMove, - valueToString(el, valueToApplyMoveElementType), - valueToApplyMoveElementType, - operationExtender != null - ), - valueToApplyMoveElementType + return when (target.type()) { + is ArrayType -> { + // For each element of array apply MOVEL + val arrayValue: ConcreteArrayValue = interpreterCore.eval(target) as ConcreteArrayValue + val valueToApplyMoveElementType: Type = (target.type() as ArrayType).element + arrayValue.elements.forEachIndexed { index, el -> + arrayValue.setElement( + index + 1, + valueToMove, + valueToString(el, valueToApplyMoveElementType), + valueToApplyMoveElementType, + operationExtender ) - ) + } + interpreterCore.assign(target, arrayValue) } - return interpreterCore.assign(target, arrayValue) - } else { - val valueToApplyMove: String = valueToString(interpreterCore.eval(target), target.type()) - return interpreterCore.assign( - target, - stringToValue( - movel(valueToMove, valueToApplyMove, target.type(), operationExtender != null), - target.type() + else -> { + val valueToApplyMove: String = valueToString(interpreterCore.eval(target), target.type()) + return interpreterCore.assign( + target, + stringToValue( + movel(valueToMove, valueToApplyMove, target.type(), operationExtender != null), + target.type() + ) ) - ) + } } } @@ -321,4 +378,33 @@ private fun stringToValue(value: String, type: Type): Value { else -> throw UnsupportedOperationException("MOVE/MOVEL not supported for the type: $type") } +} + +/** + * Sets an element in the `ConcreteArrayValue` array at the specified `index`, transforming + * `sourceValueAsString` and applying it to the target based on `MOVEL` operation rules and + * `targetType`. If `operationExtender` is provided, it enables the "clear" functionality in the + * `MOVEL` operation, allowing existing values to be cleared before setting the new value. + * + * @param index The position in the array where the element will be set. + * @param sourceValueAsString The new source value as a string to be assigned after transformation. + * @param targetValueAsString The current value at `index`, used as a basis for `MOVEL` transformation. + * @param targetType The `Type` of the target element, ensuring type compatibility during the assignment. + * @param operationExtender Optional flag that, if non-null, enables the "clear" functionality within + * `MOVEL`, allowing `targetValueAsString` to be cleared before `sourceValueAsString` is assigned. + * + * @throws IndexOutOfBoundsException if `index` is outside the bounds of the array. + */ +private fun ConcreteArrayValue.setElement(index: Int, sourceValueAsString: String, targetValueAsString: String, targetType: Type, operationExtender: String?) { + this.setElement( + index, stringToValue( + movel( + sourceValueAsString, + targetValueAsString, + targetType, + operationExtender != null + ), + targetType + ) + ) } \ No newline at end of file From 96efce67328c553e386759eddec96efbe2b355dd Mon Sep 17 00:00:00 2001 From: Davide Palladino Date: Fri, 25 Oct 2024 13:37:38 +0200 Subject: [PATCH 08/12] Applied important fix for `if` in `movel` --- .../src/main/kotlin/com/smeup/rpgparser/interpreter/movel.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/movel.kt b/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/movel.kt index f3a91545c..f8663241a 100644 --- a/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/movel.kt +++ b/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/movel.kt @@ -59,8 +59,9 @@ fun movel( return if (value !is FigurativeConstantRef) { if (value.type() is ArrayType) { movelFactorAsArray(operationExtender, target, value, dataAttributes, interpreterCore) + } else { + movelFactorAsScalar(operationExtender, target, value, dataAttributes, interpreterCore) } - movelFactorAsScalar(operationExtender, target, value, dataAttributes, interpreterCore) } else { interpreterCore.assign(target, interpreterCore.eval(value)) } From 0ed4298901e57fa095397c725905845470f2b306 Mon Sep 17 00:00:00 2001 From: Davide Palladino Date: Mon, 28 Oct 2024 13:42:51 +0100 Subject: [PATCH 09/12] Prepared `executeMUDRNRAPU00147` where is tested a target as DS array. --- .../rpgparser/smeup/MULANGT10BaseCodopTest.kt | 11 ++++++ .../test/resources/smeup/MUDRNRAPU00147.rpgle | 34 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00147.rpgle diff --git a/rpgJavaInterpreter-core/src/test/kotlin/com/smeup/rpgparser/smeup/MULANGT10BaseCodopTest.kt b/rpgJavaInterpreter-core/src/test/kotlin/com/smeup/rpgparser/smeup/MULANGT10BaseCodopTest.kt index 92636c8c2..54550c9ff 100644 --- a/rpgJavaInterpreter-core/src/test/kotlin/com/smeup/rpgparser/smeup/MULANGT10BaseCodopTest.kt +++ b/rpgJavaInterpreter-core/src/test/kotlin/com/smeup/rpgparser/smeup/MULANGT10BaseCodopTest.kt @@ -466,4 +466,15 @@ open class MULANGT10BaseCodopTest : MULANGTTest() { val expected = listOf("123", "123", "123", "12.300", "12.300", "12.300", "9.900", "9.900") assertEquals(expected, "smeup/MUDRNRAPU00140".outputOf(configuration = smeupConfig)) } + + /** + * MOVEL an integer array to another. The size of first is lower than destination. In this case the target + * is a DS array. + * @see #LS24004606 + */ + @Test + fun executeMUDRNRAPU00147() { + val expected = listOf("1", "1", "1", "1", "1", "1", "2", "2") + assertEquals(expected, "smeup/MUDRNRAPU00147".outputOf(configuration = smeupConfig)) + } } \ No newline at end of file diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00147.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00147.rpgle new file mode 100644 index 000000000..0d5aeccf1 --- /dev/null +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00147.rpgle @@ -0,0 +1,34 @@ + V* ============================================================== + V* 28/10/2024 APU001 Creation + V* ============================================================== + O * PROGRAM GOAL + O * MOVEL an integer array to another. The size of first is lower + O * than destination. In this case the target is a DS array. + V* ============================================================== + O * JARIKO ANOMALY + O * Before the fix, the error occurred was + O * `Cannot set an array as factor 2 in MOVEL/MOVEL(P) statement' + V* ============================================================== + D ARR_1 S 1 0 DIM(3) INZ(1) + D DS_1 DS + D DS_ARR_1 1 0 DIM(5) INZ(2) + + D TMP S 7 + D COUNT S 2 0 INZ(1) + + C COUNT DOUEQ 4 + C EVAL TMP=%CHAR(ARR_1(COUNT)) + C TMP DSPLY + C EVAL COUNT=COUNT+1 + C ENDDO + + C MOVEL ARR_1 DS_ARR_1 + + C EVAL COUNT=1 + C COUNT DOUEQ 6 + C EVAL TMP=%CHAR(DS_ARR_1(COUNT)) + C TMP DSPLY + C EVAL COUNT=COUNT+1 + C ENDDO + + C SETON LR \ No newline at end of file From 6bfc4a4e1eb0bff09acd5746be43b25643a43c4d Mon Sep 17 00:00:00 2001 From: Davide Palladino Date: Mon, 28 Oct 2024 13:43:08 +0100 Subject: [PATCH 10/12] Fixed case od DS array --- .../kotlin/com/smeup/rpgparser/interpreter/movel.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/movel.kt b/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/movel.kt index f8663241a..2e94ca541 100644 --- a/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/movel.kt +++ b/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/movel.kt @@ -97,12 +97,12 @@ fun movelFactorAsArray( ): Value { return when (target.type()) { is ArrayType -> { - val arraySourceValue: ConcreteArrayValue = interpreterCore.eval(source) as ConcreteArrayValue - val arrayTargetValue: ConcreteArrayValue = interpreterCore.eval(target) as ConcreteArrayValue + val arraySourceValue: ArrayValue = interpreterCore.eval(source) as ArrayValue + val arrayTargetValue: ArrayValue = interpreterCore.eval(target) as ArrayValue val arraySourceType: Type = (source.type() as ArrayType).element val arrayTargetType: Type = (target.type() as ArrayType).element - val maxSize = min(arraySourceValue.elements.size, arrayTargetValue.elements.size) + val maxSize = min(arraySourceValue.arrayLength(), arrayTargetValue.arrayLength()) for (i in 1 until maxSize + 1) { arrayTargetValue.setElement( i, @@ -382,7 +382,7 @@ private fun stringToValue(value: String, type: Type): Value { } /** - * Sets an element in the `ConcreteArrayValue` array at the specified `index`, transforming + * Sets an element in the `ArrayValue` array at the specified `index`, transforming * `sourceValueAsString` and applying it to the target based on `MOVEL` operation rules and * `targetType`. If `operationExtender` is provided, it enables the "clear" functionality in the * `MOVEL` operation, allowing existing values to be cleared before setting the new value. @@ -396,7 +396,7 @@ private fun stringToValue(value: String, type: Type): Value { * * @throws IndexOutOfBoundsException if `index` is outside the bounds of the array. */ -private fun ConcreteArrayValue.setElement(index: Int, sourceValueAsString: String, targetValueAsString: String, targetType: Type, operationExtender: String?) { +private fun ArrayValue.setElement(index: Int, sourceValueAsString: String, targetValueAsString: String, targetType: Type, operationExtender: String?) { this.setElement( index, stringToValue( movel( From eb770ef3aecb0549ae501e4d070a3c970391205c Mon Sep 17 00:00:00 2001 From: Davide Palladino Date: Tue, 29 Oct 2024 14:17:23 +0100 Subject: [PATCH 11/12] Improved tests --- .../src/test/resources/smeup/MUDRNRAPU00135.rpgle | 12 +++++------- .../src/test/resources/smeup/MUDRNRAPU00136.rpgle | 11 ++++------- .../src/test/resources/smeup/MUDRNRAPU00137.rpgle | 11 ++++------- .../src/test/resources/smeup/MUDRNRAPU00138.rpgle | 11 ++++------- .../src/test/resources/smeup/MUDRNRAPU00139.rpgle | 11 ++++------- .../src/test/resources/smeup/MUDRNRAPU00140.rpgle | 11 ++++------- .../src/test/resources/smeup/MUDRNRAPU00147.rpgle | 12 ++++-------- 7 files changed, 29 insertions(+), 50 deletions(-) diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00135.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00135.rpgle index efce38330..5da211d2f 100644 --- a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00135.rpgle +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00135.rpgle @@ -1,5 +1,6 @@ V* ============================================================== V* 24/10/2024 APU001 Creation + V* 29/10/2024 APU001 Improvements V* ============================================================== O * PROGRAM GOAL O * MOVEL an integer array to another. The size of first is lower @@ -14,19 +15,16 @@ D TMP S 2 D COUNT S 2 0 INZ(1) - C COUNT DOUEQ 4 + C FOR COUNT=1 TO %ELEM(ARR_1) C EVAL TMP=%CHAR(ARR_1(COUNT)) C TMP DSPLY - C EVAL COUNT=COUNT+1 - C ENDDO + C ENDFOR C MOVEL ARR_1 ARR_2 #Cannot set an array as factor 2 in MOVEL/MOVEL(P) statement - C EVAL COUNT=1 - C COUNT DOUEQ 6 + C FOR COUNT=1 TO %ELEM(ARR_2) C EVAL TMP=%CHAR(ARR_2(COUNT)) C TMP DSPLY - C EVAL COUNT=COUNT+1 - C ENDDO + C ENDFOR C SETON LR \ No newline at end of file diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00136.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00136.rpgle index 46bf9d3f4..216a117b2 100644 --- a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00136.rpgle +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00136.rpgle @@ -14,19 +14,16 @@ D TMP S 2 D COUNT S 2 0 INZ(1) - C COUNT DOUEQ 6 + C FOR COUNT=1 TO %ELEM(ARR_1) C EVAL TMP=%CHAR(ARR_1(COUNT)) C TMP DSPLY - C EVAL COUNT=COUNT+1 - C ENDDO + C ENDFOR C MOVEL ARR_1 ARR_2 #Cannot set an array as factor 2 in MOVEL/MOVEL(P) statement - C EVAL COUNT=1 - C COUNT DOUEQ 4 + C FOR COUNT=1 TO %ELEM(ARR_2) C EVAL TMP=%CHAR(ARR_2(COUNT)) C TMP DSPLY - C EVAL COUNT=COUNT+1 - C ENDDO + C ENDFOR C SETON LR \ No newline at end of file diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00137.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00137.rpgle index 4311df590..8343f5af3 100644 --- a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00137.rpgle +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00137.rpgle @@ -13,19 +13,16 @@ D TMP S 5 D COUNT S 2 0 INZ(1) - C COUNT DOUEQ 4 + C FOR COUNT=1 TO %ELEM(ARR_1) C EVAL TMP=%CHAR(ARR_1(COUNT)) C TMP DSPLY - C EVAL COUNT=COUNT+1 - C ENDDO + C ENDFOR C MOVEL ARR_1 ARR_2 #Cannot set an array as factor 2 in MOVEL/MOVEL(P) statement - C EVAL COUNT=1 - C COUNT DOUEQ 6 + C FOR COUNT=1 TO %ELEM(ARR_2) C EVAL TMP=%CHAR(ARR_2(COUNT)) C TMP DSPLY - C EVAL COUNT=COUNT+1 - C ENDDO + C ENDFOR C SETON LR \ No newline at end of file diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00138.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00138.rpgle index 188f5fa4c..833a617c6 100644 --- a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00138.rpgle +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00138.rpgle @@ -13,19 +13,16 @@ D TMP S 5 D COUNT S 2 0 INZ(1) - C COUNT DOUEQ 4 + C FOR COUNT=1 TO %ELEM(ARR_1) C EVAL TMP=%CHAR(ARR_1(COUNT)) C TMP DSPLY - C EVAL COUNT=COUNT+1 - C ENDDO + C ENDFOR C MOVEL ARR_1 ARR_2 #Cannot set an array as factor 2 in MOVEL/MOVEL(P) statement - C EVAL COUNT=1 - C COUNT DOUEQ 6 + C FOR COUNT=1 TO %ELEM(ARR_2) C EVAL TMP=%CHAR(ARR_2(COUNT)) C TMP DSPLY - C EVAL COUNT=COUNT+1 - C ENDDO + C ENDFOR C SETON LR \ No newline at end of file diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00139.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00139.rpgle index e0fbff183..132e2a757 100644 --- a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00139.rpgle +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00139.rpgle @@ -14,19 +14,16 @@ D TMP S 7 D COUNT S 2 0 INZ(1) - C COUNT DOUEQ 4 + C FOR COUNT=1 TO %ELEM(ARR_1) C EVAL TMP=%CHAR(ARR_1(COUNT)) C TMP DSPLY - C EVAL COUNT=COUNT+1 - C ENDDO + C ENDFOR C MOVEL ARR_1 ARR_2 #Cannot set an array as factor 2 in MOVEL/MOVEL(P) statement - C EVAL COUNT=1 - C COUNT DOUEQ 6 + C FOR COUNT=1 TO %ELEM(ARR_2) C EVAL TMP=%CHAR(ARR_2(COUNT)) C TMP DSPLY - C EVAL COUNT=COUNT+1 - C ENDDO + C ENDFOR C SETON LR \ No newline at end of file diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00140.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00140.rpgle index aa30577b9..8be07c1c2 100644 --- a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00140.rpgle +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00140.rpgle @@ -14,19 +14,16 @@ D TMP S 7 D COUNT S 2 0 INZ(1) - C COUNT DOUEQ 4 + C FOR COUNT=1 TO %ELEM(ARR_1) C EVAL TMP=%CHAR(ARR_1(COUNT)) C TMP DSPLY - C EVAL COUNT=COUNT+1 - C ENDDO + C ENDFOR C MOVEL ARR_1 ARR_2 #Cannot set an array as factor 2 in MOVEL/MOVEL(P) statement - C EVAL COUNT=1 - C COUNT DOUEQ 6 + C FOR COUNT=1 TO %ELEM(ARR_2) C EVAL TMP=%CHAR(ARR_2(COUNT)) C TMP DSPLY - C EVAL COUNT=COUNT+1 - C ENDDO + C ENDFOR C SETON LR \ No newline at end of file diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00147.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00147.rpgle index 0d5aeccf1..24210b8df 100644 --- a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00147.rpgle +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00147.rpgle @@ -12,23 +12,19 @@ D ARR_1 S 1 0 DIM(3) INZ(1) D DS_1 DS D DS_ARR_1 1 0 DIM(5) INZ(2) - D TMP S 7 D COUNT S 2 0 INZ(1) - C COUNT DOUEQ 4 + C FOR COUNT=1 TO %ELEM(ARR_1) C EVAL TMP=%CHAR(ARR_1(COUNT)) C TMP DSPLY - C EVAL COUNT=COUNT+1 - C ENDDO + C ENDFOR C MOVEL ARR_1 DS_ARR_1 - C EVAL COUNT=1 - C COUNT DOUEQ 6 + C FOR COUNT=1 TO %ELEM(DS_ARR_1) C EVAL TMP=%CHAR(DS_ARR_1(COUNT)) C TMP DSPLY - C EVAL COUNT=COUNT+1 - C ENDDO + C ENDFOR C SETON LR \ No newline at end of file From a36686a5af0458349df945a6c272557cf5b31fbc Mon Sep 17 00:00:00 2001 From: Davide Palladino Date: Tue, 29 Oct 2024 14:29:35 +0100 Subject: [PATCH 12/12] Updated header of tests --- .../src/test/resources/smeup/MUDRNRAPU00136.rpgle | 1 + .../src/test/resources/smeup/MUDRNRAPU00137.rpgle | 1 + .../src/test/resources/smeup/MUDRNRAPU00138.rpgle | 1 + .../src/test/resources/smeup/MUDRNRAPU00139.rpgle | 1 + .../src/test/resources/smeup/MUDRNRAPU00140.rpgle | 1 + .../src/test/resources/smeup/MUDRNRAPU00147.rpgle | 1 + 6 files changed, 6 insertions(+) diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00136.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00136.rpgle index 216a117b2..4b3d205ff 100644 --- a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00136.rpgle +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00136.rpgle @@ -1,5 +1,6 @@ V* ============================================================== V* 24/10/2024 APU001 Creation + V* 29/10/2024 APU001 Improvements V* ============================================================== O * PROGRAM GOAL O * MOVEL an integer array to another. The size of first is diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00137.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00137.rpgle index 8343f5af3..6e1a7940c 100644 --- a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00137.rpgle +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00137.rpgle @@ -1,5 +1,6 @@ V* ============================================================== V* 24/10/2024 APU001 Creation + V* 29/10/2024 APU001 Improvements V* ============================================================== O * PROGRAM GOAL O * MOVEL a decimal array to integer. diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00138.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00138.rpgle index 833a617c6..9a222a8a8 100644 --- a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00138.rpgle +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00138.rpgle @@ -1,5 +1,6 @@ V* ============================================================== V* 24/10/2024 APU001 Creation + V* 29/10/2024 APU001 Improvements V* ============================================================== O * PROGRAM GOAL O * MOVEL a decimal array to integer. diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00139.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00139.rpgle index 132e2a757..b44f226cf 100644 --- a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00139.rpgle +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00139.rpgle @@ -1,5 +1,6 @@ V* ============================================================== V* 24/10/2024 APU001 Creation + V* 29/10/2024 APU001 Improvements V* ============================================================== O * PROGRAM GOAL O * MOVEL a decimal array to integer. The number of digits diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00140.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00140.rpgle index 8be07c1c2..35db2ef30 100644 --- a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00140.rpgle +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00140.rpgle @@ -1,5 +1,6 @@ V* ============================================================== V* 24/10/2024 APU001 Creation + V* 29/10/2024 APU001 Improvements V* ============================================================== O * PROGRAM GOAL O * MOVEL a integer array to decimal. The number of digits diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00147.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00147.rpgle index 24210b8df..5e36c45b4 100644 --- a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00147.rpgle +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00147.rpgle @@ -1,5 +1,6 @@ V* ============================================================== V* 28/10/2024 APU001 Creation + V* 29/10/2024 APU001 Improvements V* ============================================================== O * PROGRAM GOAL O * MOVEL an integer array to another. The size of first is lower