Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling ksh script 1

Status
Not open for further replies.

jmanj

Programmer
May 20, 2003
298
US
We are using micro focus cobol and we have a program that calls a shell script as the last statement. In sun solaris the program calls the script without any problem. But in AIX the cobol program runs but not the script. If I call the script thru the command line, it works.

I'll appreciate if anyone can explain why this is not working in AIX platform. tHANKS.
 
I'll admit I know nothing of AIX, but I'll suggest a thought. Does AIX require that the command-interpreter for this script be called when you run it? For example, in DOS programming you have to call the command-line interpreter to adequately run a batch file.

Might be a clue?
 
Thanks for the quick response. I too is not familiar with AIX. I've been told the unix standard should almost be the same. What is so perplexing is that the script runs outside of cobol(command line) and yet it is perfectly fine in solaris.

I'm hoping that someone out there have similar experience. Otherwise, I have no choice but break out the job steps.

Thanks.
 
Guys thank you all for your responses. I have found the simple answer to my problem. I compared all other cobol pgms that has a call command and found out that this particular one has a INITIALIZE statement before the call command. Once I removed the statement, the scripts ran perfectly well.

INITIALIZE COMMAND-STRING.

STRING "XFILE_rename.ksh B"
DELIMITED BY SIZE
INTO COMMAND-STRING.

CALL "SYSTEM" USING COMMAND-STRING.

I'm still wondering why this works in solaris but not in AIX. COMMAND-STRING is a 100 character value of spaces plus
a 1 null character (value = x"00").

Thanks.
 
AIX, from your statements, likely requires a "null terminated" string. The INITIALLIZE removes the null.
 
Here's my working storage.

01 KSCRIPT.
02 CMD-STRING.
03 SYS-COMMAND PIC X(100) VALUE SPACES.
03 NULL-CHAR PIC X(001) VALUE x"00".

You are right. It seems NULL-CHAR has either spaces or "00"
character (not hex) after the initialization. This is supposed to be a valid statement (working in solaris) and YES unix do need null terminated string. So now I just have to initialize the SYS-COMMAND field when it involves multiple calls. Thanks for your thoughts.
 
You would get different results if you used:
Code:
INITIALIZE CMD-STRING ALL TO VALUE

The form of the INITIALIZE statement you are using (without TO VALUE) falls back to initializing elementary items based only upon the data type (alphanumeric for both SYS-COMMAND and NULL-CHAR) which causes the elementary data items to be initialized to SPACES.

Tom Morrison
 
K5TM,

Thanks for the suggestion. I'll definitely try that as long as
micro-focus will accept the syntax.
 
It is ANSI Standard COBOL, so you should be okay.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top