Hi,
We are using a shell script which is called from COBOL program. Here the program works fine till we are using MicroFocus(MF) COBOL 4 and UNIX AIX 5.3.
Recently we have upgraded to MicroFocus(MF) COBOL 5.1 but same AIX version. now the shell script not working as expected.
The shell script does the following:
It should return 0 if its successful and 2 if there is any error. This is coming perfect when we execute it from sample cobol program in MF COBOL 5.1, but not from our existing cobol program which was working till before upgrade. Also shell script is working good if we execute as standalone script.
Could any one help me where it might gone wrong here?
Kindly let me know if further information is required.
Thanks & Regards,
Venkatesh S
Last edited by vbe; 08-12-2011 at 09:13 AM..
Reason: use code tags please - thanks
Well extracting a bit of code from a script isnt of much help for we do not know what makes (it) return a value such as 2 or 0...
If its a script and you havent changed or upgraded the OS then the result should not be affected and it is, reading your last statement so it is more to do with the MFcobol part
Hi,
Thanks for your reply.
Actually this is the first line of the script and based on that return code, we processed some statements in "If" condition.
Our understanding is since the return code is coming wrongly, its not going inside the "If" condition and the part is skipped.
Basically this grep command list the files based on some value given if its part of that file.
Regarding COBOL, one sample program which is in MF COBOL 5.1 is calling the same script correctly. But the existing COBOL program not calling it correctly.
Anyway this question about COBOL programming, not about shell or AIX. How we can help you if your script runs without problems on the command line and with problems as a subprocess (if I understand right) from your COBOL program?
You haven't been very clear with what's going on, so what follows may or may not be relevant.
grep is supposed to return 0 if a match is found, 1 if no match is found, and >1 if an error occurs. Testing specifically for 2 is probably not a good idea.
Hi,
Thanks for all for your reply.
Before going into return variables to COBOL, first i would like to know the return variables between grep and ls in UNIX command prompt and shell script.
if i gave grep -l "555" $Dir_name* > $File_name, the return value is '0' if match found, else '1' if no match found.
Similarly, if i gave ls -l /tmp/sh12.sh, the return value is '0' if any file found, else '2' if no file match found.
Is my understanding of this return values correct?
Not sure where the problem is. I can run the script without any issue using the following command.
. /opt/app/scripts/cdc_migration.sh
But it fails with the below error when I try it this way
/opt/app/scripts/cdc_migration.sh
/opt/app/scripts/cdc_migration.sh: line 65: return: can only... (1 Reply)
Issue: I'm not receiving notifications
I can succesfully receive an e-mail if I do this on the command line:
/usr/bin/mail -s "NAGIOS HOST ALERT on $HOSTNAME$" rgouette@butlerbros.com
but, my command.cfg configuration below, refuses to send an e-mail when I set a service to a critical... (3 Replies)
Hi Folks,
I have opened a log file through Vi editor in putty itself and I was searching for a pattern in logs , let say 'ABCD'
/abcd
then I want to come out from vi editor, Please advise what is the command to come out from unix editor..! (1 Reply)
Hi All,
I have a whole root zone, tsesbd02-zesbx01. On this zone, syslog service is not coming up. While it is working good on Global zone. Below are commands from tsesbd02-zesbx01
root@tsesbd02-zesbx01:/# svcs -a svc:/system/system-log:default
svcs: -a ignored when used with arguments.... (13 Replies)
Hi All,
Can anyone please let me know the syntax / how to pick up the Return Code ( RC) from the mailx command and return it to SAS uisng 'system()' function and '${?}'.
I am in a process to send the mail automatically with an attachment to bulk users. I have used 'Mailx' and 'Unencode'... (0 Replies)
Is there not one of us who can help here?? I'm really letting down my
pants here - not sure what's going on but if you could foreward this
link to a group you may know I would greatly appreciate it. I'm getting this error:
May 30 22:18:35 MYSERVERNAME sendmail: j4V2HWka015549: ... (1 Reply)