I have a C file residing in the USS filesystem. My C file is pretty basic. It contains logic to print "Hello World". I execute: c89 [filename]
I get a return code (rc
) of CCN0634(U)
. The same rc is thrown if I try the cc compiler. I Google the aforementioned rc
. The IBM Knowledge Center tells me the following:
Check that the compiler is installed correctly. Make sure there is enough memory in the region to fetch the module. You may need to specify the runtime option HEAP(,,,FREE,,) to prevent the compiler from running out of memory.
The above explanation didn't make much sense. I Googled for some solutions. All of the search results led to compilation in batch using JCL. It was overwhelming as there were many different flavors.
Q1: What’s the simplest way to compile a C program on the Unix Shell Services?
Q2: How do I check if a compiler is installed? cc --version doesn’t work.
I am running on z/OS 2.4.
One common issue is that the libraries that host the compiler are not accessible. I have this setting in my shell environment:
export STEPLIB="none:CEE.SCEERUN:CBC.SCLBDLL:CBC.ACCNCMP"
The last dataset hosts the module you indicate is not found.
In addition, these here are some additional settings (Note: some of these libraries may be different on your system due to customization but these are the default libraries):
declare -x _C89_CLIB_PREFIX="CBC"
declare -x _C89_INCDIRS="/usr/include /usr/lpp/ioclib/include"
declare -x _C89_LIBDIRS="/lib /usr/lib"
declare -x _C89_PLIB_PREFIX="CEE"
declare -x _C89_SLIB_PREFIX="SYS1"
declare -x _C89_WORK_UNIT="SYSDA"
declare -x _CC_CLIB_PREFIX="CBC"
declare -x _CC_INCDIRS="/usr/include /usr/lpp/ioclib/include"
declare -x _CC_LIBDIRS="/lib /usr/lib"
declare -x _CC_PLIB_PREFIX="CEE"
declare -x _CC_SLIB_PREFIX="SYS1"
declare -x _CC_WORK_UNIT="SYSDA"
declare -x _CEE_RUNOPTS="FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)"
declare -x _CXX_CLIB_PREFIX="CBC"
declare -x _CXX_INCDIRS="/usr/include /usr/lpp/ioclib/include"
declare -x _CXX_LIBDIRS="/lib /usr/lib"
declare -x _CXX_PLIB_PREFIX="CEE"
declare -x _CXX_SLIB_PREFIX="SYS1"
declare -x _CXX_WORK_UNIT="SYSDA"
In answer to Q1 here is the simplest way:
Below is the output from my shell session in USS:
IBMUSER:/u/ibmuser #>cat t.c
#include <stdio.h>
int main(int argc, char **argv) {
printf("hello world\n");
return(0);
}
IBMUSER:/u/ibmuser #>cc t.c
IBMUSER:/u/ibmuser #>./a.out
hello world