[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
RE: [sqr-users] FTP -s help needed
- Subject: RE: [sqr-users] FTP -s help needed
- From: "Tajinder Chahal" <Tchaha@Roushind.com>
- Date: Wed, 21 Sep 2005 14:14:44 -0400
- Delivery-date: Wed, 21 Sep 2005 13:16:02 -0500
- List-id: "This list is for discussion about the SQR database reportinglanguage from Hyperion Solutions." <sqr-users.sqrug.org>
Hi Pam,
I tried this before posting my question...i.e. writing to a log file. Whenever
I've
'>> logfile' in the 'CALL SYSTEM', it errors out with error code 2.
>>> PLantzy@uamail.albany.edu 09/21/05 12:49PM >>>
Here is code taken from an SQR that I wrote to ftp files. I put all the
commands like you have it in $ftp_command_line but then I output the
results to a log file and then open the log file to look for an errors
that may have happened within the FTP
let $command = 'ftp -dn < ' || $ftp_command_file || ' > ' ||
$ftp_log_file
call system using $command #status
show '$command:' $command
!show 'UAFTP: Status after ftp: ' #status
if #status <> 0
show 'UAFTP: Error after FTP call: ' #status
show {NULL}
let #ret_status = #status
else
!Search through log file to find any errors
!show 'ftp_log_file: ' $ftp_log_file
show 'UAFTP: Checking FTP log file: ' $ftp_log_file
show {NULL}
open $ftp_log_file as 6001 for-reading record=3000
let #x = 0
while 1=1
add 1 to #x
read 6001 into $line:3000
let $x = to_char(#x)
show 'UAFTP: $line: ' $x ' ' $line
if #_end-file = 1
break
end-if
!Search for error
let #offset = instr($line, 'err',1)
if #offset <> 0
let #ret_status = 1
end-if
!Search for not connected
let #offset = instr($line, 'Not connect',1)
if #offset <> 0
let #ret_status = 1
end-if
!Search for fail
let #offset = instr($line, 'fail',1)
if #offset <> 0
let #ret_status = 1
end-if
end-while
show {NULL}
close 6001
end-if
if #ret_status is 1 then we have an error and the ftp failed
Hope that helps.
Pam
Pamela Lantzy
PS Administrator/ FA Tech Lead
IAS, University at Albany
-----Original Message-----
From: sqr-users-bounces+plantzy=uamail.albany.edu@sqrug.org
[mailto:sqr-users-bounces+plantzy=uamail.albany.edu@sqrug.org] On Behalf
Of Tajinder Chahal
Sent: Wednesday, September 21, 2005 9:36 AM
To: sqr-users@sqrug.org
Subject: [sqr-users] FTP -s help needed
My code looks like this:
let $ftp_parm_file = 'E:\' || $dbname ||
'\CUSTOM\SQR\ri_ftp_tl_dbmblake'
open $ftp_parm_file as 3 for-writing record=120:vary status=#filestat
write 3 from 'ftp site'
write 3 from 'userid'
write 3 from 'password'
write 3 from 'ascii'
write 3 from 'lcd <<directory>>'
write 3 from 'cd <<directory from where the file is being ftp'd>>'
write 3 from 'get filename.txt filename.txt'
write 3 from 'quit'
write 3 from 'EXIT'
close 3
let $syscmd = 'FTP -s:' || $ftp_parm_file
CALL SYSTEM USING $syscmd #stat WAIT
if #stat = 0
display 'FTP successful...........'
else
display 'Error attempting FTP.......'
end-if
-----------------------------
If filename.txt does not exist, if I run thru' MS-DOS, it gives me an
error - 'File not found'. But if I run it thru' sqr, #stat = 0 (i.e.
successful) and the trace file displays the statement 'FTP successful'.
_______________________________________________
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