As part of a Cobol program I'm modifying, stat function needs to be called to retrieve the details of a file. This is in Linux 7.6. But when I run the program, I get the error
Load error : file 'stat' error code: 173, pc=C6, call=1, seg=0 173 Called program file not found in drive/directory
If I use stat on a file from command line, it works and the details are retrieved. I don't understand why the call to stat fails from cobol.
I checked for stat in .so files in /usr/lib. Could find stat in libc_nonshared.a
Also tried to change the call from stat to stat64 after changing the stat structure. stat64 also throws the same error.
Did anyone else faced this issue. Any pointers to move forward will be of great help.
R0001.
DISPLAY 'Program STARTED'
ACCEPT WS-FILENAME2 FROM COMMAND-LINE
MOVE 00025 TO FCD-NAME-LENGTH
MOVE x'00' TO WS-FILENAME2(FCD-NAME-LENGTH:1)
DISPLAY 'FILENAME : ' WS-FILENAME2
CALL 'stat' USING WS-FILENAME2
ST-BUF
RETURNING WS-RETURN-CODE.
DISPLAY 'STAT CALL COMPLETE'
DISPLAY 'RETURN CODE: ' WS-RETURN-CODE
IF WS-RETURN-CODE NOT = ZERO
SET GNIO-RC-ERR-DATEXT TO TRUE
GO TO R0099
END-IF.
DISPLAY 'DEVICE VALUE : ' ST-DEV-LINUX
DISPLAY 'INODE VALUE : ' ST-INO64-LINUX
DISPLAY 'ATIME : ' ST-ATIME-LINUX
DISPLAY 'CTIME : ' ST-CTIME-LINUX
DISPLAY 'MTIME : ' ST-MTIME-LINUX
DISPLAY 'SIZE64 : ' ST-SIZE64-LINUX
DISPLAY 'BLOCKS64 : ' ST-BLOCKS64-LINUX.
R0099.
EXIT.
STOP RUN.
Load error : file 'stat' error code: 173, pc=C6, call=1, seg=0 173 Called program file not found in drive/directory