C calling a cobol using xctl.



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

C calling a cobol using xctl.

Postby deen67 » Fri Feb 17, 2012 8:53 pm

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
deen67
 
Posts: 10
Joined: Mon Jul 11, 2011 2:47 pm
Has thanked: 0 time
Been thanked: 0 time

Re: C calling a cobol using xctl.

Postby deen67 » Sun Mar 04, 2012 11:15 am

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. :)
deen67
 
Posts: 10
Joined: Mon Jul 11, 2011 2:47 pm
Has thanked: 0 time
Been thanked: 0 time

Re: C calling a cobol using xctl.

Postby dick scherrer » Wed Mar 07, 2012 8:02 am

Good to hear it is working - thank you for letting us know :)

d
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post