Topic
5 replies Latest Post - ‏2013-01-16T17:43:46Z by SystemAdmin
ENO2010
ENO2010
44 Posts
ACCEPTED ANSWER

Pinned topic Snippets or COBOL Templates

‏2012-08-30T14:58:15Z |
Hi,
In fact, I have 2 questions :
(1) I would to know what's the difference between snippets and COBOL Templates.
At the moment, I don't see any advantage to use snippets
  • I can put reusable COBOL code into a snippet but I can just do the same thing with COBOL Templates and if I use COBOL Templates, I can use the content assist.
  • If I want to share my snippets I must export them and the others must import them. Using COBOL templates we can use the “pushtoclient” functionality.
(2) Snippets are store in my local workspace when I create a new one they are gone. I would like to know where the snippets are stored? Is it possible to copy/paste this file in another workspace?

Thanks
Eric
Updated on 2013-01-16T17:43:46Z at 2013-01-16T17:43:46Z by SystemAdmin
  • ENO2010
    ENO2010
    44 Posts
    ACCEPTED ANSWER

    Re: Snippets or COBOL Templates

    ‏2012-09-04T13:37:00Z  in response to ENO2010
    nobody?
  • SystemAdmin
    SystemAdmin
    1086 Posts
    ACCEPTED ANSWER

    Re: Snippets or COBOL Templates

    ‏2012-09-14T09:13:22Z  in response to ENO2010
    Responding to second question about where are snippets stored.
    Snippets are stored under your <workspace directory>/.metadata\.plugins\org.eclipse.wst.common.snippets folder
    You will see two files and inside user.xml you will find your snippets.

    In my feeling, with COBOL templates you have advantages like the content assist and the possibility to store them in a central repository so that everybody can make use of them with pushtoclient functionality. But, in my opinion, for very long statements (like the CICS API statements) it can be quicker to add the code from the snippet.
    With V8.5 we are provided with lots of snippets that cover also JCL coding, LE, DB2, etc.
    • jsayles
      jsayles
      156 Posts
      ACCEPTED ANSWER

      Re: Snippets or COBOL Templates

      ‏2012-10-16T22:47:56Z  in response to SystemAdmin
      Hi. I wish I could agree Rafa - but in my experience, because Snippets enable unlimited #s and flexibility of parameterizing the code - I feel that Snippets are better than Code Templates for almost all scenarios. You can get a good feel for Snippets by checking out this zipped workspace: https://www.ibm.com/developerworks/mydeveloperworks/files/app?lang=en#/person/110000JV7B/file/6b453532-45ba-4fcb-a920-f0f79f4a5790
  • SystemAdmin
    SystemAdmin
    1086 Posts
    ACCEPTED ANSWER

    Re: Snippets or COBOL Templates

    ‏2013-01-16T17:43:46Z  in response to ENO2010
    If find the Templates feature more useful than the Snippets feature the following reasons:

    Templates support in-editor variable replacement, so you don't need to enter replacement variables in a pop-up dialog.

    Templates which use the line_selection or word_selection variables will appear in the Surround With menus

    There is a Templates view which supports the same drag/drop and double click use cases that the snippets view supports.

    Templates have a context mechanism which helps filter out invalid templates based on the location in the program

    You can type the first few letters of the Template into the editor, and then use content assist to replace the name of the template with its contents. The name does not have to be part of the contents of the template, it can be anything, because it will be replaced when you select it.