You can use the Templates preference page to define code
templates that enable you to use custom code snippets.
About this task
Note: Custom code snippets (and the shortcuts that invoke
them) are used in conjunction with content assist to type frequently
used code constructs quickly. For example, suppose you defined a code
snippet for the IF/ELSE/ENDIF macros in the list
of templates with the name ifelse
. The shortcut that
would invoke this code snippet is ifelse
. In the z Systems® LPEX Editor, you can
type ifelse and then press Ctrl + Space to
insert the entire code block for an if else statement into the source
file.
Procedure
To set the HLASM template preferences for z Systems LPEX Editor, complete the following
steps:
-
In the navigation pane of the Preferences window, double-click the
LPEX node to open the tree of available preference pages.
- Double-click the z Systems LPEX Editor node
to open the tree of available preference pages.
- Double-click the HLASM Parser node
to open the tree of available preference pages.
- Click Templates to open the Templates
preference page.
- To create a new template, do the following actions:
- Click New to open the New
Template dialog box.
- In the Name field, type a name
for the new template that you want to create. For example, if you
want to create a template for if else statements, type ifelse.
- Specify the context for the template:
- Select HLASM for the template to appear
when you invoke content assist in assembler code.
- Select CICS for the template to appear
when you invoke content assist in
EXEC CICS
statements.
- Select the Automatically insert check
box to automatically insert the new template if it is the only available
option at the caret position.
- In the Description field, type
a description of the type of code snippet that you want to create
a template for. For example, if else statement.
- In the Pattern field, type the
pattern for your code template. This pattern can contain predefined
and custom template variables. To insert a predefined template variable,
click Insert Variable. From the list of predefined
variables, double-click the variable that you want to include in your
template pattern. You can also insert your own custom template variables
into the template pattern. These must evaluate to the name of the
variable itself. If you want to display the dollar symbol ($), it
must be escaped using two dollar symbols or the ${dollar} variable.
- To edit an existing template, do the following actions:
- Select the template that you want to edit, and then
click Edit to open the Edit Template dialog
box.
- Modify any information that you want to change for the
selected template.
- Click OK to save your changes
and close the dialog box.
Tip: To revert the template back to the default values
that existed before you edited the template, click Revert
to Default.
- To remove an existing template, select the template the
you want to remove and click Remove. The template
is removed from the list of available templates.
Tip: To
restore a template that you removed from the list of available templates,
click Restore Removed.
- To import a code template from another location, click Import to
open the Browse dialog box and browse for the location of the template.
- To export an existing code template to another location,
select the template that you want to export, and then click Export to
open the Browse dialog box. Browse for the location that you want
to export the template to.
Tip: To export multiple
templates to a single XML file, select the first template that you
want to export, and then press Ctrl + click for each additional
template that you want to export.
- Do one of the
following actions:
- Click Restore Defaults to discard
your changes and restore the default settings for this page.
- Click Apply to save your selections
in the preference page.