how to call to unix through cobol


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to call to unix through cobol
# 1  
Old 10-18-2006
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
# 2  
Old 10-18-2006
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.
# 3  
Old 10-19-2006
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
# 4  
Old 10-19-2006
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. )
Code:
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

# 5  
Old 10-19-2006
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
# 6  
Old 10-19-2006
Try using "/home/hoz_shl/cs-tr-700" instead of "/home/hoz_shl/where/script/resides/cs-tr-700".
# 7  
Old 10-19-2006
not working Smilie
help pleaseeeee
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX and Linux Applications

Ms COBOL 2.2 for SCO UNIX

HI ALL, I'm searching Ms Cobol 2.2 for Sco Unix if anyone has it please kind enough to support me... Thanks in advance Rukshan:) (2 Replies)
Discussion started by: rukshan4u2c
2 Replies

2. Programming

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? (2 Replies)
Discussion started by: Prosy60
2 Replies

3. Programming

UNIX system call in COBOL

Hi, The UNIX system call inside the COBOL program is doing the specified command correctly. MOVE W080-UNZIP-FILE-COMMAND TO W080-OUTPUT-COMMAND CALL "SYSTEM" USING W080-OUTPUT-COMMAND RETURNING W080-SYS-CALL-STATUS BUT The problem is, the following keeps on showing on the log file... (2 Replies)
Discussion started by: joyAV
2 Replies

4. UNIX for Dummies Questions & Answers

UNIX Scripts "Load Error" with MicroFocus COBOL subprograms

When running our UNIX job scripts we randomly get the following 198 error below. When we restart the job it works fine. I haven't been able to recreate the problem in test, so I'm wondering if it has something to do with Cron or possibly a memory error or memory leak. I don't see anything... (5 Replies)
Discussion started by: rthiele
5 Replies

5. Programming

Acceessing DB2 UDB in AIX COBOL on unix

Hi , We are migrating our database from DB2 z/os to DB2 UDB on UNIX. and cobol on mainframes to AIX cobol on UNIX. We have some cobol Db2 programs that are accessing different Databases how do we code such type of programs in AIX cobol. Do we need to Establish connection for accessing... (0 Replies)
Discussion started by: nal.satish
0 Replies

6. Shell Programming and Scripting

Calling script from RM cobol and returning value to cobol

Is there a way you can return a value from a script that is called from a rm cobol program... 01 WS-COMD-LINE-PGM X(39) value sh ./getUserId.sh 12345" 01 WS-RETURN-SYS-CODE PIC 9(8). CALL "SYSTEM" USING WS-COMD-LINE-PGM GIVING WS-RETURN-SYS-CODE. ... (1 Reply)
Discussion started by: pavanmp
1 Replies

7. Programming

cobol crn programme run on express cobol as .gnt

can i run .crn programme in express cobol which support to .gnt programme .... Plz tell me solution (2 Replies)
Discussion started by: bibi
2 Replies

8. UNIX for Dummies Questions & Answers

Newbie's question about COBOL Installation in Unix

I wanna to install a COBOL on the AIX unix server. Would u like to tell me the disk usage of COBOL installation? Thanks in advance. (2 Replies)
Discussion started by: GCTEII
2 Replies

9. UNIX for Dummies Questions & Answers

Cobol On Unix

Hi , Could anyone please tell me about the whole procedure for compiling, linking the cobol program on unix platform. As i am mainframe guy and very new to unix, any help will be very appriciated, Regards, -Vinit (2 Replies)
Discussion started by: vinit_cyberguy
2 Replies

10. Solaris

Cobol linking in Unix

I'm trying to call a C mod from COBOL but I'm currently having difficulty linking my COBOL program with a C module that I've just developed. I've tried using cbllink -v -l -k -BSF CMPCACVN.cbl test.lib but I've got an error that states cbllink: not found. I've also tried using buildclient -C -w -o... (0 Replies)
Discussion started by: soulfactory2002
0 Replies
Login or Register to Ask a Question