Below is a single program with two sub-routines. The first functionABC works fine. The second, functionABC2 uses the returning keyword but gets this error:
libcob: subProgram.cbl:44: error: BASED/LINKAGE item 'avalue2' has NULL address. I get this error if I use returnvalue or returnvalue2, either one causes this problem.
My build command: cobc --debug -x -free -g subProgram.cbl
I feel like I've tried everything and have followed the programmer's guide to no avail.
Any help please? Thanks!
IdentificationDivision.Program-ID.TestSubProgram.EnvironmentDivision.DataDivision.Working-StorageSection.01ctr1pic999value0.77returnvaluepic9(8)value0.77returnvalue2usagebinary-longsigned.LinkageSection.ProcedureDivision.Begin.Display"Hello World!"move10toctr1.call'functionABC'USINGctr1returnvalue.Displayreturnvalue.move0toreturnvalue2.call'functionABC2'RETURNINGreturnvalue2.Displayreturnvalue2.stoprun.identificationdivision.program-id.functionABC.datadivision.working-storagesection.77localvarpic999.linkagesection.01countervarpic999.01avaluepic9(8)value0.proceduredivisionUSINGcountervaravalue.performcountervartimesDisplay"hello from sub-program"end-performmove999toavalue.exit.ENDPROGRAMfunctionABC.identificationdivision.program-id.functionABC2.datadivision.working-storagesection.linkagesection.77avalue2USAGEBINARY-LONGsigned.proceduredivisionRETURNINGavalue2.move0toavalue2computeavalue2=aValue2+2Displayavalue2GoBack.ENDPROGRAMfunctionABC2.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Below is a single program with two sub-routines. The first functionABC works fine. The second, functionABC2 uses the returning keyword but gets this error:
libcob: subProgram.cbl:44: error: BASED/LINKAGE item 'avalue2' has NULL address. I get this error if I use returnvalue or returnvalue2, either one causes this problem.
My build command: cobc --debug -x -free -g subProgram.cbl
I feel like I've tried everything and have followed the programmer's guide to no avail.
Any help please? Thanks!