Subject: | |
From: | |
Reply To: | James Clark, Jr. |
Date: | Tue, 7 Jul 1998 15:15:48 -0400 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
What you are seeing is the difference of sizes used for integers. Int in C
is a 4 byte integer. A S9(4) COMP is a two byte integer. The pointer is
pointing to only the first two bytes passed. So when the value is changed
only the top two bytes are changed.
Make your COBOL S9(8) OR S9(9) COMP and the COBOL manual has a section which
matches the types of different languages for just this problem.
James
-----Original Message-----
From: Jens von Bülow <[log in to unmask]>
To: [log in to unmask] <[log in to unmask]>
Date: Tuesday, July 07, 1998 5:33 AM
Subject: Cobol routine in XL called by C
>Greetings,
>
>I have not having much fun creating a Cobol routine and inserting it
>into an XL and then calling it from C. Yes, I have searched the
>archive, but did not solve my problem with some of the information
>gleaned. Does anybody have a simple example that they wish to share
>with the list.
>
>More precisely, my problems is simply that when I pass the address of an
>integer to the Cobol routine the Cobol routine always receives an
>integer of value 0 and when I modify the integer in Cobol when printed
>in C I get the incorrect value.
>
>Code samples.
>
>C 'client side'
> char request[256];
> char response[4096];
> int integer;
>
> democall(&request, &response, &integer);
>
>
>Cobol 'server side'
>
>
> LINKAGE SECTION.
>
> 01 REQUEST PIC X(256).
> 01 RESPONSE PIC X(4096).
> 01 SIZE-OF-BUFFER PIC S9(4) COMP.
>
> PROCEDURE DIVISION USING REQUEST,
> RESPONSE,
> SIZE-OF-BUFFER.
>
>
>All help greatly appreciated.
>
>
>Regards
>Jens
>
|
|
|