Chuck:
Heres how I do it:
//ADCDMETA JOB SYSTEMS,MSGLEVEL=(1,1),MSGCLASS=X,CLASS=A,PRTY=8,
// NOTIFY=&SYSUID,REGION=0M
// EXEC EDCCL,
// INFILE='SFORD.C.SOURCE(SUBPCHK)',
// OUTFILE='SFORD.TEST.LINKLIB(SUBPCHK),DISP=SHR',
// CPARM='LIS,SO,EXP,DEF(MVS)',
// CPARM2='NOMARGINS,LOCALE(EN_US.IBM-1140)',
// LPARM='AMODE(31),AC(1),MAP'
//LKED.SYSLIB DD
// DD DISP=SHR,DSN=SFORD.TEST.LINKLIB
//LKED.SYSIN DD *
NAME SUBPCHK(R)
/*
/*--------------------------------*/
#include <stdio.h>
#include <string.h>
#pragma linkage(SUBPWRAP,OS)
int rc;
main()
{
for(;;)
{
rc = SUBPWRAP();
}
}
//********************************************************************
//*
//EDCCL PROC INFILE=, < INPUT ... REQUIRED
// CREGSIZ='144M', < COMPILER REGION SIZE
// CRUN=, < COMPILER RUNTIME OPTIONS
// CPARM=, < COMPILER OPTIONS
// CPARM2=, < COMPILER OPTIONS
// CPARM3=, < COMPILER OPTIONS
// SYSLBLK='3200', < BLOCKSIZE FOR &&LOADSET
// LIBPRFX='CEE', < PREFIX FOR LIBRARY DSN
// LNGPRFX='CBC', < PREFIX FOR LANGUAGE DSN
// TCPPRFX='TCPIP', < PREFIX FOR LANGUAGE DSN
// CLANG='EDCMSGE', < NOT USED IN THIS RELEASE. KEPT FOR COMPATIBILITY
// LREGSIZ='1024K', < LINK EDIT REGION SIZE
// LPARM='AMODE=31,MAP', < LINK EDIT OPTIONS
// DCB80='(RECFM=FB,LRECL=80,BLKSIZE=3200)', <DCB FOR LRECL 80
// DCB3200='(RECFM=FB,LRECL=3200,BLKSIZE=12800)', <DCB FOR LRECL 3200
// OUTFILE='&&GSET(GO),DISP=(MOD,PASS),SPACE=(TRK,(7,7,1)),UNIT=SYSDA',
// TUNIT='SYSALLDA', < UNIT FOR TEMPORARY FILES
// TSPACE='(32000,(30,30))' < SIZE FOR TEMPORARY FILES
//*
//*-------------------------------------------------------------------
//* COMPILE STEP:
//*-------------------------------------------------------------------
//COMPILE EXEC PGM=CCNDRVR,REGION=&CREGSIZ,
// PARM=('&CRUN/&CPARM &CPARM2 &CPARM3')
//STEPLIB DD DSNAME=&LIBPRFX..SCEERUN2,DISP=SHR
// DD DSNAME=&LNGPRFX..SCCNCMP,DISP=SHR
// DD DSNAME=&LIBPRFX..SCEERUN,DISP=SHR
//SYSMSGS DD DUMMY,DSN=&LNGPRFX..SCBC3MSG(&CLANG),DISP=SHR
//SYSIN DD DSNAME=&INFILE,DISP=SHR
//* DD DSNAME=TCPIP.SEZACMAC,DISP=SHR
//SYSLIB DD DSNAME=&LIBPRFX..SCEEH.H,DISP=SHR
// DD DSNAME=&LIBPRFX..SCEEH.SYS.H,DISP=SHR
// DD DSNAME=&LIBPRFX..SCEEH.NET.H,DISP=SHR
// DD DSNAME=&LIBPRFX..SCEEH.NETINET.H,DISP=SHR
Regards,
Scott
www.identityforge.com
From: Mike Schwab
Sent: Friday, March 28, 2014 7:09 PM
To: IBM Mainframe Discussion List
http://pic.dhe.ibm.com/infocenter/zos/v1r12/index.jsp?topic=%2Fcom.ibm.zos.r12.cbcux01%2Fcbcug19023.htm
On Fri, Mar 28, 2014 at 12:19 PM, Chuck Arney <[email protected]> wrote:
> I'm making a first attempt at C code on z/OS and I'm having trouble making
> the compiler work the way I understand it should from the manual. This is
> such a basic function and it fails so miserably I'm sure this is some sort
> of setup misunderstanding.
>
> The problem is that the compiler is not locating the header files that are
> included in the source program. My understanding from the manual is that
> the compiler PARM SEARCH controls the library search sequence used for
> system headers and the PARM LSEARCH controls the search for user headers. I
> have tried every combination of coding absolute paths, DDnames and PARMS
> that I can come up with and the thing just refuses to work. The most simple
> case I can see is to specify the compiler PARMS NOSEARCH,NOLSEARCH.
> According to the manual with these parms, the compiler should search the
> libraries/directories defined in the SYSLIB DD concatenation for system
> headers and search the libraries/directories defined in USERLIB DD for user
> headers. Using those parms with the SYSLIB and USERLIB DDs the compiler
> does not find the #include header files which are certainly contained in the
> libraries pointed to by the two DDs. I have tried much more complex options
> using both PDS libraries and ZFS directories with no success.
>
> I have tried using several different levels of z/OS and they all fail in the
> same way. The most recent system is 5650ZOS V2.1 z/OS XL C. This is using
> the Batch compiler. Here is the simplest example:
>
> Code snippet:
>
> #include <stdio.h>
> #include <iostream>
> #define NUM_CHARS 36
>
> JCL snippet:
>
> // SET #CPP=CBC
> // SET #LE=CEE
> //PROC JCLLIB ORDER=(&#CPP..SCCNPRC,
> // &#LE..SCEEPROC)
> //TEST1L EXEC EDCCB,
> // CPARM='RENT,SOURCE,LIST,NOLSEARCH,NOSEARCH',
> // TUNIT='VIO',
> // LIBPRFX=&#LE.,
> // LNGPRFX=&#CPP.,
> //* INFILE=&#CPP..SCCNSAM(CCNYIV1),
> // INFILE=TSTCASES.ASM(CTEST1),
> // OUTFILE='TSTCASES.LOADLIB.PDSE(CTEST1),DISP=SHR'
> //COMPILE.SYSLIB DD DSNAME=&#LE..SCEEH.H,DISP=SHR
> // DD DSNAME=&#LE..SCEEH.SYS.H,DISP=SHR
> // DD DSNAME=&#LE..SCEEH,DISP=SHR
> //COMPILE.USERLIB DD PATH='/usr/include',
> // PATHDISP=(KEEP,KEEP),PATHOPTS=ORDONLY,FILEDATA=TEXT
>
> And the result:
>
> Compiler options. . . . . . . : *GONUMBER *NOALIAS *RENT *TERMINA
> : *NOSEARCH
> : *NOLSEARCH
> : *NOLOCALE *HALT(16) *PLIST(HOST)
> : *NOCONVLIT
>
> LINE STMT
>
>
> *...+....1....+....2....+....3....+....4....+....5....+....6....+
> 3 |#include <stdio.h>
>
> ===========>
> .........a.......................................................
> *=WARNING=========> a - CCN3296 #include file <stdio.h> not found.
>
> 6 |#include <iostream>
>
> ===========>
> .........a.......................................................
> *=WARNING=========> a - CCN3296 #include file <iostream> not found.
>
> 7 |#define NUM_CHARS 36
>
>
> What am I missing?
>
> Chuck Arney
> Arney Computer Systems
> Web: http://zosdebug.com
> Facebook: http://www.facebook.com/arneycomputer
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to [email protected] with the message: INFO IBM-MAIN
--
Mike A Schwab, Springfield IL USA
Where do Forest Rangers go to get away from it all?
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN