Created On:  04 March 2011

Problem:

A client added a compiler directive (in this instance SPZERO) in their COBOL Environmental Variable file "CompileCob64.sh" on Server Express. But, when we tried to compile any program it returned the error - " Cobol Compiler Argument exceed 128 bytes limit".  UNIX systems can restrict the maximum length of the operating system's command line, which can be as low as 128 bytes.

Resolution:

One way round this is to place system-wide cob parameters in a text file  $COBDIR/etc/cobopt. If you do it this way it means all compiles will pick up that directive (plus any others set in $COBDIR/etc/cobopt). Setting it here means this is a global directive, therefore if some parts of the application must be compiled without this directive you would not put it here.

The file $COBDIR/etc/cobopt should already exist and is just a text file. You’ll see that each directive is set on a separate line and so all you’d do is add a line

-C SPZEREO

Alternatively, you can place them in a text file and location of your choice and set $COBOPT to point to that file. This way the 'cob' command will look at this file (it also looks in $COBDIR/etc/cobopt). You’d put all the directives currently on the command line into that file and change the $COBOPT directive to point to that file.

Eg: export COBOPT=/home/mycobopt

And in mycobopt

-C notrunc

-C all other directives etc....1 per line

-C spzero

The cob command will then pick this up via $COBOPT.

$COBOPT can either contain individual directives or it can contain the location of a file containing directives.

This issue was not with the SPZERO directive itself, but with the fact that the command line was being truncated.