T.R | Title | User | Personal Name | Date | Lines |
---|
3235.1 | Use CALL or EXTERNAL | PACKED::BRAFFITT | | Thu Apr 24 1997 07:14 | 13 |
| One alternative is to pass the variable from COBOL to C via CALL. The
default (CALL USING BY REFERENCE) will allow you to modify the variable
in the C routine and see the results back in the COBOL module after the
C routine returns. You can also call from C passing the variable to
COBOL.
Another alternative is EXTERNAL. For example:
01 AEXT PIC 9(5) COMP EXTERNAL.
Then the C program can reference the variable AEXT. Make sure the
COBOL program and C program declare AEXT with the same name case if you
are NOT using OpenVMS.
|
3235.2 | Already tried EXTERNAL but doesn't work. | HGRD01::HOMANSANG | Keith Ho, ISE HK @HGO | Thu Apr 24 1997 23:23 | 13 |
| re: .1 Thanks.
I want to use global variable instead of passing parameter.
I already tried EXTERNAL before but I couldn't get what I wanted.
I used globalref in C and it will result in underfined symbol during
link time. Please note that I want the variable defined in COBOL and
referenced by other non-COBOL module and so I used globalref instead of
globaldef.
Any more ideas?
-- Keith.
|
3235.3 | Use the common reference model rather than globalref | PACKED::BRAFFITT | | Fri Apr 25 1997 10:44 | 40 |
| Wendy Blatt and Craig Neth both suggested that you need to use the
common reference model rather than the globalref reference model.
***C3235A***
par1: 3
par2: 4
ext1: 5
***END***
COB$USER2:[BRAFFITT.WORK]C3235A.COB;1
identification division.
program-id. c3235a.
environment division.
data division.
working-storage section.
01 par1 pic s9(5) comp.
01 par2 pic s9(5) comp.
01 ext1 pic s9(5) comp external.
procedure division.
p0. display "***C3235A***".
move 1 to par1.
move 2 to par2.
move 3 to ext1.
call "c3235b" using par1 par2.
display "par1: " par1 with conversion.
display "par2: " par2 with conversion.
display "ext1: " ext1 with conversion.
display "***END***".
stop run.
COB$USER2:[BRAFFITT.WORK]C3235B.C;1
int ext1;
c3235b(int *par1, int *par2)
{
*par1 = ext1;
*par2 = 4;
ext1 = 5;
}
|
3235.4 | HELP CC/EXTERN | WIBBIN::NOYCE | Pulling weeds, pickin' stones | Fri Apr 25 1997 15:29 | 5 |
| For DEC C, compile with
CC/EXTERN=COMMON C3235B
|
3235.5 | How about VAXC and BASIC? | HANDVC::HOMANSANG | Keith Ho, ISE HK @HGO | Mon Apr 28 1997 03:35 | 11 |
| re: .3, .4
Thanks very much.
How about VAXC and BASIC? Does anyone know how to do that as there is
no such /EXTERN (or similar) qualifier?
(I tried EXTERNAL in BASIC data declaration but it doesn't work.)
-- Keith.
|
3235.6 | .3 works fine for VAX COBOL with VAX C | PACKED::BRAFFITT | | Mon Apr 28 1997 07:59 | 5 |
| > How about VAXC and BASIC? Does anyone know how to do that as there is
> no such /EXTERN (or similar) qualifier?
.3 worked fine for me with VAX COBOL and VAX C, but I don't know what
syntax you need in VAX BASIC to work with the common reference model.
|