diff --git a/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/internal_interpreter.kt b/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/internal_interpreter.kt index 69e680f11..0ac3c9043 100644 --- a/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/internal_interpreter.kt +++ b/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/internal_interpreter.kt @@ -283,6 +283,19 @@ open class InternalInterpreter( } initialValue } + /* + * In accord to documentation (see https://www.ibm.com/docs/en/i/7.5?topic=codes-plist-identify-parameter-list): + * when control transfers to called program, at the beginning, the contents of the Result field is placed in + * the Factor 1 field. + */ + it.isInPlist(compilationUnit) -> { + val resultName = it.getResultNameByFactor1(compilationUnit) + if (resultName == null || initialValues[resultName] is NullValue) { + blankValue(it) + } else { + initialValues[resultName] + } + } it.initializationValue != null -> eval(it.initializationValue) it.isCompileTimeArray() -> toArrayValue( @@ -384,6 +397,45 @@ open class InternalInterpreter( } } + /** + * Retrieves the result name associated with the current `AbstractDataDefinition` instance + * from the parameter list (PList) of the specified `CompilationUnit`. + * + * This function searches the PList for the first parameter where `factor1` is of type `DataRefExpr` + * and its variable name matches the name of the current `AbstractDataDefinition` (case-insensitively). + * If such a parameter is found, its associated result name is returned. + * + * @param compilationUnit the compilation unit whose entry PList is to be checked + * @return the result name associated with the matching parameter, or `null` if no match is found + */ + private fun AbstractDataDefinition.getResultNameByFactor1(compilationUnit: CompilationUnit): String? { + val resultName = compilationUnit.entryPlist?.params + ?.filter { plistParam -> plistParam.factor1 is DataRefExpr } + ?.firstOrNull { plistParamFiltered -> + (plistParamFiltered.factor1 as DataRefExpr).variable.name.equals( + this.name, + true + ) + } + ?.result?.name + return resultName + } + + /** + * Checks if the current `AbstractDataDefinition` instance is present in the parameter list (PList) + * of the specified `CompilationUnit`. + * + * This function evaluates whether the `AbstractDataDefinition` matches any parameter in the PList + * by comparing their names (case-insensitively). Parameters in the PList are filtered to include + * only those with a `factor1` of type `DataRefExpr`. + * + * @param compilationUnit the compilation unit whose entry PList is to be checked + * @return `true` if the `AbstractDataDefinition` is present in the PList, otherwise `false` + */ + private fun AbstractDataDefinition.isInPlist(compilationUnit: CompilationUnit) = compilationUnit.entryPlist?.params + ?.filter { plistParam -> plistParam.factor1 is DataRefExpr } + ?.any { plistParamFiltered -> (plistParamFiltered.factor1 as DataRefExpr).variable.name.equals(this.name, true) } == true + private fun toArrayValue(compileTimeArray: CompileTimeArray, arrayType: ArrayType): Value { // It is not clear why the compileTimeRecordsPerLine on the array type is null // probably it is an error during the ast processing. diff --git a/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/program.kt b/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/program.kt index d82ae8c2a..0c3aef205 100644 --- a/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/program.kt +++ b/rpgJavaInterpreter-core/src/main/kotlin/com/smeup/rpgparser/interpreter/program.kt @@ -64,10 +64,10 @@ class RpgProgram(val cu: CompilationUnit, val name: String = " - if (!pp.param.resolved) { - pp.param.tryToResolveRecursively(position = pp.position, cu = this) + if (!pp.result.resolved) { + pp.result.tryToResolveRecursively(position = pp.position, cu = this) } } diff --git a/rpgJavaInterpreter-core/src/test/kotlin/com/smeup/rpgparser/interpreter/JarikoCallbackTest.kt b/rpgJavaInterpreter-core/src/test/kotlin/com/smeup/rpgparser/interpreter/JarikoCallbackTest.kt index bcd8887ff..f4a20e2ef 100644 --- a/rpgJavaInterpreter-core/src/test/kotlin/com/smeup/rpgparser/interpreter/JarikoCallbackTest.kt +++ b/rpgJavaInterpreter-core/src/test/kotlin/com/smeup/rpgparser/interpreter/JarikoCallbackTest.kt @@ -385,7 +385,7 @@ class JarikoCallbackTest : AbstractTest() { @Test fun executeERROR08CallBackTest() { // Errors in block statements - executePgmCallBackTest("ERROR08", SourceReferenceType.Program, "ERROR08", listOf(7, 8, 9, 14, 15, 16, 21, 22)) + executePgmCallBackTest("ERROR08", SourceReferenceType.Program, "ERROR08", listOf(7, 8, 8, 9, 9, 14, 15, 15, 16, 16, 21, 22, 22)) } @Test 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 374922d4b..16fdabf2e 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 @@ -673,4 +673,111 @@ open class MULANGT10BaseCodopTest : MULANGTTest() { val expected = listOf("ok") assertEquals(expected, "smeup/MUDRNRAPU00274".outputOf(configuration = smeupConfig)) } + + /** + * This program tests the moving of value from Factor 2 to Result. This operation is performed at the end of execution of + * program called. In this case, MUDRNRAPU00172_P turn on indicator 35. Later, `DO` block ends its execution. + * @see #LS24005158 + */ + @Test + fun executeMUDRNRAPU00172() { + val expected = listOf("Sub program", "1") + assertEquals(expected, "smeup/MUDRNRAPU00172".outputOf(configuration = smeupConfig)) + } + + /** + * This program tests the behaviour of `CALL` and `PLIST` when is used the Params for both between caller and called. + * In accord to documentation: + * - when `CALL` is processed, the content of Factor 2 is placed in the Result field; + * - when control transfers to called program, the contents of the Result field is placed in the Factor 1 field. + * @see #LS24005158 + */ + @Test + fun executeMUDRNRAPU00173() { + val expected = listOf("BAR") + assertEquals(expected, "smeup/MUDRNRAPU00173".outputOf(configuration = smeupConfig)) + } + + /** + * This program tests the behaviour of `CALL` and `PLIST` when is used the Params for both between caller and called. + * Also, the called program change the result (`RES`) to another value. + * In accord to documentation: + * - when `CALL` is processed, the content of Factor 2 is placed in the Result field; + * - when control transfers to called program, the contents of the Result field is placed in the Factor 1 field. + * @see #LS24005158 + */ + @Test + fun executeMUDRNRAPU00174() { + val expected = listOf("BAR") + assertEquals(expected, "smeup/MUDRNRAPU00174".outputOf(configuration = smeupConfig)) + } + + /** + * This program is more complex. Tests the assignment of value between waterfall calls and by parameters. Each subprogram is + * called max 101 times (last is Jariko error), thanks `DO` statement; this main program calls `MUDRNRAPU00175_P1` which + * calls recursively `MUDRNRAPU00175_P2`. + * @see #LS24005158 + */ + @Test + fun executeMUDRNRAPU00175() { + val expected = listOf("HELLO") + assertEquals(expected, "smeup/MUDRNRAPU00175".outputOf(configuration = smeupConfig)) + } + + /** + * This program is more complex. Tests the assignment of value between waterfall calls and by using `EVAL`. + * Each subprogram is called max 101 times (last is Jariko error), thanks `DO` statement; this main program calls + * `MUDRNRAPU00176_P1` which calls recursively `MUDRNRAPU00176_P2`. + * @see #LS24005158 + */ + @Test + fun executeMUDRNRAPU00176() { + val expected = listOf("HELLO") + assertEquals(expected, "smeup/MUDRNRAPU00176".outputOf(configuration = smeupConfig)) + } + + /** + * This program call a sub program by using pre-initialized variables as factors and result. The called program + * doesn't make any assignment. + * This tests the full behaviour between a CALLER and CALLED, where: + * - caller (at the beginning) move Factor 2 to Result; + * - called (at the beginning) move Result to Factor 1; + * - called (at the end) move Factor 2 to Result; + * - caller (at the end) move Result to Factor 1. + * @see #LS24005158 + */ + @Test + fun executeMUDRNRAPU00177() { + val expected = listOf("CALLED", "BAR", "", "BAR", "CALLER", "", "BAR", "") + assertEquals(expected, "smeup/MUDRNRAPU00177".outputOf(configuration = smeupConfig)) + } + + /** + * This program call a sub program by using pre-initialized variables as factors and result. The called program + * doesn't make any assignment. + * This tests the full behaviour between a CALLER and CALLED, where: + * - caller (at the beginning) move Factor 2 to Result; + * - called (at the beginning) move Result to Factor 1; + * - caller (at the end) move Result to Factor 1. + * @see #LS24005158 + */ + @Test + fun executeMUDRNRAPU00178() { + val expected = listOf("CALLED", "BAR", "BAR", "CALLER", "BAR", "BAR", "BAR") + assertEquals(expected, "smeup/MUDRNRAPU00178".outputOf(configuration = smeupConfig)) + } + + /** + * This program call a sub program by using pre-initialized variables as factors and result. The called program + * doesn't make any assignment. + * This tests the full behaviour between a CALLER and CALLED, where: + * - called (at the beginning) move Result to Factor 1; + * - caller (at the end) move Result to Factor 1. + * @see #LS24005158 + */ + @Test + fun executeMUDRNRAPU00179() { + val expected = listOf("CALLED", "BAZ", "BAZ", "CALLER", "BAZ", "BAZ") + assertEquals(expected, "smeup/MUDRNRAPU00179".outputOf(configuration = smeupConfig)) + } } \ No newline at end of file diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00172.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00172.rpgle new file mode 100644 index 000000000..2b780e79b --- /dev/null +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00172.rpgle @@ -0,0 +1,37 @@ + V* ============================================================== + V* 29/11/2024 APU001 Creation + V* ============================================================== + O * PROGRAM GOAL + O * This program tests the moving of value, as indicator, + O * from Factor 2 to Result. This operation is performed at the + O * end of execution of program called. + O * In this case, MUDRNRAPU00172_P turn on indicator 35. Later, + O * `DO` block ends its execution. + V* ============================================================== + O * JARIKO ANOMALY + O * Before the fix: + O * `Issue executing MoveLStmt at line 9. Index 10 out of + O * bounds for length 10` + O * Because this logic for program called didn't exist. + V* ============================================================== + D ARRAY S 1 0 DIM(10) INZ(0) + D VALUE S 1 0 INZ(1) + D PGM_NAME S 17 INZ('MUDRNRAPU00172_P' ) + + C 1 DO 11 CNT 5 0 + C EXSR PGM_CALL + C V35 DSPLY + C 35 LEAVE + C MOVEL(P) VALUE ARRAY(CNT) #Issue executing MoveLStmt at line 9. Index 10 out of bounds for length 10 + C 'LOOP' DSPLY + C ENDDO + + C SETON LR + + + + C PGM_CALL BEGSR + C SETOFF 35 + C CALL PGM_NAME + C *IN35 PARM V35 1 + C ENDSR \ No newline at end of file diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00172_P.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00172_P.rpgle new file mode 100644 index 000000000..ac26da1b6 --- /dev/null +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00172_P.rpgle @@ -0,0 +1,16 @@ + V* ============================================================== + V* 29/11/2024 APU001 Creation + V* ============================================================== + O * PROGRAM GOAL + O * This program is used by 'MUDRNRAPU00172' for its purpose. + V* ============================================================== + C 'Sub program' DSPLY + C SETON 35 + C SETON RT + + + + C *INZSR BEGSR + C *ENTRY PLIST + C PARM *IN35 ££35 1 + C ENDSR diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00173.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00173.rpgle new file mode 100644 index 000000000..7f22bb12f --- /dev/null +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00173.rpgle @@ -0,0 +1,21 @@ + V* ============================================================== + V* 29/11/2024 APU001 Creation + V* ============================================================== + O * PROGRAM GOAL + O * This program tests the behaviour of `CALL` and `PLIST` when is + O * used the Params for both between caller and called. + O * In accord to documentation: + O * - when `CALL` is processed, the content of Factor 2 is placed + O * in the Result field; + O * - when control transfers to called program, the contents + O * of the Result field is placed in the Factor 1 field. + V* ============================================================== + D PGM_NAME S 17 INZ('MUDRNRAPU00173_P') + D PARM1 S 3 INZ(*BLANKS) + + C CALL PGM_NAME + C PARM1 PARM 'FOO' RES 3 + C PARM1 IFEQ 'BAR' + C PARM1 DSPLY + C ENDIF + C SETON LR diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00173_P.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00173_P.rpgle new file mode 100644 index 000000000..4670bfc83 --- /dev/null +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00173_P.rpgle @@ -0,0 +1,20 @@ + V* ============================================================== + V* 29/11/2024 APU001 Creation + V* ============================================================== + O * PROGRAM GOAL + O * This program is used by 'MUDRNRAPU00173' for its purpose. + V* ============================================================== + D PARM1 S 3 INZ(*BLANKS) + D PARM2 S 3 INZ(*BLANKS) + + C PARM1 IFEQ 'FOO' + C EVAL PARM2='BAR' + C ENDIF + C SETON RT + + + + C *INZSR BEGSR + C *ENTRY PLIST + C PARM1 PARM PARM2 RES 3 + C ENDSR diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00174.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00174.rpgle new file mode 100644 index 000000000..9b1aa127b --- /dev/null +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00174.rpgle @@ -0,0 +1,21 @@ + V* ============================================================== + V* 02/12/2024 APU001 Creation + V* ============================================================== + O * PROGRAM GOAL + O * This program tests the behaviour of `CALL` and `PLIST` when is + O * used the Params for both between caller and called. + O * Also, the called program change the result (`RES`) to another + O * value. + O * In accord to documentation: + O * - when `CALL` is processed, the content of Factor 2 is placed + O * in the Result field; + O * - when control transfers to called program, the contents + O * of the Result field is placed in the Factor 1 field. + V* ============================================================== + D PGM_NAME S 17 INZ('MUDRNRAPU00174_P') + D PARM1 S 3 INZ(*BLANKS) + + C CALL PGM_NAME + C PARM1 PARM 'FOO' RES 3 + C PARM1 DSPLY + C SETON LR \ No newline at end of file diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00174_P.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00174_P.rpgle new file mode 100644 index 000000000..8e583ae9f --- /dev/null +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00174_P.rpgle @@ -0,0 +1,19 @@ + V* ============================================================== + V* 02/12/2024 APU001 Creation + V* ============================================================== + O * PROGRAM GOAL + O * This program is used by 'MUDRNRAPU00174' for its purpose. + V* ============================================================== + D PARM1 S 3 INZ(*BLANKS) + D PARM2 S 3 INZ(*BLANKS) + + C EVAL PARM2='BAR' + C EVAL RES='123' + C SETON RT + + + + C *INZSR BEGSR + C *ENTRY PLIST + C PARM1 PARM PARM2 RES 3 + C ENDSR \ No newline at end of file diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00175.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00175.rpgle new file mode 100644 index 000000000..3ba4764a5 --- /dev/null +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00175.rpgle @@ -0,0 +1,40 @@ + V* ============================================================== + V* 03/12/2024 BERNI Creation + V* 03/12/2024 APU001 Edit by removing COPY for compatibility + V* on Jariko + V* ============================================================== + O * PROGRAM GOAL + O * This program is more complex. Tests the assignment of value + O * between waterfall calls and by parameters. Each subprogram is + O * called max 101 times (last is Jariko error), thanks `DO` + O * statement; this main program calls `MUDRNRAPU00175_P1` which + O * calls recursively `MUDRNRAPU00175_P2`. + V* ============================================================== + DXXARRAY S 1 DIM(100) INZ + D PGM_NAME S 17 INZ('MUDRNRAPU00175_P1') + *--------------------------------------------------------------- + D* M A I N + *--------------------------------------------------------------- + * Empty Main + * + C SETON RT + *--------------------------------------------------------------- + RD* INITIAL ROUTINE + *--------------------------------------------------------------* + C *INZSR BEGSR + * + C DO *HIVAL $X 5 0 + * Cycling on MUDRNRAPU00175_P1 program + C CALL PGM_NAME + C *IN35 PARM ££35 1 + * If indicator 35 is turned on, the cycle is interrupted. + C 35 LEAVE + * + * . else, assign the indicator value to array. + C EVAL XXARRAY($X)=££35 + * + C ENDDO + * + C 'HELLO' DSPLY + * + C ENDSR diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00175_P1.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00175_P1.rpgle new file mode 100644 index 000000000..cf3986f06 --- /dev/null +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00175_P1.rpgle @@ -0,0 +1,35 @@ + V* ============================================================== + V* 03/12/2024 BERNIC Creation + V* 03/12/2024 APU001 Edit by removing COPY for compatibility + V* on Jariko. In addition, translated in English + V* several comments. + V* ============================================================== + O * PROGRAM GOAL + O * This program is used by 'MUDRNRAPU00175' for its purpose. + V* ============================================================== + D PGM_NAME S 17 INZ('MUDRNRAPU00175_P2') + *--------------------------------------------------------------- + D* M A I N + *--------------------------------------------------------------- + * Calling PGM MUDRNRAPU00175_P2 + C EXSR CALL_PGM + * + C SETON RT + *--------------------------------------------------------------- + RD* CALLED SUBROUTINE + *--------------------------------------------------------------* + C CALL_PGM BEGSR + * + C CALL PGM_NAME + C PARM ££35 + * + C ENDSR + *--------------------------------------------------------------- + RD* INITIAL ROUTINE + *--------------------------------------------------------------* + C *INZSR BEGSR + * + C *ENTRY PLIST + C PARM ££35 1 + * + C ENDSR \ No newline at end of file diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00175_P2.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00175_P2.rpgle new file mode 100644 index 000000000..05d80908c --- /dev/null +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00175_P2.rpgle @@ -0,0 +1,24 @@ + V* ============================================================== + V* 03/12/2024 BERNIC Creation + V* 03/12/2024 APU001 Edit by removing COPY for compatibility + V* on Jariko. In addition, translated in English + V* several comments. + V* ============================================================== + O * PROGRAM GOAL + O * This program is used by 'MUDRNRAPU00175' for its purpose. + V* ============================================================== + D* M A I N + *--------------------------------------------------------------- + * Turning on indicator + C EVAL *IN35=*ON + * + C SETON RT + *--------------------------------------------------------------- + RD* INITIAL ROUTINE + *--------------------------------------------------------------* + C *INZSR BEGSR + * + C *ENTRY PLIST + C PARM *IN35 ££35 1 + * + C ENDSR \ No newline at end of file diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00176.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00176.rpgle new file mode 100644 index 000000000..1faf29e04 --- /dev/null +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00176.rpgle @@ -0,0 +1,42 @@ + V* ============================================================== + V* 03/12/2024 BERNI Creation + V* 03/12/2024 APU001 Edit by removing COPY for compatibility + V* on Jariko + V* ============================================================== + O * PROGRAM GOAL + O * This program is more complex. Tests the assignment of value + O * between waterfall calls and by using `EVAL`. + O * Each subprogram is called max 101 times (last is Jariko error), + O * thanks `DO` statement; this main program calls + O * `MUDRNRAPU00176_P1` which calls recursively `MUDRNRAPU00176_P2`. + V* ============================================================== + DXXARRAY S 1 DIM(100) INZ + D PGM_NAME S 17 INZ('MUDRNRAPU00176_P1') + *--------------------------------------------------------------- + D* M A I N + *--------------------------------------------------------------- + * Empty Main + * + C SETON RT + *--------------------------------------------------------------- + RD* INITIAL ROUTINE + *--------------------------------------------------------------* + C *INZSR BEGSR + * + C DO *HIVAL $X 5 0 + * Cycling on MUDRNRAPU00176_P1 program + C CALL PGM_NAME + C PARM ££35 1 + * Uso eval per valorizzare indicatore 35 + C EVAL *IN35=££35 + * If indicator 35 is turned on, the cycle is interrupted. + C 35 LEAVE + * + * . else, assign the indicator value to array. + C EVAL XXARRAY($X)=££35 + * + C ENDDO + * + C 'HELLO' DSPLY + * + C ENDSR diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00176_P1.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00176_P1.rpgle new file mode 100644 index 000000000..5e447f456 --- /dev/null +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00176_P1.rpgle @@ -0,0 +1,35 @@ + V* ============================================================== + V* 03/12/2024 BERNIC Creation + V* 03/12/2024 APU001 Edit by removing COPY for compatibility + V* on Jariko. In addition, translated in English + V* several comments. + V* ============================================================== + O * PROGRAM GOAL + O * This program is used by 'MUDRNRAPU00176' for its purpose. + V* ============================================================== + D PGM_NAME S 17 INZ('MUDRNRAPU00176_P2') + *--------------------------------------------------------------- + D* M A I N + *--------------------------------------------------------------- + * Calling PGM MUDRNRAPU00176_P2 + C EXSR CALL_PGM + * + C SETON RT + *--------------------------------------------------------------- + RD* CALLED SUBROUTINE + *--------------------------------------------------------------* + C CALL_PGM BEGSR + * + C CALL PGM_NAME + C PARM ££35 + * + C ENDSR + *--------------------------------------------------------------- + RD* INITIAL ROUTINE + *--------------------------------------------------------------* + C *INZSR BEGSR + * + C *ENTRY PLIST + C PARM ££35 1 + * + C ENDSR \ No newline at end of file diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00176_P2.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00176_P2.rpgle new file mode 100644 index 000000000..2866f12d6 --- /dev/null +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00176_P2.rpgle @@ -0,0 +1,27 @@ + V* ============================================================== + V* 03/12/2024 BERNIC Creation + V* 03/12/2024 APU001 Edit by removing COPY for compatibility + V* on Jariko. In addition, translated in English + V* several comments. + V* ============================================================== + O * PROGRAM GOAL + O * This program is used by 'MUDRNRAPU00176' for its purpose. + V* ============================================================== + D* M A I N + *--------------------------------------------------------------- + * Turning on indicator + C EVAL *IN35=*ON + * + * Assigning value of indicator to result of PLIST. + C EVAL ££35=*IN35 + * + C SETON RT + *--------------------------------------------------------------- + RD* INITIAL ROUTINE + *--------------------------------------------------------------* + C *INZSR BEGSR + * + C *ENTRY PLIST + C PARM ££35 1 + * + C ENDSR \ No newline at end of file diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00177.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00177.rpgle new file mode 100644 index 000000000..d6693f737 --- /dev/null +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00177.rpgle @@ -0,0 +1,27 @@ + V* ============================================================== + V* 05/12/2024 APU001 Creation + V* ============================================================== + O * PROGRAM GOAL + O * This program call a sub program by using pre-initialized + O * variables as factors and result. + O * The called program doesn't make any assignment. + O * This tests the full behaviour between a CALLER and CALLED, where: + O * - Caller (at the beginning) move Factor 2 to Result; + O * - Called (at the beginning) move Result to Factor 1; + O * - Called (at the end) move Factor 2 to Result; + O * - Caller (at the end) move Result to Factor 1. + V* ============================================================== + D PGM_NAME S 17 INZ('MUDRNRAPU00177_P1') + D PARM1 S 3 INZ('FOO') + D PARM2 S 3 INZ('BAR') + D RESULT S 3 INZ('BAZ') + + C CALL PGM_NAME + C PARM1 PARM PARM2 RESULT + + C 'CALLER' DSPLY + C PARM1 DSPLY + C PARM2 DSPLY + C RESULT DSPLY + + C SETON LR \ No newline at end of file diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00177_P1.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00177_P1.rpgle new file mode 100644 index 000000000..cbd33a4aa --- /dev/null +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00177_P1.rpgle @@ -0,0 +1,20 @@ + V* ============================================================== + V* 05/12/2024 APU001 Creation + V* ============================================================== + O * PROGRAM GOAL + O * This program is used by 'MUDRNRAPU00177' for its purpose. + V* ============================================================== + D PARM1 S 3 INZ(*BLANKS) + D PARM2 S 3 INZ(*BLANKS) + D RESULT S 3 + + C 'CALLED' DSPLY + C PARM1 DSPLY + C PARM2 DSPLY + C RESULT DSPLY + C SETON RT + + C *INZSR BEGSR + C *ENTRY PLIST + C PARM1 PARM PARM2 RESULT + C ENDSR \ No newline at end of file diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00178.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00178.rpgle new file mode 100644 index 000000000..f398572c7 --- /dev/null +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00178.rpgle @@ -0,0 +1,26 @@ + V* ============================================================== + V* 05/12/2024 APU001 Creation + V* ============================================================== + O * PROGRAM GOAL + O * This program call a sub program by using pre-initialized + O * variables as factors and result. + O * The called program doesn't make any assignment. + O * This tests the full behaviour between a CALLER and CALLED, where: + O * - Caller (at the beginning) move Factor 2 to Result; + O * - Called (at the beginning) move Result to Factor 1; + O * - Caller (at the end) move Result to Factor 1. + V* ============================================================== + D PGM_NAME S 17 INZ('MUDRNRAPU00178_P1') + D PARM1 S 3 INZ('FOO') + D PARM2 S 3 INZ('BAR') + D RESULT S 3 INZ('BAZ') + + C CALL PGM_NAME + C PARM1 PARM PARM2 RESULT + + C 'CALLER' DSPLY + C PARM1 DSPLY + C PARM2 DSPLY + C RESULT DSPLY + + C SETON LR \ No newline at end of file diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00178_P1.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00178_P1.rpgle new file mode 100644 index 000000000..d6ad166c0 --- /dev/null +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00178_P1.rpgle @@ -0,0 +1,18 @@ + V* ============================================================== + V* 05/12/2024 APU001 Creation + V* ============================================================== + O * PROGRAM GOAL + O * This program is used by 'MUDRNRAPU00178' for its purpose. + V* ============================================================== + D PARM1 S 3 INZ('AUX') + D RESULT S 3 + + C 'CALLED' DSPLY + C PARM1 DSPLY + C RESULT DSPLY + C SETON RT + + C *INZSR BEGSR + C *ENTRY PLIST + C PARM1 PARM RESULT + C ENDSR \ No newline at end of file diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00179.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00179.rpgle new file mode 100644 index 000000000..8dae569e8 --- /dev/null +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00179.rpgle @@ -0,0 +1,23 @@ + V* ============================================================== + V* 05/12/2024 APU001 Creation + V* ============================================================== + O * PROGRAM GOAL + O * This program call a sub program by using pre-initialized + O * variables as factors and result. + O * The called program doesn't make any assignment. + O * This tests the full behaviour between a CALLER and CALLED, where: + O * - Called (at the beginning) move Result to Factor 1; + O * - Caller (at the end) move Result to Factor 1. + V* ============================================================== + D PGM_NAME S 17 INZ('MUDRNRAPU00179_P1') + D PARM1 S 3 INZ('FOO') + D RESULT S 3 INZ('BAZ') + + C CALL PGM_NAME + C PARM1 PARM RESULT + + C 'CALLER' DSPLY + C PARM1 DSPLY + C RESULT DSPLY + + C SETON LR \ No newline at end of file diff --git a/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00179_P1.rpgle b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00179_P1.rpgle new file mode 100644 index 000000000..2b0cfaa95 --- /dev/null +++ b/rpgJavaInterpreter-core/src/test/resources/smeup/MUDRNRAPU00179_P1.rpgle @@ -0,0 +1,18 @@ + V* ============================================================== + V* 05/12/2024 APU001 Creation + V* ============================================================== + O * PROGRAM GOAL + O * This program is used by 'MUDRNRAPU00179' for its purpose. + V* ============================================================== + D PARM1 S 3 INZ('AUX') + D RESULT S 3 + + C 'CALLED' DSPLY + C PARM1 DSPLY + C RESULT DSPLY + C SETON RT + + C *INZSR BEGSR + C *ENTRY PLIST + C PARM1 PARM RESULT + C ENDSR \ No newline at end of file