Is there a script to identify the archive log in the standby database? And upon identifying, will tranfer (ftp) to the standby database?

Oracle8i docs has a script but there is an error.
I am not good in sql. can anyone help pls?

SELECT high.thread#, "LowGap#", "HighGap#"
FROM
( SELECT thread#, MIN(sequence#)-1 "HighGap#"
FROM
( SELECT a.thread#, a.sequence#
FROM
( SELECT *
FROM v$archived_log
) a,
( SELECT thread#, MAX(sequence#)gap1
FROM v$log_history
GROUP BY thread#
) b
WHERE a.thread# = b.thread#
AND a.sequence# > gap1
)
GROUP BY thread#
) high,

( SELECT thread#, MIN(sequence#) "LowGap#"
FROM
( SELECT thread#, sequence#
FROM v$log_history, v$datafile
WHERE checkpoint_change# <= next_change#
AND checkpoint_change# >= first_change#
)
GROUP BY thread#
) low
WHERE low.thread# = high.thread#;

---------------------------------------
) low
*
ERROR at line 9:
ORA-00933: SQL command not properly ended