From 84384e9f807ea3544657d0efd65b985c75195084 Mon Sep 17 00:00:00 2001 From: Gaetano Di Natale Date: Thu, 19 Sep 2024 17:16:51 +0200 Subject: [PATCH 1/2] add fix --- .../com/smeup/rpgparser/interpreter/movel.kt | 2 ++ .../smeup/MULANGT02ConstAndDSpecTest.kt | 6 +++++ .../test/resources/smeup/MUDRNRAPU01103.rpgle | 23 +++++++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU01103.rpgle 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 7c4963af7..6639845bf 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 @@ -147,6 +147,8 @@ private fun movel( ): String { return if (valueToApplyMoveType is UnlimitedStringType) { valueToMove + } else if (valueToMove.isBlank() && valueToApplyMoveType.isNumeric()) { + "0" } else if (valueToMove.length <= valueToApplyMove.length) { var result: String = valueToApplyMove if (withClear) { diff --git a/rpgJavaInterpreter-core/src/test/kotlin/com/smeup/rpgparser/smeup/MULANGT02ConstAndDSpecTest.kt b/rpgJavaInterpreter-core/src/test/kotlin/com/smeup/rpgparser/smeup/MULANGT02ConstAndDSpecTest.kt index 2ef46915f..beaf5468d 100644 --- a/rpgJavaInterpreter-core/src/test/kotlin/com/smeup/rpgparser/smeup/MULANGT02ConstAndDSpecTest.kt +++ b/rpgJavaInterpreter-core/src/test/kotlin/com/smeup/rpgparser/smeup/MULANGT02ConstAndDSpecTest.kt @@ -604,4 +604,10 @@ open class MULANGT02ConstAndDSpecTest : MULANGTTest() { val expected = listOf("test", "te", "st") assertEquals(expected, "smeup/MUDRNRAPU01102".outputOf(configuration = smeupConfig)) } + + @Test + fun executeMUDRNRAPU01103() { + val expected = listOf("1", "0") + assertEquals(expected, "smeup/MUDRNRAPU01103".outputOf(configuration = smeupConfig)) + } } diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU01103.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU01103.rpgle new file mode 100644 index 000000000..1b451bc72 --- /dev/null +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU01103.rpgle @@ -0,0 +1,23 @@ + V* ============================================================== + V* 19/09/2024 APU011 Creation + V* ============================================================== + O * PROGRAM GOAL + O * Verifies the conversion of values to a numeric data structure + O * when using a blank string and displays the results. + V* ============================================================== + O * JARIKO ANOMALY + O * Before the fix, the error occurred was: + O * Issue executing MoveLStmt at line 2797. For input string: " " + V* ============================================================== + + D PER$DS DS 100 + D T$PERI 19 26 + + DK§CF DS + D K$DE 8 0 + + C K$DE DSPLY + + C MOVEL(P) T$PERI K$DE + + C K$DE DSPLY From e8a0cfff6559d67babb2f4c8dc7644eed5457d90 Mon Sep 17 00:00:00 2001 From: Gaetano Di Natale Date: Tue, 24 Sep 2024 15:36:17 +0200 Subject: [PATCH 2/2] add fix --- .../src/test/resources/smeup/MUDRNRAPU01103.rpgle | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU01103.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU01103.rpgle index 1b451bc72..fdfd62ab2 100644 --- a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU01103.rpgle +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU01103.rpgle @@ -1,5 +1,6 @@ V* ============================================================== V* 19/09/2024 APU011 Creation + V* 25/09/2024 APU011 Edit V* ============================================================== O * PROGRAM GOAL O * Verifies the conversion of values to a numeric data structure @@ -7,17 +8,18 @@ V* ============================================================== O * JARIKO ANOMALY O * Before the fix, the error occurred was: - O * Issue executing MoveLStmt at line 2797. For input string: " " + O * Issue executing MoveLStmt at line 22. For + O * input string: " " V* ============================================================== - D PER$DS DS 100 D T$PERI 19 26 DK§CF DS D K$DE 8 0 + C EVAL K$DE=1 C K$DE DSPLY - - C MOVEL(P) T$PERI K$DE - + C MOVEL(P) T$PERI K$DE #MoveLStmt at line 22. For input string: " " C K$DE DSPLY + + C SETON LR \ No newline at end of file