I have a map in which the user enter two values which are to be updated in the database table. I wrote both the programs but i am unable to know how to pass the two field values entered in the map to another program. I came to knew that i can use Linkage Section. But don’t know the syntax or any details on it. Can anyone help me with the syntax. Thank you
Share
There should be some
WORKING-STORAGEin the program where values retrieved from CICS maps is held. For example:Suppose this program is called
PROG1and you want to pass these values a second COBOL program calledPROG2.Generally, this is done in COBOL using
a dynamic subroutine call. The typical way of accomplishing a dynamic call is to put the name of the
called program into a WORKING-STORAGE variable. I declared
PROGRAM-NAMEfor this purpose. Data may bepassed to the called program as individual items:
Above is a dynamic call to
PROG2which passesSOME-FILEDandSOME-OTHER-FIELDby reference.PROG2receives these data through its linkage section as follows:The PROCEDURE DIVISION of
PROG2would look something like this:Alternatively, you could pass the whole record as a single parameter from
PROG1:and in
PROG2Finally, when
PROG2has completed its work it should terminate with aGOBACKorEXIT PROGRAM. Do not useSTOP RUNasthis will exit the main program (
PROG1) as well.COBOL calling conventions are similar to most other procedural languages. Parameters may be passed
by reference (the default), by value or by content. Most COBOL vendors support all of these parameter passing
mechanisms but may have minor differenes in implementation. The above examples are for IBM Enterprise COBOL. If you
are using a different version of COBOL it would be a good idea to check your COBOL Reference Guide and COBOL Programming Guide.
You can get the IBM Enterprise COBOL guides on line: Language Reference Guide
and Programming Reference Guide