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

01 WS-RETURN-SYS-CODE PIC 9(8).

That is a number not a string. When a script exits, the shell can return a maximum of an 8 bit number, not a string - ie 0-255 (unsigned). See man 2 wait (what COBOL calls when it fork/execs your script process). Write the return value to a file, then read it in from your COBOL.