I can only speak for C, we don't have C++ at our site.

So I would ask you to try the #include <stdio.h> first and leave out
the #include <iostream> for the beginning, because that is a C++ header
which you will not be able to use in a C program.

We allocate for USERLIB exactly the same DD chain as for SYSLIB.

The difference is

user includes, that is

#include "userinc.h"

goes to USERLIB

and system includes

#include <stdio.h>

goes to SYSLIB

Because the application people at our site constantly mix things up
and use #include <xxx> for user includes (for example), we decided to
do it this way. The normal way is to include the system directories in
the user path, too (for windows and Unix: if you write #include "xxx",
the first look goes to the active directory).

I don't know if the parms LSEARCH and SEARCH are really needed;
I think that they are meant to override the DDnames for the library search,
and if you omit them, the DDnames should default to USERLIB and SYSLIB.

My experience. the C compiler on z/OS batch works much like the other
compilers for COBOL and PL/1, too. For people having experience with
the other language processors, simply no problem with those compilers
and their usage with batch JCL.

If you want, we can examine things further offline next week, when I have
access to my customers mainframe.

Kind regards

Bernd



Am 28.03.2014 18:19, schrieb Chuck Arney:
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