[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: CALL SYSTEM USING .......
Here is some relevant information passed along to me when I had this
problem. The second part of this message worked for me. I am using SQR
v4.2.x I believe, with Oracle 7.x DB. I used SQR to interface our third
party payroll system to PeopleSoft General Ledger. i am sure there is more
information in the archives of this mail thread.
The CALL command of SQR issues an operating system command or calls a
subroutine you have written in a 3GL such as C or COBOL, and passes the
specified parameters.
Syntax
CALL { subroutine } USING { src_txt_col | _var | _lit } | {
src_num_col | var | lit }
{dst_txt_var | _num_var } [ param ]
To issue operating system commands from within an SQR report, use the
following syntax:
CALL SYSTEM USING { command } { status }
The following program can be used to call a system command from an SQR. In
DOS, Win 3.1 or Win 95 you need to call COMMAND.COM while on NT you need to
use CMD.EXE. On UNIX and VMS the shell shouldn't be called, SQR takes care
of it.
If you need to use an SQR with the CALL command and you have Win95 and NT
workstations, you may create an SQC that defines your workstation.
! WS_TYPE.SQC
#define WIN95
!#define WINNT
!#define UNIX
!#define VMS
! CALL.SQR
#include WS_TYPE.SQC
begin-report
do main
end-report
begin-procedure main
#ifdef WIN95
call system using 'C:\DOS\COMMAND.COM /C del c:\temp\a' #status
#endif
#ifdef WINNT
call system using 'C:WINNT\SYSTEM32\CMD.EXE /C del c:\temp\a' #status
#endif
#ifdef UNIX
call system using 'rm /tmp/a' #status
#endif
#ifdef VMS
call system using 'delete a;' #status
#endif
end-procedure
AND
SQR language contains a CALL function that allows you to execute a
subroutine or operating system command from within the SQR program.
I frequently encounter customers who, for some reason, want to list the
files on their hard drive from an SQR report. To do this, the customer
must structure the command line properly.
The regular command in DOS to do a directory listing of the C:\USER
directory is:
dir C:\USER
If the customer wants to write this output to a text file instead of
directly to the screen, they would type:
dir C:\USER > listing.txt
When the above command is issued from a DOS prompt, it creates a file
called "listing.txt" which contains a directory listing of the USER
directory.
Simple right? How do you do it from windows? First you'd have to issue
the command to open a DOS prompt, and then do the dir command, e.g.:
command.com /c dir C:\USER > listing.txt
The above command works when issued from the Windows File/Run menu. The
"/c" forces a return to Windows after the command has finished.
So to make this work from an SQR, the customer must code the following:
CALL SYSTEM USING 'command.com /c dir C:\USER > listing.txt'
Note however, that the command to start a command shell may be different on
Windows 95 or Windows NT. So the best way to code the SQR is to pickup the
correct command from the COMSPEC environment variable, then prepend it to
the command line syntax. Code it this way:
LET $COMSPEC = GETENV('COMSPEC')
LET $COMMAND = $COMSPEC || ' /c dir C:\USER > listing.txt'
CALL SYSTEM USING $COMMAND
> -----Original Message-----
> From: Grant Chappell [SMTP:gchappell@CARRERACONSULTING.COM]
> Sent: Monday, November 09, 1998 6:46 PM
> To: Multiple recipients of list SQR-USERS
> Subject: Re: CALL SYSTEM USING .......