Page 1 of 1

C calling a cobol using xctl.

PostPosted: Fri Feb 17, 2012 8:53 pm
by deen67
Hi there, not so sure where to post this topic.
My problem is the length of dfhcommarea become 0 before xctl from Y to Z. Although the length of dfhcommarea from A to Y is ok.

let say A-is main prog(C language), Y & Z are cobol.
A - c program
void main()
{
EXEC CICS ADDRESS EIB(dfheiptr) COMMAREA(pCom_Ptr);
EXEC CICS HANDLE ABEND PROGRAM("JQABCVEH");
memcpy(&stReply.pMain,&pCom_Ptr->pMain,MYS_HEADER_LEN);
iLen = sizeof(pCom_Ptr->message_data);
memcpy(stCom,pCom_Ptr->message_data,iLen);

EXEC CICS XCTL PROGRAM("Y")
COMMAREA(stcom)
LENGTH(stcom) <---- managed to get length correctly
RESP(resp)
RESP2(resp2);

Y - Cobol
Linkage Section
DFHCOMMAREA
copy message-data

do some sql works to prepare data to insert in message-data.

EXEC CICS XCTL PROGRAM("Z")
COMMAREA(DFHCOMMAREA)
LENGTH(length of(DFHCOMMAREA) <---- length become 0

already surf the net but can't found any solution similar with my problem. already try to trace in cics managed to see the message-data. can anyone give me some helps/ideas. 1 more things do i need to use this command in cobol EXEC CICS ADDRESS EIB(dfheiptr) COMMAREA(DFHCOMMAREA) after procedure divison to get the length or address or the data.


Thanking you in advanced for any helps

Re: C calling a cobol using xctl.

PostPosted: Sun Mar 04, 2012 11:15 am
by deen67
problem solved. change declaration from comp to comp5 for my length of dfcommarea. my commarea is 10204,when i use comp always get 204(0204) truncate. my silly mistake. :)

Re: C calling a cobol using xctl.

PostPosted: Wed Mar 07, 2012 8:02 am
by dick scherrer
Good to hear it is working - thank you for letting us know :)

d