On 3/19/2011 1:52 PM, Phil Smith wrote:
Le party continu...my colleague suggests this question:
In a C program there is a main entry point. This can
be MAIN or it can be a function defined as ENTRY.
I see references in the Binder documentation about
Alternate Entry Points. Can you define multiple Alternate
Entry Points in a C Load Module?"
From our course "Cross Program Communication in z/OS":
C doesn't have an ENTRY statement equivalent, but you
can define multiple functions in a single source module
* And these functions can share internal functions
* And the linkages work as with entry statements
Example
#include<stdio.h>
extern void XYZOOGA()
{
printf("In XYZOOGA\n");
}
extern void XYZJANET()
{
printf("In XYZJANET\n");
}
int main(int args, char **argv)
{
printf("in main?\n");
}
I would like to dynamically call XYZJANET
and XYZOOGA from a Cobol program. While both symbols
appear in the link map I have not found the combination
to get them both to appear in the 'Entry Point and Alias
Summary' after a link. It's important to assume that the
symbols might be long and mixed-case as well.
ENTRY POINT AND ALIAS SUMMARY:
NAME: ENTRY TYPE AMODE C_OFFSET CLASS NAME STATUS
XYZJANET MAIN_EP 31 00000098 C_CODE
or
ENTRY POINT AND ALIAS SUMMARY:
NAME: ENTRY TYPE AMODE C_OFFSET CLASS NAME STATUS
XYZOOGA MAIN_EP 31 00000110 C_CODE
But not
ENTRY POINT AND ALIAS SUMMARY:
NAME: ENTRY TYPE AMODE C_OFFSET CLASS NAME STATUS
XYZJANET MAIN_EP 31 00000098 C_CODE
XYZOOGA ADDED 31 00000110 C_CODE
Ideas? Steve (Comstock), I'm not ignoring you - I suspect
you're right, but want to see this through to the bitter
end before giving up!
--
...phsiii
OK. For standard names (upper case, max 8 characters),
you're OK.
Mainline:
process dynam
identification division.
program-id. 'COBOLCL2'.
environment division.
data division.
working-storage section.
01 ws-first1 pic s9(9) usage is binary value 3.
procedure division.
display 'In COBOLCL2'
call 'XYZJANET'
call 'XYZOOGA'
display 'Exit COBOLCL2'
goback.
Subroutine (source name: CGIRLS):
#include <stdio.h>
void XYZJANET()
{
printf("In XYZJANET\n");
}
void XYZOOGA()
{
printf("In XYZOOGA\n");
}
You can define multiple entry points using ALIAS binder
commands, so when you bind your C program:
//LKED.SYSLMOD DD DSN=&HL..TR.PDSE(&O),DISP=SHR
//LKED.SYSIN DD *
ALIAS XYZJANET
ALIAS XYZOOGA
NAME CGIRLS(R)
...
gives:
ENTRY POINT AND ALIAS SUMMARY:
NAME: ENTRY TYPE AMODE C_OFFSET CLASS
$PRIVATE MAIN_EP 31 00000000 B_TEXT
XYZJANET ALTERNATE 31 00000100 B_TEXT
XYZOOGA ALTERNATE 31 00000088 B_TEXT
When you execute COBOLCL2 you get:
SYSOUT:
In COBOLCL2
Exit COBOLCL2
SYS0001:
In XYZJANET
In XYZOOGA
But now think about your deeper issue: long names
and case sensitive names. I think you're out of
luck.
Think DLLs.
Think training classes. :-)
--
Kind regards,
-Steve Comstock
The Trainer's Friend, Inc.
303-393-8716
http://www.trainersfriend.com
* To get a good Return on your Investment, first make an investment!
+ Training your people is an excellent investment
* Try our new tool for calculating your Return On Investment
for training dollars at
http://www.trainersfriend.com/ROI/roi.html
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html