You now need to create a new class file to contain the main method:
This opens the New dialog box.
This opens the New Java Class dialog box.
This opens the MainClass.java in an editor.
package com.calc; import my.pack.Calculator; public class MainClass { public static void main(String[] args) { Calculator calc = new Calculator(); int result = 0; calc.Calculator(1,2,result); System.out.println(result); } }
long my.pack.Calculator.Calculator(int lnk-arg1, int lnk-arg2, int lnk-sum)The result variable will always be equal to 0 because it uses the by value option for the lnk-sum argument in the procedure division of the Calculator.cbl program. To get a return value, set the variable used for result to be passed as by reference. Modify the procedure division in the Calculator.cbl file to:
procedure division using by value lnk-arg1, by value lnk-arg2, by reference lnk-sum.
This opens the Add Library dialog box.
This displays the path to the runtime to be used.
$set ILSMARTLINKAGE "my.pack"
(int lnk-arg1, int lnk-arg2, LnkSum my.pack.LnkSum)Modify the main method in the MainClass.java file:
public static void main(String[] args) { Calculator calc = new Calculator(); LnkSum sum = new LnkSum(); calc.Calculator(1,2,sum); System.out.println(sum.getLnkSum()); }Also, ensure that you add the following import:
import my.pack.LnkSum;