Editing text files in Scratchpad


Use the following procedure to edit a text file (such as a command statement) that is opened in Scratchpad.

 

To edit a file

  1. To open the text file in the Scratchpad perspective, perform one of the following actions:
    • In the Scratchpad perspective, open an existing file displayed under Files.
    • To create a new command file, add a new file view by clicking NW_plus_circle_o.png. Then, on the Command Text tab in Scratchpad, enter the command text (either by typing it or pasting copied text).
    • Select an object or group of objects in the Db2 navigation perspective, and select one of the Commands options, such as DDL.
    • Double-click a data set in the File Locator perspective.
  2. On the Scratchpad's Command Text tab, edit the command as needed:

    Purpose

    Action

    Find a search string

    1. Click Find/Replace NW_lines_search.png
    2. Enter the search string in the Search box.
    3. Click Find.

    Find and replace a search string

    1. Click Find/Replace NW_lines_search.png.
    2. Enter the search string in the Search box.
    3. Enter the replacement string in the Replace box.
    4. Click Find.
    5. Click Replace.

    Find and replace all instances of a search string

    1. Click Find/Replace NW_lines_search.png.
    2. Enter the search string in the Search box.
    3. Enter the replacement string in the Replace box.
    4. Click Replace All.

    Make a search case sensitive

    Select the Match case check box.

    Enable syntax highlighting

     

    Select Use syntax highlighting.

    This option is available when the Command Center option is enabled.

    For more information, see Setting Command Center options.

    Undo an action

    Click NW_undo.png to undo the last action.

    Redo an action

    Click NW_share.png to cancel undoing the last action.

    Copy an existing file

    1. Browse to a data set and open an existing file.
    2. Click Copy File NW_files_copy_o.png.
    3. Save the file.

      Follow the instructions in Step 4.

    To remove a file view from the Scratchpad navigation pane, select the file view and click Remove file view NW_minus_circle_o.png.

    Important

    For SELECT statements that include a CLOB column, you must cast the CLOB column as another type, such as CHAR or VARCHAR.

    The following example displays a cast of the TR.STATEMENT column from CLOB to VARCHAR(32000):

    select cast(TR.STATEMENT as varchar(32000))
    from SYSIBM.SYSTRIGGERS TR
  3. To save the active edited command output, click Save File NW_floppy.png in the toolbar.

    Under Files in the navigation pane, Scratchpad automatically displays all files that are saved to the mainframe.

  4. Select a z/OS data set in which to save the file.
    1. Click Add filter NW_plus_circle_o.png .
    2. In the Filter Pattern box, enter a filter (the wildcard * is supported) to display a filtered list of data sets that includes the one you want.
    3. Click OK.
    4. In the displayed hierarchical tree, navigate to and select the data set that you want. If you select an archived data set, you will be asked to confirm that you want to restore that data set.
  5. Enter a file name.
  6. Click Save.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*