C & # 8594; COBOL main language mainframe communication

A vendor package written in C on a mainframe offers the ability to override part of its functions through user output. Provided C function prototype:

extern int SomeExit (void * Parameters, void * Record1, void * Record2, char ComparisonType, char * RankString, void * NotUsed1, int * NotUsed2) 

Since we are primarily a COBOL store, I defined Enterprise COBOL 4.2 (as a DLL) to implement an exit trying to comply with the conventions in the IBM ILC manual ( https://www.ibm.com/support/knowledgecenter/en/SSLTBW_1. 13.0 / com.ibm.zos.r13.ceea400 / clcccb5.htm # clcccb5 ) and examples in this old SHARE view: http://www-01.ibm.com/support/docview.wss?uid=swg27003846&aid=1 , but the resulting program does not work because it causes an exit even before my DISPLAY message. My assumption is that I incorrectly declared the structures of the received data. The following is a snippet of my current test code (ignore my naming conventions - this is a prototype to prove the interface and will be rewritten to our own standards as soon as I have the main call).

 IDENTIFICATION DIVISION. PROGRAM-ID. "SomeExit". ... LINKAGE SECTION. 01 WS-PARAMETERS-POINTER USAGE IS POINTER SYNCHRONIZED. 01 SORT-PASS-RECORD1-POINTER USAGE IS POINTER SYNCHRONIZED. 01 SORT-PASS-RECORD2-POINTER USAGE IS POINTER SYNCHRONIZED. 01 WS-COMPARISION-TYPE PIC X. 01 WS-RANK-STRING-POINTER USAGE IS POINTER SYNCHRONIZED. 01 WS-NOT-USED1-POINTER USAGE IS POINTER SYNCHRONIZED. 01 WS-NOT-USED2-POINTER USAGE IS POINTER SYNCHRONIZED. 01 WS-RETURN PIC S9(9) USAGE IS BINARY. ... PROCEDURE DIVISION USING BY VALUE WS-PARAMETERS-POINTER SORT-PASS-RECORD1-POINTER SORT-PASS-RECORD2-POINTER WS-COMPARISION-TYPE WS-RANK-STRING-POINTER WS-NOT-USED1-POINTER WS-NOT-USED2-POINTER RETURNING WS-RETURN. DISPLAY 'IN EXIT'. ... MOVE 0 TO WS-RETURN. GOBACK. 

Cancel:

 CEE3250C The system or user abend U 016 R=00000000 was issued. From entry point main at compile unit offset +00000192 at entry offset +00000192 at address 28500ECA. 

Provider code dynamically calls a DLL. When I delete the DLL, I get a message saying that the output could not be found, and therefore it seems that the C code is trying to call it.

I tried the PROCEDURE DIVISION USING options, including removing BY VALUE using BY REFERENCE (although I understand that this is the default) and replacing the POINTERs with the actual structure definitions. I misunderstood the guide to structuring the parameters passed to the COBOL procedure?

Edit: I have a support ticket with the seller, but they have not yet responded with anything useful.

Thanks David

+5
source share
1 answer

Thanks to the comments, I was able to determine a solution based on a better understanding of the call structure proposed by Bills. Given this prototype C:

 extern int SomeExit (void * Parameters, void * Record1, void * Record2, char ComparisonType, char * RankString, void * NotUsed1, int * NotUsed2) 

Decision:

 IDENTIFICATION DIVISION. PROGRAM-ID. "SomeExit". ... LINKAGE SECTION. 01 WS-PARAMETERS PIC X(10). 01 SORT-PASS-RECORD1 PIC X(50). 01 SORT-PASS-RECORD2 PIC X(50). 01 WS-COMPARISON-TYPE PIC X. 01 WS-RANK-STRING PIC X(6). 01 WS-NOT-USED1 PIC X. 01 WS-NOT-USED2 PIC X. 01 WS-RETURN PIC S9(9) USAGE IS BINARY. ... PROCEDURE DIVISION USING BY REFERENCE WS-PARAMETERS BY REFERENCE SORT-PASS-RECORD1 BY REFERENCE SORT-PASS-RECORD2 BY VALUE WS-COMPARISON-TYPE BY REFERENCE WS-RANK-STRING BY REFERENCE WS-NOT-USED1 BY REFERENCE WS-NOT-USED2 RETURNING WS-RETURN. DISPLAY 'IN EXIT'. ... MOVE 0 TO WS-RETURN. GOBACK. 

With the above, the user exit was successfully called and returned the value to the provider logic. I used the following parameters to compile RENT, TRUNC(BIN), DLL,EXPORTALL and to bind DYNAM(DLL),RENT . Not required for my application, but if the calling program expects a mixed routine name in the called program, as used in the solution example above, then PGMNAME(LONGMIXED) would be needed.

Thanks to all the commentators for pointing me in the right direction.

+4
source

Source: https://habr.com/ru/post/1259186/


All Articles