I'm working on a Wrapper/Bridge COBOL program that handles program calls and performs cross-cutting operations like logging,security-check etc. Main motivation is checking the security access for consumer program whether it has access to call the producer program or not.
Let the bridge COBOL program be B1 and the producer program P1 and the consumer(client) C1.
When C1 wants to call P1, it have to make a call to B1. Then, B1 checks the accessibility. If C1 has access, then B1 calls P1 with C1's data.
C1 -> B1 -> P1
In here the linkage section of B1 and P1 are the same. Programs are using EXEC CICS LINK to call each other.
The COMMAREA,
COMMAREA1 (DataSet Name)
01 COMMAREA-STRUCT,
03 a-field
03 another-field
...
The client;
IDENTIFICATION DIVISION.
PROGRAM-ID. Client.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
COPY COMMAREA1
PROCEDURE DIVISION
/* fill CommareaStruct with some values. */
....
/* call B1 Bridge */
EXEC CICS LINK PROGRAM (B1Bridge) NOHANDLE
COMMAREA (COMMAREA-STRUCT)
LENGTH (LENGTH OF COMMAREA-STRUCT)
END-EXEC
....
The Bridge,
IDENTIFICATION DIVISION.
PROGRAM-ID. B1Bridge.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
LINKAGE SECTION.
COPY COMMAREA1
PROCEDURE DIVISION
...
/* access control */
/* logging */
...
/* pass data to P1*/
EXEC CICS LINK PROGRAM (P1) NOHANDLE
COMMAREA (COMMAREA-STRUCT)
LENGTH (LENGTH OF COMMAREA-STRUCT)
END-EXEC
....
The producer ;
IDENTIFICATION DIVISION.
PROGRAM-ID. P1
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
LINKAGE SECTION.
COPY COMMAREA1
PROCEDURE DIVISION
....
*doing some business with data in COMMAREA1
...
When I try above, I got a compile-time warning for Bridge Program B1 ; "COMMAREA-STRUCT or one of its subordinates was referenced, but COMMAREA-STRUCT was a LINKAGE SECTION item that did not have addressability. This reference will not be resolved succcessfully at execution."
What does it mean? How should I pass B1's linkage section to P1's linkage section?
When I try like this, I got EIBRESP:22 and EIBRESP2: 26 (commarea length error) at runtime.
-- Edit --
I think I should give more details;
Main motivation; Actually there are two companies that company COM1 and COM2. COM2 was an affiliate of COM1 for several years. COM1 and COM2 have CICS1 and CICS2 respectively. And COM2 client programs uses COM1 producer programs. COM2 clients never call the COM1 producers directly. COM2 clients put the data into COMMAREA-STRUCT and call a Generic Cobol Program (let it be GCP) remotely. COMMAREA-STRUCT has also "the producer program name" field that GCP figures out which program is wanted to be called. So, GCP exports the data from COMMAREA-STRUCT and maps to the fields of producer. GCP performs the mapping operations dynamically with addressing(not special for each producer). After the producer performs, GCP takes the result and passes back to the client via COMMAREA-STRUCT. The system was designed like that several years ago. There are thousands of clients of COM2 and thousands of producers of COM1.
Now, COM2 wants to apart from COM1. So COM1 don't want to give full access to all COM1 resources(producers) any more. Thus, COM1 wants to put a new cics in front of the CICS1 which will be a handler CICS that runs only B1 Bridge program locally. This also about network security and company-political decisions.
To seperate the companies from each other in a little while, neither the clients nor the producers should be affected. So, problem should be solved in GCP-Bridge layer.
That's why, B1 Bridge should behave like GCP to the COM2 Clients, should check the accessibility(somehow, we applied it) and should pass all the data that coming from the clients to the GCP without any modification.
Currenty the logging operation does not have any priority. We focus on part the companies in a little while.
So I'm very appreciated for your expert comments.
*We can't use CALL because B1 will be on another CICS and can not access the LOADLIB1 of COM1 thats why B1 should call GCP remotly by EXEC CICS LINK.
*Instead of passing commarea, passing the channel sounds good to me. We will discuss on it.
*By the way, i will check fullword-halfword conflict on LENGHT OF. You are right.
*For the security check, we will discuss on "EXEC CICS QUERY SECURITY".
*As mentioned above, we can not modify copy-books. Only we can change is,
EXEC CICS LINK PROGRAM (GCP)
to
EXEC CICS LINK PROGRAM (B1)
on the clients by find&replace. Because there are thousands of clients. We don't want to change copy-book and touch them.
In lights of these details, I think the problem becomes more understandable.
EXEC CICS QUERY SECURITY
may be advisable for security (check with your security folks). Logging - to where? VSAM? DB2? What are you logging? – Paulinepauling