[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: Question on CALL SYSTEM
- Subject: Re: Question on CALL SYSTEM
- From: Bill Milano <Bill_Milano@AMSINC.COM>
- Date: Wed, 7 Jul 1999 09:37:53 -0400
I ran into the same exact problem a few weeks ago. One of the guys in our
group (Moorthy Saga) called SQR and found out what the story is.
Executing a system command under Windows is a lot more difficult than I
thought. The documentation makes it sound really simple, but unless you are
running on top of UNIX, it's a pain in the ass.
The code should be relatively self explanatory. The only tricky thing is
that if you do this in a local procedure, you'll need to test the variable
"$_sqr-platform" instead of "$sqr-platform".
Here is an multi-platform example for doing a sort.
!--------------------------------------------------------------------------
! Sort the temporary file created earlier using Operating System's
SORT
!--------------------------------------------------------------------------
move 99 to #cmd_status
evaluate $sqr-platform
when = 'WINDOWS'
call system using 'SORT tempvms1.txt tempvms2.txt'
#cmd_status WAIT
break
when = 'WINDOWS-NT'
if instr(lower(getenv('COMSPEC')), 'command.com', 1)
!-------------------------------------------------------------
! Windows 95
!-------------------------------------------------------------
let $cmd = getenv('COMSPEC') || ' /c SORT tempvms1.txt
> tempvms2.txt'
else
!-------------------------------------------------------------
! Windows NT
!-------------------------------------------------------------
let $cmd = 'cmd /c @start /min /wait cmd /c "SORT <
tempvms1.txt > tempvms2.txt"'
end-if
call system using $cmd #cmd_status WAIT
break
when = 'UNIX'
call system using 'SORT tempvms1.txt > tempvms2.txt'
#cmd_status WAIT
break
end-evaluate
if #cmd_status != 0
let $error_string = 'Platform: ' || $sqr-platform || ' - Sort
returned error code: ' || to_char(#cmd_status)
do issue_error($error_string, 8, 'Y')
end-if
Please respond to SQR-USERS@list.iex.net
To: Multiple recipients of list SQR-USERS <SQR-USERS@list.iex.net>
cc: (bcc: Bill Milano/AMS/AMSINC)
Subject: Question on CALL SYSTEM
Dear all,
I have a sqr that is running on a Windows 95 environment. I need to do a
CALL SYSTEM to copy files from one directory to another. According to the
SQR Reference book the syntax should be as follow:
CALL SYSTEM USING 'copy c:\source\*.* c:\target\' #s
where #s returns the status of the call.
I ran the sqr but the return status is always 2 (which indicates an error)
and nothing gets copied over to the target
Can someone shed some light in this area.
Thanks