UNIX commad in COBOL

Hi guys,

i used the call "sytem" using ... in a cobol program.

At the moment i stoped at an empasse, how cam I retrive the execution's result of unix command?

Explenation, I made an 'pwd' command, and I must to have the directory inside the program.

How can have this result?

Redirect the output of the command to some file and then read the file:

01 WA-COMMAND PIC X(100)
     VALUE "command > /path/to/some_file 2>&1".
....
....
CALL "SYSTEM" USING WA-COMMAND.
....
....
<CODE TO READ THE FILE>
....
....

I just used this method.

My problem now is to have the result of the pwd command (directory name) in the program, because I have to use this value in the program for make other consideratione.