View previous topic :: View next topic
|
Author |
Message |
kokwind
New User
Joined: 22 May 2008 Posts: 15 Location: Singapore
|
|
|
|
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 |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
Back to top |
|
|
kokwind
New User
Joined: 22 May 2008 Posts: 15 Location: Singapore
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
review Your C coding skills
to print an integer You will need a format specification |
|
Back to top |
|
|
|