IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Help!!!about COBOL CALL C


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 2481
Location: Netherlands, Amstelveen

PostPosted: Fri Apr 23, 2010 11:53 am
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

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Fri Apr 23, 2010 12:57 pm
Reply with quote

did You care to read
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Fri Apr 23, 2010 3:37 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top