From: Richard on
On Dec 16, 4:25 pm, gaya3 <gayathri.kalyanasunda...(a)wipro.com> wrote:
> On Dec 15, 12:29 pm, Richard <rip...(a)Azonic.co.nz> wrote:
>
>
>
> > On Dec 16, 1:09 am, gaya3 <gayathri.kalyanasunda...(a)wipro.com> wrote:
>
> > > Hi,
>
> > > Is there any way to call a AIX shell script from IBM AIX COBOL? Could
> > > someone give me the link to the syntax/examples? Also, Is there a way
> > > to call system commands like "Echo 123" etc. using COBOL.
>
> > > It would be very helpful for me if syntax/examples are provided.
>
> > It is possible that you could do this via a
>
> >    CALL "system" USING "sh scriptname" & x"00"
>
> > or something similar, but this will depend on the implementation of
> > the compiler and I am unfamiliar with that one.
>
> Nopes.. This is not any kind of assignment.. I know that we can invoke
> system commands using C / C++. When i searched the internet, i could
> not find anything similar for COBOL. Ofcourse, there are pages where
> COBOL calls C/C++ and C/C++ intern invoke system commands. I dont want
> to do that. Let us say, i want to extract the uid using aix ibm cobol
> code. How to do this? One more thing, I did search a lot for the
> solution and am coming to this forum as the last resort. Also, I tried
> using CALL "system" ... The said command is applicable only for MF
> cobol and not for IBM AIX cobol. Please correct if wrong and also,
> please let me know how to call system commands from cobol code. It
> must be possible to call shell scripts from cobol. I just want to know
> how it is done!

You asked how to "call a AIX shell script". The way this is done in C
is via a "system(scriptcommand);" subroutine call.

system() is a standard C library routine. The special MF call is CALL
"SYSTEM". Note that this is upper case. The lower case version CALL
"system" should use the standard C library.

That you find it does not work could be caused by one of several
reasons, such as it is trying to do a dynamic call, or has been
remapped to upper-case, or you haven't supplied the C library. If you
can call C then you should be able to call C's library routines.

From: gaya3 on
On Dec 15, 11:23 pm, Richard <rip...(a)Azonic.co.nz> wrote:
> On Dec 16, 4:25 pm, gaya3 <gayathri.kalyanasunda...(a)wipro.com> wrote:
>
>
>
>
>
> > On Dec 15, 12:29 pm, Richard <rip...(a)Azonic.co.nz> wrote:
>
> > > On Dec 16, 1:09 am, gaya3 <gayathri.kalyanasunda...(a)wipro.com> wrote:
>
> > > > Hi,
>
> > > > Is there any way to call a AIX shell script from IBM AIX COBOL? Could
> > > > someone give me the link to the syntax/examples? Also, Is there a way
> > > > to call system commands like "Echo 123" etc. using COBOL.
>
> > > > It would be very helpful for me if syntax/examples are provided.
>
> > > It is possible that you could do this via a
>
> > >    CALL "system" USING "sh scriptname" & x"00"
>
> > > or something similar, but this will depend on the implementation of
> > > the compiler and I am unfamiliar with that one.
>
> > Nopes.. This is not any kind of assignment.. I know that we can invoke
> > system commands using C / C++. When i searched the internet, i could
> > not find anything similar for COBOL. Ofcourse, there are pages where
> > COBOL calls C/C++ and C/C++ intern invoke system commands. I dont want
> > to do that. Let us say, i want to extract the uid using aix ibm cobol
> > code. How to do this? One more thing, I did search a lot for the
> > solution and am coming to this forum as the last resort. Also, I tried
> > using CALL "system" ... The said command is applicable only for MF
> > cobol and not for IBM AIX cobol. Please correct if wrong and also,
> > please let me know how to call system commands from cobol code. It
> > must be possible to call shell scripts from cobol. I just want to know
> > how it is done!
>
> You asked how to "call a AIX shell script". The way this is done in C
> is via a "system(scriptcommand);" subroutine call.
>
> system() is a standard C library routine. The special MF call is CALL
> "SYSTEM". Note that this is upper case. The lower case version CALL
> "system" should use the standard C library.
>
> That you find it does not work could be caused by one of several
> reasons, such as it is trying to do a dynamic call, or has been
> remapped to upper-case, or you haven't supplied the C library. If you
> can call C then you should be able to call C's library routines.- Hide quoted text -
>
> - Show quoted text -

Thank you for the reply!
I have posted the code that i tried and also the error.
========================================================
*
Identification Division.
Program-Id. SysCmds.

Data Division.
Working-storage Section.
01 cmd-line pic x(3) value "sh".
01 cmd-line2 pic x(30) value "cp f1 f2 >errfile 2>&1".

procedure division.
display "Test"
call "SYSTEM" using cmd-line
display "Back in program"
call "SYSTEM" using cmd-line2
display "Back in program"
stop run.
==============================================================

Error during the execution of the code:
afnigk1(a)xsa00z72~> cob2 try1.cbl
PP 5724-H44 IBM COBOL for AIX 2.0.0 in progress ...
End of compilation 1, program SYSCMDS, no statements flagged.
ld: 0711-317 ERROR: Undefined symbol: .SYSTEM

=============================================================

As i understand from the above code, the IBM AIX cobol doesnt use
SYSTEM command. Is there any other possibility. Or, Can the scripts be
called only from C/C++ programs! I dont think the latter would be the
case. There should be some way to call scripts directly from ibm aix
cobol when there is a way in MF cobol!!!Am i doing something wrong
here?
From: gaya3 on
On Dec 15, 11:23 pm, Richard <rip...(a)Azonic.co.nz> wrote:
> On Dec 16, 4:25 pm, gaya3 <gayathri.kalyanasunda...(a)wipro.com> wrote:
>
>
>
>
>
> > On Dec 15, 12:29 pm, Richard <rip...(a)Azonic.co.nz> wrote:
>
> > > On Dec 16, 1:09 am, gaya3 <gayathri.kalyanasunda...(a)wipro.com> wrote:
>
> > > > Hi,
>
> > > > Is there any way to call a AIX shell script from IBM AIX COBOL? Could
> > > > someone give me the link to the syntax/examples? Also, Is there a way
> > > > to call system commands like "Echo 123" etc. using COBOL.
>
> > > > It would be very helpful for me if syntax/examples are provided.
>
> > > It is possible that you could do this via a
>
> > >    CALL "system" USING "sh scriptname" & x"00"
>
> > > or something similar, but this will depend on the implementation of
> > > the compiler and I am unfamiliar with that one.
>
> > Nopes.. This is not any kind of assignment.. I know that we can invoke
> > system commands using C / C++. When i searched the internet, i could
> > not find anything similar for COBOL. Ofcourse, there are pages where
> > COBOL calls C/C++ and C/C++ intern invoke system commands. I dont want
> > to do that. Let us say, i want to extract the uid using aix ibm cobol
> > code. How to do this? One more thing, I did search a lot for the
> > solution and am coming to this forum as the last resort. Also, I tried
> > using CALL "system" ... The said command is applicable only for MF
> > cobol and not for IBM AIX cobol. Please correct if wrong and also,
> > please let me know how to call system commands from cobol code. It
> > must be possible to call shell scripts from cobol. I just want to know
> > how it is done!
>
> You asked how to "call a AIX shell script". The way this is done in C
> is via a "system(scriptcommand);" subroutine call.
>
> system() is a standard C library routine. The special MF call is CALL
> "SYSTEM". Note that this is upper case. The lower case version CALL
> "system" should use the standard C library.
>
> That you find it does not work could be caused by one of several
> reasons, such as it is trying to do a dynamic call, or has been
> remapped to upper-case, or you haven't supplied the C library. If you
> can call C then you should be able to call C's library routines.- Hide quoted text -
>
> - Show quoted text -

On Dec 15, 11:23 pm, Richard <rip...(a)Azonic.co.nz> wrote:
> On Dec 16, 4:25 pm, gaya3 <gayathri.kalyanasunda...(a)wipro.com> wrote:
>
>
>
>
>
> > On Dec 15, 12:29 pm, Richard <rip...(a)Azonic.co.nz> wrote:
>
> > > On Dec 16, 1:09 am, gaya3 <gayathri.kalyanasunda...(a)wipro.com> wrote:
>
> > > > Hi,
>
> > > > Is there any way to call a AIX shell script from IBM AIX COBOL? Could
> > > > someone give me the link to the syntax/examples? Also, Is there a way
> > > > to call system commands like "Echo 123" etc. using COBOL.
>
> > > > It would be very helpful for me if syntax/examples are provided.
>
> > > It is possible that you could do this via a
>
> > > CALL "system" USING "sh scriptname" & x"00"
>
> > > or something similar, but this will depend on the implementation of
> > > the compiler and I am unfamiliar with that one.
>
> > Nopes.. This is not any kind of assignment.. I know that we can invoke
> > system commands using C / C++. When i searched the internet, i could
> > not find anything similar for COBOL. Ofcourse, there are pages where
> > COBOL calls C/C++ and C/C++ intern invoke system commands. I dont want
> > to do that. Let us say, i want to extract the uid using aix ibm cobol
> > code. How to do this? One more thing, I did search a lot for the
> > solution and am coming to this forum as the last resort. Also, I tried
> > using CALL "system" ... The said command is applicable only for MF
> > cobol and not for IBM AIX cobol. Please correct if wrong and also,
> > please let me know how to call system commands from cobol code. It
> > must be possible to call shell scripts from cobol. I just want to know
> > how it is done!
>
> You asked how to "call a AIX shell script". The way this is done in C
> is via a "system(scriptcommand);" subroutine call.
>
> system() is a standard C library routine. The special MF call is CALL
> "SYSTEM". Note that this is upper case. The lower case version CALL
> "system" should use the standard C library.
>
> That you find it does not work could be caused by one of several
> reasons, such as it is trying to do a dynamic call, or has been
> remapped to upper-case, or you haven't supplied the C library. If you
> can call C then you should be able to call C's library routines.- Hide quoted text -
>
> - Show quoted text -

Thank you for the reply!
I have posted the code that i tried and also the error.
========================================================
*
Identification Division.
Program-Id. SysCmds.

Data Division.
Working-storage Section.
01 cmd-line pic x(3) value "sh".
01 cmd-line2 pic x(30) value "cp f1 f2 >errfile 2>&1".

procedure division.
display "Test"
call "SYSTEM" using cmd-line
display "Back in program"
call "SYSTEM" using cmd-line2
display "Back in program"
stop run.
==============================================================

Error during the execution of the code:
~> cob2 try1.cbl
IBM COBOL for AIX 2.0.0 in progress ...
End of compilation 1, program SYSCMDS, no statements flagged.
ld: 0711-317 ERROR: Undefined symbol: .SYSTEM

=============================================================

As i understand from the above code, the IBM AIX cobol doesnt use
SYSTEM command. Is there any other possibility. Or, Can the scripts be
called only from C/C++ programs! I dont think the latter would be the
case. There should be some way to call scripts directly from ibm aix
cobol when there is a way in MF cobol!!!Am i doing something wrong
here?
From: Alistair on
On Dec 15, 2:06 pm, docdw...(a)panix.com () wrote:
> In article <42898ffb-c829-489a-b366-18aec7e0d...(a)1g2000vbm.googlegroups.com>,
>
> gaya3  <gayathri.kalyanasunda...(a)wipro.com> wrote:
> >Hi,
>
> >Is there any way to call a AIX shell script from IBM AIX COBOL?
>
> This 'smells' like homework/'do my job for me' but I'll follow up,
> anyhow.  
>

Smells like?! Are you going soft in your dotage?
From: Louis Krupp on
gaya3 wrote:
<snip>
> As i understand from the above code, the IBM AIX cobol doesnt use
> SYSTEM command. Is there any other possibility. Or, Can the scripts be
> called only from C/C++ programs! I dont think the latter would be the
> case. There should be some way to call scripts directly from ibm aix
> cobol when there is a way in MF cobol!!!Am i doing something wrong
> here?

Yes. You're assuming that because you would like AIX COBOL to have
"call system" or its equivalent, it must have one. It's OK; wishful
thinking is human nature.

I looked at the AIX COBOL manual online (as I assume you did), and I
couldn't find anything. There are examples of AIX COBOL calling C
functions, and at this point, I think you should probably do that.

Louis