Chuck,

Best to leave SEARCH alone unless you've customized the installation. It will default to SEARCH(//'CEE.SCEEH.+') which will pick up all the header file data sets.

I see that you are trying to include C++ iostream headers. If you want to compile C++ then you should take a look at the JCL in the CBCCB proc.

IMO, it's much easier to build C/C++ programs in the z/OS UNIX shell. You can then take advantage of other tools like makefiles. It's possible to build programs that reside
in PDS(E) libraries from z/OS UNIX.



On 29/03/2014 1:19 AM, Chuck Arney 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

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to