Sponsored Content
Top Forums Shell Programming and Scripting Calling script from RM cobol and returning value to cobol Post 302311794 by pavanmp on Wednesday 29th of April 2009 02:39:41 PM
Old 04-29-2009
Question 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.

WS-RETURN-SYS-CODE will return a numeric success / failure indicator.

My script returns values using exit command as below: (suggestion to improve the script will also help) -

#getUserId.sh - Get user from /etc/passwd using PID passed from cobol program.
processid=$1
echo $processid
if test -f pslog
then \rm pslog
fi
ps -ef -o "%u: %p" | grep $processid > pslog
cat pslog
puser_id="$(cut -d: -f1 < pslog)"
echo "User Name=" $puser_id;
puser_name="$(cut -f 1,5 -d : /etc/passwd | grep $puser_id)"
echo $puser_name
exit $puser_name /* I want to pass this back to cobol program that called thsi scrip*/
 

10 More Discussions You Might Find Interesting

1. 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

2. Gentoo

COBOL on linux?!

Hello guys, I'm searching for a good COBOL compiler which runs on linux. In fact I have found one but I'm really lost with its installation!! I don't know how to install it and how it works. In fact I'm not so good in linux and I always have problems with installation, but this time it's... (1 Reply)
Discussion started by: HSN
1 Replies

3. Solaris

COBOL issue

Hi, I am working on a Mainframe to UNIX replatforming project. we are facing problems with COBOL COMP-3 fields. We are using the Mainframe emulator software to download the data which has COMP-3 fields and using it as input to the same COBOL programs which were copied from Mainframe and did the... (1 Reply)
Discussion started by: Jayaprakash T
1 Replies

4. UNIX for Dummies Questions & Answers

COBOL file status 39

When I execute a COBOL load module, I get the following error: $ a.out IWZ200S Error detected during OPEN for file 'ABE-INPUT'. File status is: 39. Message routine called from offset 0x38 of routine iwzWriteERRmsg. iwzWriteERRmsg called from offset 0x3c4 of routine... (3 Replies)
Discussion started by: jbrubaker
3 Replies

5. UNIX and Linux Applications

Rm-cobol 85

Does anyone use the following Cobol compiler: RM/COBOL-85 Compiler - Version 5.15.00 for SCO Unix 386. I am looking for a file that might be part of the distribution named "osmain.o" Thanks. (0 Replies)
Discussion started by: jgt
0 Replies

6. Programming

cobol programme

I have some compile programme .crn now I want to run .crn programme on express cobol which allow only *.gnt programme any solution to run *.crn programme (0 Replies)
Discussion started by: bibi
0 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. SCO

cobol installation

Dear All, while installing mfcobol in sco open unix 5 in piv m/cs, when run #sh ./install this error massage is comming load error file lmfnewdb error code 198 pc=0 call=-1 seg=0 198 load failor chmod warrning can not acess /opt/lib/mflmf/mflmfdb no such file or directory (error-2)... (0 Replies)
Discussion started by: sudhir69
0 Replies

9. Linux

Cobol on Linux

Hello, I have got a specific requirement of running a COBOL code on EL5. Not sure if GCC includes the compiler for COBOL. Currently what I can think of installing openCOBOL in EL5 server and hand it over to developers. From what I think need to do is, compile COBOL code using openCOBOL ... (5 Replies)
Discussion started by: niravkamdar
5 Replies

10. 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
ZGREP(1)                                                      General Commands Manual                                                     ZGREP(1)

NAME
zgrep - search possibly compressed files for a regular expression SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename... DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code: (-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other options specified are passed directly to grep. If no file is specified, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep. If the GREP environment variable is set, zgrep uses it as the grep program to be invoked. EXIT CODE
2 - An option that is not supported was specified. AUTHOR
Charles Levert (charles@comm.polymtl.ca) SEE ALSO
grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1) ZGREP(1)
All times are GMT -4. The time now is 11:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy