[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
RE: [sqr-users] need to figure out if it is an old file before runn ing
You don't need Unix to check for the existence of a file; use the exists
command in a let statement or an if statement:
if exists($filename) = 0
! it does exist
else
! it does not exist
end-if
Unfortunately, there are only three file related functions; delete, exists,
and rename.
-----Original Message-----
From: Overcashier, Patricia [mailto:Patricia.Overcashier@aam.com]
Sent: Monday, November 24, 2003 12:19 PM
To: 'sqr-users@sqrug.org'
Subject: RE: [sqr-users] need to figure out if it is an old file before
runn ing
o.k, that test was going well, but now I need to put a command ahead of it
to check for the existence of each file first (a.txt and b.txt), and react
accordingly, because my diff fails if one or the other file isn't there.
Help one more time please. I just don't know Unix commands very well.
Thanks!
-----Original Message-----
From: George Jansen [mailto:GJANSEN@aflcio.org]
Sent: Monday, November 24, 2003 11:33 AM
To: sqr-users@sqrug.org
Subject: Re: [sqr-users] need to figure out if it is an old file before
running
I think I'll need you passport, your fingerprints, and maybe a blood
sample before I can answer this without getting flamed.
But what the hell, how about using CALL SYSTEM with diff, since you're
on a Unix box?
begin-program
call system using 'diff a.txt b.txt > /dev/null' #rv
if #rv = 0
show 'files are the same'
else
show 'files differ'
end-if
end-program
>>> Patricia.Overcashier@aam.com 11/24/03 10:37AM >>>
Hi. I have a PS Job that has the following steps:
Step 1: SQR that reads a file and processes it. This file is sent to
us
from an outside source just prior to the scheduled run.
Step 2: SQR that creates an output file, processing data from tables,
that
includes all of the updates made from the last sqr.
Step 3: Unix script that FTP's the output file, and upon successful
ftp,
since this is the last step of my job, I then rename the input file
used in
step 1 from input.txt to input.bkp, so that there is no way I will
accidentally use the same file again.
I do not want to have to add any steps to this process, but would like
to be
able to do the following, if possible, inside of the Step 1 sqr:
Every now and then the outside source accidentally sends us last week's
file
instead of the new one. When this happens, my whole process processes
this
file with incorrect data and causes a mess. What I would like to be
able to
do, is somehow in step 1 in the sqr, see if the file I am using,
input.txt
is identical to last weeks file input.bkp. If it is, I want the sqr
to
abort, in turn stopping the rest of the steps.
Does anyone know how I can do this in the sqr in step 1?
Thanks!
Patti
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
www.mimesweeper.com
**********************************************************************
_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users
_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users
_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users
_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users