/docker-jcc

Docker container for jcc

Primary LanguageDockerfile

JCC Docker Container

This container is based on debian buster (10). It uses Jason Paul Winters jcc which can be used to compile C programs for use on IBM mainframes.

The compiler is available here: https://github.com/mvslovers/jcc

Building

run docker build -t jcc .

Usage

The docker container has a volume setup at /project. To compile your C code located in project/test.c run

docker run -it -v $(pwd)/project:/project jcc jccc -I/jcc/include -o test.c

Note: This uses the bash script jccc since jcc does not allow you to control the object output folder.

Here's another example:

mkdir -p project

cat <<EOF >project/main.c
#include <stdio.h>
int main(int argv, char ** argc) {
    printf("Hello Docker from jcc!\n");
}
EOF

docker run -it -v $(pwd)/project:/project jcc jccc -I/jcc/include -o test.c

rdrprep

This containter also comes with rdrprep available here: https://github.com/mainframed/rdrprep. You can use rdrprep to insert the jcc compiled object in to any ascii file. Below is an example usage:

cat << 'EOF' > project/rdrprep_template.jcl
//LINKCPRJ JOB (CPROJ),
//            'Link C program',
//            CLASS=A,
//            MSGCLASS=A,
//            REGION=8M,
//            MSGLEVEL=(1,1),
//            USER=IBMUSER,PASSWORD=SYS1
//LKED     EXEC PGM=IEWL,PARM='NCAL,MAP,LIST,XREF,NORENT'
//SYSUT1   DD UNIT=SYSDA,SPACE=(CYL,(5,2))
//SYSPRINT DD SYSOUT=*
//SYSLMOD  DD DSN=SYS2.LINKLIB(FTPD),DISP=SHR
//SYSLIN   DD DATA,DLM=$$
::E test.obj
$$
EOF
docker run -it -v $(pwd)/project:/project jcc rdrprep /project/rdrprep_template.jcl /project/outputjcl.ebcdic.jcl

Offset error in internal assembler

If you get an error message like

/project/hello.c:11: Offset error in internal assembler
JCC-RC:1, Total Time:1ms

You'll need to run jcc.exe with WINE due to a bug in jcc.

Edit the Dockerfile and add the following in deploy section:

RUN dpkg --add-architecture i386 && apt-get update && apt-get install --no-install-recommends --assume-yes wine win32

Then to compile your code use wine /jcc/jcc.exe -I/jcc/include -o test.c