mmap error - only when from cron?!?!?

Hey Guys,

Ive got a script which when run from the command prompt works exactly as planned. However when this script is scheduled to run from the crontab (using the same user ID) it brings up a series of mmap errors...

+ /opt/cobol/bin/rebuild /cybtirl/data/file02 -k:4+32 -e -i -v

Error loading /opt/cobol/cobdir/coblib/libhpcobol.1, errno = 2
/usr/lib/dld.sl: Call to mmap() failed - TEXT /opt/cobol/cobdir/coblib/libhpcobol.1
/usr/lib/dld.sl: Not enough space
Error loading /opt/cobol/cobdir/coblib/libhpcobol.1, errno = 12
/usr/lib/dld.sl: Call to mmap() failed - TEXT /opt/cobol/cobdir/coblib/libhpcobol.1
/usr/lib/dld.sl: Not enough space
Rebuilding index - records processed -
Execution error : file 'rbldsub'
error code: 191, pc=0, call=8, seg=0
191 Terminal type not defined

HP/MF COBOL Version: v4.1.10
HP-UX basil B.10.20 U 9000/898
pid: 20924 gid: 23 uid: 1784
Thu Jul 27 14:39:02 2006
2:39pm up 11:23, 11 users, load average: 0.21, 0.22, 0.25
Thread mode: No Threads
RTS Error: COBOL
Sync Signals: COBOL
ASync Signals: COBOL
cobtidy on exception: False

Ive tried toggling with Paths, permissions, checking swap space but so far i got nothing - can anybody help me out here???

Thanks

The first message is the key:

Error loading /opt/cobol/cobdir/coblib/libhpcobol.1, errno = 2

errno = 2 is an ENOENT (No such file or directory). So, that library is not where it is expected. The second error, errno = 12 is an ENOMEM (Not enough core). It it works from the command line, I would suspect that a value used in the mmap() call is not set correctly, perhaps not being initialized and containing garbage values when the program is run from cron.

It's been a while since I've used COBOL on a UNIX -- MicroFocus/Merrant on AIX and Solaris -- but there are a few environment variables that HAVE to be set like COBLIB and/or RUNLIB. From the command prompt, run env(1). Then run it infront of your crontab entry. Compare the two. I suspect that will lead you to the solution.