How to control which programs can call a subroutine?

Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

How to control which programs can call a subroutine?

Postby tivrfoa » Fri Nov 09, 2018 9:33 pm


So, imagine I have subroutine S1, and 2 programs: P1 and P2.
Only P1 can call S1.
How would you handle that?

If I call with EXEC CICS LINK, is there a CICS variable that S1 can use that tells who called her, ie, the name of the caller program?

Thank you.
Posts: 84
Joined: Wed Aug 22, 2012 6:35 pm
Has thanked: 60 times
Been thanked: 0 time

Re: How to control which programs can call a subroutine?

Postby Robert Sample » Fri Nov 09, 2018 10:43 pm

As long as P1 and P2 have different transaction identifiers, you can use EIBTRNID to distinguish between them. If they do not have different transaction identifiers, about all you could do would be to have P1 set a flag in a system resource (DFHCOMMAREA, TS QUEUE or FILE record would be the most obvious spots although others could be used) that S1 could use to determine if it was called by the right program.

CICS does not track which program called which other program. CICS knows if a LINK or XCTL was used since they can impact where a RETURN goes, but as far as which program did the LINK or XCTL, CICS doesn't know nor care. Depending upon your site's security package, you might be able to use it to restrict access to S1 -- but whether or not that is even possible would be a question for your site support group.

These users thanked the author Robert Sample for the post:
tivrfoa (Fri Nov 09, 2018 11:24 pm)
Robert Sample
Global moderator
Posts: 3657
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 270 times

Return to IBM Cobol


  • Related topics
    Last post