how to call to unix through cobol

hi everyone
i want to run a script in unix through cobol program
does anyone know how shell i do this ?
please please help me here
thanks

This is how I have done it in Micro Focus Cobol:
In working storage:

01 WS-RETURN-SYS-CODE PIC 9(8) COMP VALUE ZEROES.
01 WS-COMMAND.
03 FILLER PIC X(27) VALUE
"/directory/where/script/resides/script_name".
In the procedure division:
CALL "system" USING WS-COMMAND
GIVING WS-RETURN-SYS-CODE.

If your script returns a "return code" then you can check it to see if the script was successful or not.

hi jyoung
thanks for quick response
according to your example i have a directory
/home/shl
in that directory i have script cs-tr-700 run in c-shell
my cobol program does not exist in this directory . (i understand that it does not has to be in the same directory) anyway i wrote like this
01 WS-RETURN-SYS-CODE PIC 9(8) COMP VALUE ZEROES.
01 WS-COMMAND.
03 FILLER PIC X(40) VALUE
"/home/shl/where/script/resides/cs-tr-700".
in the working-storage
call "system" USING WS-COMMAND giving WS-RETURN-SYS-CODE.
when i'm running the program it write
UX:sh (sh): ERROR: /home/shl/where/script/resides/cs-tr-700 not found
UX:sh (sh): ERROR: sh: syntax error at line 3: `(' unexpect
what seems to be the problem thank you very much

Cut-and-paste the output of "ls -l /home/shl/where/script/resides/cs-tr-700".
Also, cut-and-paste the script.

The "sh" error messages below indicate that it's a shell error. ( Which is good, since your COBOL program seems to be doing what you want it to. )

UX:sh (sh): ERROR: /home/shl/where/script/resides/cs-tr-700 not found
UX:sh (sh): ERROR: sh: syntax error at line 3: `(' unexpect 

hi
the result are :
UX:ls: ERROR: Cannot access /home/hoz_shl/where/script/resides/cs-tr-700
No such file or directory UX:ls: ERROR: Cannot access 00000000: No such file or directory UX:sh (sh)
UX:sh (sh): ERROR: sh: syntax error at line 3: `(' unexpec
the script doing like that
cs-tr-700
#!/bin/sh
mv cost_04200a cost_04200a_m
tr -d "\015" <cost_04200a_m> cost_04200a
please help

Try using "/home/hoz_shl/cs-tr-700" instead of "/home/hoz_shl/where/script/resides/cs-tr-700".

not working :frowning:
help pleaseeeee

Did you try Ygor's suggetstion? The "/where/script/resides/" should not be part of your command in working storage. It should contain just the directory that the script is located in and the script name. Also make sure your script has the correct permissions for it to be executed.

hi all
thanks for answers and help
it's still not working ! so what i did to be sure i moved the script :cs-tr-700
and the file :cost_04200a
that the script is handling to the same directory where the cobol program is running , did chmod 777 to both of them
and still it's not running
when i did
"/usr/tst/cs-tr-700"
that's the answer
UX:sh (sh): ERROR: 30: not found UX:sh (sh): ERROR: sh: syntax error at line 3: `(' unexpected
when i did
"/usr/tst/where/resides/cs-tr-700"
:sh (sh): ERROR: sh: syntax error at line 3: `(' unexpected
i also try to do
"/usr/tst/where/resides/(sh cs-tr-700)"
: syntax error at line 1: `usr/tst/where/resides' unexpected
i'm so stuck in here please help
best regards