|Title: How can I make my Linkage parameters more flexible?|
By using standard COBOL variables in the Linkage Section of your program to receive strings and numbers, you force the calling programs to use specific data items to pass the parameters.
program-id. callee. configuration section. repository. class cobolvar as "com.iscobol.types.CobolVar". |note: if you're compiling with -cp, the class name is "com.iscobol.types_n.CobolVar" working-storage section. 77 string-param pic x any length. 77 numeric-param pic s9(9). linkage section. 77 param-1 object reference cobolvar. 77 param-2 object reference cobolvar. procedure division using param-1, param-2. main. set string-param to param-1:>toString() set numeric-param to param-2:>toint() display "First parameter (string): " string-param. display "Second parameter (number): " numeric-param. goback.
Test it with
working-storage section. procedure division. call "callee" using "xxx" 123.
2) dynamic length items
working-storage section. 77 dynamic-string pic x any length. procedure division. move "xxx" to dynamic-string. call "callee" using dynamic-string 123.
3) fixed length items and comp items
working-storage section. 77 fixed-string pic x(10). 77 my-number pic 9 comp-1. procedure division. move "xxx" to fixed-string move 123 to my-number call "callee" using fixed-string my-number.
|Authored by: Veryant Support on Tue, Apr 5th, 2016 at 7:00 PM
This question has been viewed 2456 times so far.
|Online URL: http://support.veryant.com/support/phpkb/question.php?ID=267|
Powered by PHPKB Knowledge Base Software