jcs.searchfile

on-site-related topic PL/SQL API jcs.searchfile

Summary

Given a filename (and optionally a starting-line) find the first line which contains the given pattern.

Note: This interface is obsolete, use search instead.

The same wild-card characters can be used as in SQL's LIKE operator: '%' matches any number of characters (including zero) and '_' matches exactly one character.

Lines that are longer than 2000 characters are silently truncated unless jcs.set_text_mode was called.

Using jcs.searchfile in a script with a parameter P_STRING.

Copy

       declare
         l_test number;
       begin
         l_test = jcs.searchfile(123, '%' || P_STRING ||'%', 1, 0, 1);
       exception
         when no_data_found then
           jcs_out.put_line('Nothing found!');
       end;

Exceptions

Privileges

A job can read its own output and logfile; otherwise the READFILE system privilege is required. If a job ID is specified, and the caller has SELECT privilege on the job or Queue or script, then the file can be read. If a filename is specified, the OS security will be used to determine access to the file.

Specification

Copy
function searchfile(filename in varchar2,
text in varchar2,
beginline in number default 1,
flags in number default 0)
    return number

Search for a pattern and return the full line where it occurs from the given file.

You can specify a filename on any system using the following syntax in the filename parameter: <scheduler>:<filename>. This option is for backwards compatibility only. If you want to specify a scheduler Partition you cannot use this option anymore.

If you specify just a filename, the file must be an output file or log file of an existing (committed) job, and the system will search all jobs for the correct job_id and check that you have access to the file. This can be quite slow, so we recommend specifying a job_id instead.

Parameters

  • filename - the file to read
  • text - search pattern, a % wildcard must be specified at the end of the pattern.
  • beginline - line to start the search for the pattern on
  • flags - modification flags on how to perform the search; sum of zero or more of the following values:
  • jcs.search_ignorecase: ignore upper/lowercase differences
  • jcs.search_entireword: search string must be separated by spaces or tabs
  • jcs.search_reversedir: search up, not down
  • jcs.search_nowildcard: switches off the LIKE scanning, removing special meaning from % (procent) and _ (underscore)
  • returns number -

Transaction keyword

The transaction keyword defines how and/or when the changes are committed to the database. A definition of the various transaction keywords can be found on the jcs package summary page.

network_agent

Specification

Copy
function searchfile(job_id in number,
text in varchar2,
beginline in number default 1,
flags in number default 0,
filetype in number default 0)
    return number

Search for a pattern and return the full line where it occurs from the file in the given job.

Note: This interface is obsolete, use search instead.

Parameters

  • job_id - the ID of the job
  • text - search pattern, a % wildcard must be specified at the end of the pattern.
  • beginline - line to start the search for the pattern on
  • flags - modification flags on how to perform the search; sum of zero or more of the following values:
  • jcs.search_ignorecase: ignore upper/lowercase differences
  • jcs.search_entireword: search string must be separated by spaces or tabs
  • jcs.search_reversedir: search up, not down
  • jcs.search_nowildcard: switches off the LIKE scanning, removing special meaning from % (procent) and _ (underscore)
  • filetype - 0 = output file, 1 = log file
  • returns number -

Transaction keyword

The transaction keyword defines how and/or when the changes are committed to the database. A definition of the various transaction keywords can be found on the jcs package summary page.

network_agent

See Also