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*/