Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Help!!!about COBOL CALL C

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
kokwind

New User


Joined: 22 May 2008
Posts: 15
Location: Singapore

PostPosted: Fri Apr 23, 2010 11:23 am    Post subject: Help!!!about COBOL CALL C
Reply with quote

How can I pass the parm. <aa> into C .


-----------------------------------Code Area---------------------------
Main PGM
Code:

000100  IDENTIFICATION DIVISION.             
000200  PROGRAM-ID. TESTM.                   
000300  DATA DIVISION.                       
000400  WORKING-STORAGE SECTION.             
000410  01  CC.                             
000420    03  AA    PIC X(02)  VALUE 'AA'.   
000500  PROCEDURE DIVISION.                 
000600      DISPLAY 'START OF HELLO'.       
000610      DISPLAY AA.                     
000700      CALL 'TESTIN' USING AA.         
000800      STOP RUN.     



Sub PGM
Code:

#include <stdio.h>             
extern int TESTIN(char argc)   
{                               
printf("%s\n",argc);         <<<--------Here,it can't display anything!!!  :(
return 0;                       
}           


COMP&RUN JCL
Code:

//COMPCCC  JOB CLASS=A,MSGCLASS=H,MSGLEVEL=(1,1),             
//          NOTIFY=&SYSUID,REGION=0M                         
//JCLLIB JCLLIB ORDER=C212.TEST.PROCLIB                   
//TESTIN EXEC EDCCL,                                         
//       INFILE='C212.TEST.SRC.C(TESTIN)',                 
//       OUTFILE='C212.TEST.LOADLIB(TESTIN),DISP=SHR'     
//STEP1 EXEC PROC=IGYWCL                                     
//COBOL.SYSIN  DD DISP=SHR,DSN=C212.TEST.SRC.COBOL(TESTM) 
//LKED.SYSLMOD DD DISP=SHR,DSN=C212.TEST.LOADLIB(TESTM)   
//LKED.SYSIN   DD DISP=SHR,DSN=C212.TEST.LOADLIB(TESTIN)   
//STEP2   EXEC PGM=TESTM                                     
//STEPLIB  DD  DSN=C212.TEST.LOADLIB,DISP=SHR             
Back to top
View user's profile Send private message

PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2429
Location: Netherlands, Amstelveen

PostPosted: Fri Apr 23, 2010 11:53 am    Post subject:
Reply with quote

argc is the count of arguments as far as i remember,
argv point to the arguments.

main(argc, argv)
int argc; char *argv[];

for (i = 1; i < argc; ) {
printf("%s", argv[i]);
if (++i < argc)
putchar(' ');
}
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10232
Location: italy

PostPosted: Fri Apr 23, 2010 12:57 pm    Post subject: Reply to: Help!!!about COBOL CALL C
Reply with quote

did You care to read
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/CEEA4150/CCONTENTS?SHELF=CEE2BK80&DN=SA22-7563-05&DT=20060630142845

chapter 4 ??

looks like not
remember also that in c strings are handled thru pointers
Back to top
View user's profile Send private message
kokwind

New User


Joined: 22 May 2008
Posts: 15
Location: Singapore

PostPosted: Fri Apr 23, 2010 3:36 pm    Post subject:
Reply with quote

I have added the following code

Code:

COBOL Program
01 P1 PIC S9(9) USAGE IS BINARY
CALL ’CFUNC’ USING BY CONTENT P1.
C Function

#pragma linkage(CFUNC,COBOL)
void TESTIN(int p1) {
printf(p1); 
}

but it still display space.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10232
Location: italy

PostPosted: Fri Apr 23, 2010 3:37 pm    Post subject: Reply to: Help!!!about COBOL CALL C
Reply with quote

review Your C coding skills
to print an integer You will need a format specification
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Execute TSO ACF commands from COBOL-I... supreethi.srid TSO/ISPF 0 Tue Feb 21, 2017 5:19 pm
No new posts Mainframe Interview Questions CICS,CO... akshathan Mainframe Interview Questions 6 Thu Feb 09, 2017 6:38 pm
No new posts Submit job from Cobol with input data abdulrafi COBOL Programming 4 Wed Feb 01, 2017 12:41 pm
This topic is locked: you cannot edit posts or make replies. COBOL Software Development Lead at Fi... shally Mainframe Jobs 0 Fri Jan 20, 2017 5:21 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us