Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

How to? RUN WAIT OUTPUT from DOS Command

3 posts in General Discussion (old) Last posting was on 2000-03-10 20:47:30.0Z
Andrew Hart Posted on 2000-03-10 19:58:29.0Z
Newsgroups: sybase.public.easerver
Date: Fri, 10 Mar 2000 13:58:29 -0600
From: Andrew Hart <Andrew_Hart@harcourt.com>
Organization: The Psychological Corporation
X-Mailer: Mozilla 4.7 [en] (Win95; I)
X-Accept-Language: en
MIME-Version: 1.0
Subject: How to? RUN WAIT OUTPUT from DOS Command
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 43
NNTP-Posting-Host: 167.208.175.68
Message-ID: <347_38C953E5.D93F60D0@harcourt.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.easerver:26635
Article PK: 157637

This may be more of a powerscript question, but since I'm doing it from
a component and there may be ramifications from
that...

I've writing an application that monitors source files for changes and
sends email notifications when they change. I've got
java components to do the FTP and Email portions of this problem. I've
written a Powerbuilder component that (in the
interest of getting something up and going quickly) just uses the
built-in fc.exe command to compare two files with the output
directed to a filename passed in and returns TRUE or FALSE depending on
whether or not there are changes.

Everything works fine, with one big snag: I'm not getting the output
file. In my component, I started out with this:

ls_runcommand = "c:\winnt\system32\fc.exe " + as_filename01 + " " +
as_filename02 + " > " + as_output
li_result = RUN ( ls_runcommand );

Which returned no error, but my output file wasn't being created. After
some study, I decided the problem might be
that I wasn't waiting for that process to finish, so I researched the
various ways of doing that. Instead of putting in the
windows API calls to spawn the process and wait, I first tried
inserting the following code after my RUN:

DO
JagSleep(10)
LOOP UNTIL FileExists( as_output );

And it just loops forever. Perhaps synchronization is not the problem.
Any suggestions?

I also tried this run command, with no difference:

ls_runcommand = "c:\winnt\system32\cmd /c ~"c:\winnt\system32\fc.exe " +
as_filename01 + " " + as_filename02 + " > " + as_output + "~"";

(I thought perhaps that I needed to spawn a CMD.exe process to handle
the redirection of the output.)

Thanks.


Roy Kiesler [TeamSybase] Posted on 2000-03-10 20:47:30.0Z
Newsgroups: sybase.public.easerver
From: "Roy Kiesler [TeamSybase]" <SPAM_FREE_rkiesler@noblestar.com>
Subject: Re: How to? RUN WAIT OUTPUT from DOS Command
Date: Fri, 10 Mar 2000 15:47:30 -0500
Lines: 60
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
NNTP-Posting-Host: 206.138.153.251
Message-ID: <347_jyVJFHti$GA.202@forums.sybase.com>
References: <347_38C953E5.D93F60D0@harcourt.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.easerver:26624
Article PK: 157626

Andrew,

Try Run( "start /wait fc.exe" ). Type "start /?" at the command prompt for
more help.

--
pbm_hopethishelps,
Roy Kiesler [TeamSybase]
Sybase Developers Network (SDN) - http:///www.sybase.com/sdn

"Andrew Hart" <Andrew_Hart@harcourt.com> wrote in message
news:38C953E5.D93F60D0@harcourt.com...
> This may be more of a powerscript question, but since I'm doing it from
> a component and there may be ramifications from
> that...
>
> I've writing an application that monitors source files for changes and
> sends email notifications when they change. I've got
> java components to do the FTP and Email portions of this problem. I've
> written a Powerbuilder component that (in the
> interest of getting something up and going quickly) just uses the
> built-in fc.exe command to compare two files with the output
> directed to a filename passed in and returns TRUE or FALSE depending on
> whether or not there are changes.
>
> Everything works fine, with one big snag: I'm not getting the output
> file. In my component, I started out with this:
>
> ls_runcommand = "c:\winnt\system32\fc.exe " + as_filename01 + " " +
> as_filename02 + " > " + as_output
> li_result = RUN ( ls_runcommand );
>
> Which returned no error, but my output file wasn't being created. After
> some study, I decided the problem might be
> that I wasn't waiting for that process to finish, so I researched the
> various ways of doing that. Instead of putting in the
> windows API calls to spawn the process and wait, I first tried
> inserting the following code after my RUN:
>
> DO
> JagSleep(10)
> LOOP UNTIL FileExists( as_output );
>
> And it just loops forever. Perhaps synchronization is not the problem.
> Any suggestions?
>
> I also tried this run command, with no difference:
>
> ls_runcommand = "c:\winnt\system32\cmd /c ~"c:\winnt\system32\fc.exe " +
> as_filename01 + " " + as_filename02 + " > " + as_output + "~"";
>
> (I thought perhaps that I needed to spawn a CMD.exe process to handle
> the redirection of the output.)
>
> Thanks.
>
>
>


Andrew Hart Posted on 2000-03-10 20:33:03.0Z
Newsgroups: sybase.public.easerver
Date: Fri, 10 Mar 2000 14:33:03 -0600
From: Andrew Hart <Andrew_Hart@harcourt.com>
Organization: The Psychological Corporation
X-Mailer: Mozilla 4.7 [en] (Win95; I)
X-Accept-Language: en
MIME-Version: 1.0
Subject: Re: How to? RUN WAIT OUTPUT from DOS Command
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 5
NNTP-Posting-Host: 167.208.175.68
Message-ID: <347_38C95BFF.170F6C7F@harcourt.com>
References: <347_38C953E5.D93F60D0@harcourt.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.easerver:26626
Article PK: 157628

P.S. I just noticed this message on the Jaguar console (running in debug
mode as an application):

The handle could not be opened
during redirection of handle 1.