When creating something new (a program, document, JCL, or anything) it is very common to copy from other examples to create the new one. Frequently used items can be stored as code fragments on a dataset specifically designed for this purpose, one member for each fragment. The edit Copy command is then used to pull one in when it is needed. The copy process is, however, not as neat as we would like; you have to type Copy, then the name of the dataset containing the code fragments, and then select the member you want. It's only if the fragment you want is a member of the dataset you happen to be editing that you can type COPY membernameon the command line. DDF enables you to code it this way even if the fragment you want is on a different dataset. How do you create templates?You link use the Type heading on the DDF screen to associate a fragments dataset with the dataset you are editing. This is best illustrated by a walk-through of what an experienced DDF user might do and what they would see on the way.On your DDF command line, type TEMPL. If you have set up templates before, you might see something like this: C Dataset name DDF type <your hlq>.TEMPLATE.JCL J <your hlq>.TEMPLATE.REXX R <your hlq>.TEMPLATE.CLIST C <your hlq>.TEMPLATE.SLIB S <your hlq>.TEMPLATE.MLIB M <your hlq>.TEMPLATE.PLIB P <your hlq>.TEMPLATE.COB COB <your hlq>.TEMPLATE.SC SC <your hlq>.TEMPLATE.JCL JYou control this display by using I (insert) D (delete) R (repeat) prefix commands to create as many lines as you want. <your hlq> is the high-level qualifer for your code fragment datasets. Note that the word TEMPLATE is not required (you can have any name) but it might be useful as a standard. Your DDF screen might look like this when you are using templates: Show list > ABC < Cmd Member Text Description Show Type FRED PROJ1.QUAL2.QUAL3.QUAL4 ABC J PROJ1.LEVEL2.QUAL3.QUAL4 ABC RWhen you edit the member fred, DDF will see it's Type J, which is associated with a dataset called <your hlq>.TEMPLATE.JCL, The template dataset will be made available by concatenating it after the dataset being edited. This means that during the edit of FRED you could type (for example) COPY JOBCARD and if you have a code fragement called JOBCARD on your TEMPLATE.JCL dataset, it will be copied in directly. If you take a DDF member list of PROJ1.QUAL2.QUAL3.QUAL4 above, the template dataset will show in the list, given a number of 2 as is usual in a member list for concatenated datasets. For this reason it's probably best to give all your template members names beginning with Z; this will ensure that they sort to the end of the list. The standard way of copying within edit is slow and awkward. With templates, you always have the datasets you want available and can always copy direct from the ISPF command line. You may find that you use pre-coded fragments more often now it's a bit simpler. |