If a job is run every day, or multiple times a day, it can be difficult to locate the latest or correct generated file without adding something in the name of the result file that helps distinguish it or make it unique. Creating unique file names will help users identify the different generated file results.

Steps

This method requires a view to extract data, and a script to run the view and direct its output. This method can also be used if you want to add a timestamp to the output file created from a Report object.

  1. Although the Skybot job will ultimately run a script, you need to start by first creating a job with the view or report object.

    Right-click on a View or Report in the Repository and select Create Job.

    The New Job Definition window displays:

  2. Create a script that runs the same View or Report:

    The script for a view contains a single command as follows:

    SCSERVER10/EXECUTE VIEW(BOBKREPO/CUSTOM0003) PCFMT(*XLS)
    TOSTMF('/scserver10/swi/repository/Bobk/BOBK/Queries/Customers &&timest.xls')
    RECIPIENT('[email protected]') TEXT('Here is your report')

    The script for a report contains a single command as follows:

    SCSERVER10/REPORT REPORT(SHAR10/GENERICCRO) TITLE('Time Stamp CRO Report')
    PCFMT(*PDF) TOSTMF('/scserver10/swi/repository/SHAR/CRO/Generic CRO Report &&timest.pdf') RECIPIENT('[email protected]')

    The first example will generate output as HTML and the second as PDF, but the following options are also available by changing the PCFMT values:

    *HTML
    *PDF
    *XLS
    *XLSX
    *TXT
    *RTF
    *XML
    *WKS

    Notes:

    • TOSTMF path must be the full path on the IFS.
    • Variable uses a double ampersand.
    • File name must include extension.
    • In the examples, the timestamp is added immediately following the result file name. You can also add a blank space or a hyphen (but not an underscore), if you wish.
    • If you would like the results also emailed to a recipient, you can use the RECIPIENT parameter, as in the examples.
    • For a view, the TEXT parameter is used for the email message Subject.
    • For a report, the TITLE parameter is used for the email message Subject.
    • There are even more parameters available. To see them, click on the script in the design window and hit the F4 key.

  3. Open the Variables tab and define the TIMEST variable as follows:

    • Because a timestamp is 26 characters long, make sure the Type of variable is set to Expr (Expression).

    • Enter the value *NOPROMPT for the Prompt Text.

    • The Default value in this example is set to the SQL statement--SQL (CURRENT TIMESTAMP). The other available options are: CURRENT TIME, and CURRENT SERVER.

  4. Save the script. Note the name and library, because you will need this later.

  5. From the Repository, right-click on the job and select Advanced Job Edit.

  6. The Skybot job edit screen should open. Scroll down and click the EDIT option to the right of the Commands section:

  7. Select the second command. This will expand it so that you can see the entire thing.

  8. Replace the entire command string with this: RUNSCRIPT SCRIPT(BOBK/SCRIPT1)

Still have questions? We can help. Submit a case to technical support

Last Modified On:
You don't have the appropriate permissions.
No, open a new Support Case