Unable to compile C program called from Mainframes

Ask questions about any other mainframe topics which are not covered above

Moderator: Moderator Group

Post Reply
agraws4
Member
Posts: 4
Joined: Tue Jun 24, 2014 3:10 am
Location: York

Unable to compile C program called from Mainframes

Post by agraws4 » Wed Sep 10, 2014 1:49 pm

I am trying to compile and execute a C program which can be called from COBOL program. Currently we have some C programs in the system which is called from COBOL.

COBOL:
======
IDENTIFICATION DIVISION.
PROGRAM-ID. REVWBP9H.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 PROGRAM1 PIC X(8) VALUE 'CTHRUCOB'.
01 TESTPRRR PIC X(4) VALUE 'ABCD'.


PROCEDURE DIVISION.
REVWBP9G-CONTROL SECTION.
INITIALIZE ULEMEP31-PARAMS
DISPLAY 'BEFORE CALL'
CALL PROGRAM1 USING BY REFERENCE TESTPRRR.
DISPLAY 'AFTER CALL'
GOBACK.
REVWBP9G-EXIT.



C program:
==========
#include <stdio.h>
#pragma linkage(CTHRUCOB,COBOL)
char x[4];
void CTHRUCOB(char *p)
{
printf("\n This is a C program called from COBOL");
}


Compile JCL:

//USERCOMP JOB USER,'C COMPILE',CLASS=S,MSGCLASS=A,
// NOTIFY=&SYSUID
//JOBLIB DD DSN=SYS1.SCEEH.ARPA.H,DISP=SHR
// DD DSN=SYS1.SCEEH.H,DISP=SHR
// DD DSN=SYS1.SCEEH.NET.H,DISP=SHR
// DD DSN=SYS1.SCEEH.NETINET.H,DISP=SHR
// DD DSN=SYS1.SCEEH.SYS.H,DISP=SHR
// DD DSN=SYS1.SCLBH.H,DISP=SHR
// DD DSN=SYS1.SCEERUN,DISP=SHR
// DD DSN=SYS1.SCEERUN2,DISP=SHR
// DD DSN=SYS1.SCLBDLL,DISP=SHR
// DD DSN=SYS1.SCLBDLL2,DISP=SHR
// JCLLIB ORDER=DSH.DPSS.UU.PROCLIB
//COMPILE2 EXEC PROC=EDCC,
// INFILE='USER.SUMIT.CPROG(CTHRUCOB)',
// OUTFILE='USER.DPSS.LOWB.CPROG.OBJECT(CTHRUCOB),DISP=SHR',
// CPARM='RENT,NOSEQ,NOMAR,XR,NOSHOW,LO,AGG,FLAG(W),SHOWINC',
// CPARM2='CHE,EXP,TARG(COMPAT),LIST,SO,OF'
//USERLIB DD DSN=USER.DPSS.PROJECT.LTFX.INCLUDE,DISP=SHR
//USERLIB DD DSN=USER.DPSS.PROJECT.LTFX.INCLUDE,DISP=SHR
//PLKED EXEC PGM=EDCPRLK,PARM='MAP,NCAL'
//STEPLIB DD DSNAME=SYS1.EDC.SEDCLINK,DISP=SHR
// DD DSNAME=SYS1.PLI.SIBMLINK,DISP=SHR
// DD DSN=SYS1.SCEERUN2,DISP=SHR
// DD DSN=SYS1.SCCNCMP,DISP=SHR
// DD DSN=SYS1.SCEERUN,DISP=SHR
// DD DSN=SYS1.PLI.SIBMLINK,DISP=SHR
//SYSMSGS DD DSN=SYS1.EDC.SEDCMSGP(EDCPMSGE),DISP=SHR
//SYSLIB DD DUMMY
//SYSDIN DD DSN=USER.DPSS.LOWB.CPROG.OBJECT,DISP=SHR
//SYSMOD DD DSN=USER.DPSS.LOWB.CPROG.OBJECT(PRELINK),DISP=SHR
//SYSIN DD *
INCLUDE SYSDIN(CTHRUCOB)
/*
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//LKED EXEC PGM=HEWL,REGION=1024K,PARM='AMODE(31),RMODE(ANY),MAP'
//SYSLIB DD DSN=PSH.D.UU.LOAD,DISP=SHR
// DD DSN=SYS3.D.UU.SDSNLOAD,DISP=SHR
// DD DSN=SYS1.EDC.SEDCBASE,DISP=SHR
// DD DSN=SYS1.PLI.SIBMBASE,DISP=SHR
//* DD DSN=USER.DPSS.UU.CCALC.INCLUDE,DISP=SHR
// DD DSN=T4.DPSS.UU.CCALC.INCLUDE.MASTER,DISP=SHR
//SYSLMOD DD DSN=USER.DPSS.LOWB.CPROG.LOAD,DISP=SHR
//OBJLIB DD DSN=USER.DPSS.LOWB.CPROG.OBJECT,DISP=SHR
//SYSUT1 DD UNIT=VIO,SPACE=(TRK,(10,10))
//SYSPRINT DD SYSOUT=*
//SYSLIN DD *
INCLUDE OBJLIB(PRELINK)
NAME CTHRUCOB(R)
/*


When it is compiled the LKED step is failing with error message 12 saying

IEW2456E 9207 SYMBOL @@XINIT@ UNRESOLVED. MEMBER COULD NOT BE INCLUDED FROM THE DESIGNATED CALL LIBRARY.
IEW2650I 5102 MODULE ENTRY NOT PROVIDED. ENTRY DEFAULTS TO SECTION @ST00001.
Sumit

NicC
Active Member
Posts: 650
Joined: Sun Jul 24, 2011 5:27 pm
Location: Down on the pig farm

Post by NicC » Thu Sep 11, 2014 9:02 pm

So check that you are using the correct JCL and control cards for compiling/linking a C program in your shop. Refer to the JCL used for those other C programs that you mentioned, the people that did them or your sysprogs.
Regards
Nic

agraws4
Member
Posts: 4
Joined: Tue Jun 24, 2014 3:10 am
Location: York

Post by agraws4 » Tue Sep 23, 2014 7:22 pm

The JCLs looks correct to me. It is giving S0C4. Could any one please help me with respect to this issue?

If you need any additional details then please do let me know.
Sumit

agraws4
Member
Posts: 4
Joined: Tue Jun 24, 2014 3:10 am
Location: York

Post by agraws4 » Tue Sep 23, 2014 7:24 pm

I managed to get the COBOL and C program compiled, However while calling the abend now is S0C4

SYSTEM COMPLETION CODE=0C4 REASON CODE=00000004
TIME=13.17.34 SEQ=12175 CPU=0000 ASID=01D6
PSW AT TIME OF ERROR 078D3000 AA800180 ILC 6 INTC 04
ACTIVE LOAD MODULE ADDRESS=2A800168 OFFSET=00000018
NAME=CTHRUCOB
DATA AT PSW 2A80017A - F0F00070 08030505 00080000
GR 0: 00000008 1: 00047FC8
2: 00006219 3: 2A800808
4: 2A8008DE 5: 000482E0
6: 000482E0 7: AA800168
8: 8001A198 9: 00047E80
A: 00047CC0 B: AA800168
C: 80019C1A D: 00048128
E: 8001A196 F: AA800168
END OF SYMPTOM DUMP



Link list SYSTEM COMPLETION CODE=0C4 REASON CODE=00000004
TIME=13.17.34 SEQ=12175 CPU=0000 ASID=01D6
PSW AT TIME OF ERROR 078D3000 AA800180 ILC 6 INTC 04
ACTIVE LOAD MODULE ADDRESS=2A800168 OFFSET=00000018
NAME=CTHRUCOB
DATA AT PSW 2A80017A - F0F00070 08030505 00080000
GR 0: 00000008 1: 00047FC8
2: 00006219 3: 2A800808
4: 2A8008DE 5: 000482E0
6: 000482E0 7: AA800168
8: 8001A198 9: 00047E80
A: 00047CC0 B: AA800168
C: 80019C1A D: 00048128
E: 8001A196 F: AA800168
END OF SYMPTOM DUMP
Sumit

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others