Using Code Insights Explain


This GenAI-based Code Insights Explain feature leverages advanced AI algorithms to assist you in understanding complex codebases more efficiently. This feature significantly reduces the time and effort required to comprehend large and intricate programs by providing summaries and detailed explanations of the code logic of COBOL, Assembler, JCL, and PL/I programs stored in LPAR or your local system. You can host Code Insights Explain on premises, so you don't need to share your code outside your organization. To use the Code Insights Explain feature in BMC AMI DevX Workbench for VS Code; you must set the BMC AMI AI Services by configuring the CES setting where the Code Insights Explain instance is provisioned. Alternatively, if you have your local AI service set up, you can select your local settings. For more information, see Configuring-AMI-Platform.

After configuring the BMC AMI AI Services, you can generate a summary of a selected paragraph or the whole program. You can then copy and paste the summary as a comment in the code in a program with one click.

BMC AMI AI Services also recognizes COBOL, Assembler, JCL, or PL/I programs with copybooks and generates explanations. The Explain Code and Explain Program options are available from the Code Pipeline and Debug extensions' source code. Following are the supported models.

Language

Recommended Model

Cobol

Mixtral8x7B-instruct Quantized

PLI

Mixtral8x7B-instruct Quantized

Assembler

  • Mixtral8x7B-instruct Quantized
  • Granite-3.1-8B-Instruct

JCL

  • Mixtral8x7B-instruct Quantized
  • Granite-3.1-8B-Instruct

To generate summaries of selected code or the entire program

  1. In the editor, perform one of these actions:
    • For a summary of a code snippet, right-click and select Code Insights > Explain Code Selection.
    • For a summary of the whole program, select Explain Program. For JCL, select Explain JCL.
      If the selected code snippet contains the PERFORM paragraph, the DevX Code Insights extension includes the paragraph with the code sent to the AI Services APIs for the explanation process and attached to the Code tab.
  1. If you select a code snippet or program containing more than 20,000 words, then it might take several minutes to explain. In the notification dialog box, click Proceed to continue.
  2. If you receive a notification that you selected an incomplete code snippet. In the notification dialog box, click Proceed to continue.
  3. If the selected code has a copy statement and that copybook is not downloaded, you will see a notification to download copybooks. If you select Download Copybooks, the copybooks will be downloaded, and the explanation process will start. If you do not want to download copybooks, click Skip to proceed or click Cancel to cancel the process.
  4. In the Code Insights Explain dialog box, you can perform the following tasks:
    • Explanation tab: Displays the summary of the code.
      • Click image-2024-12-19_17-55-25.pngor image-2024-12-19_17-55-50.pngicon to provide your feedback if you like or dislike the code explanation you got.
      • Click Copy image-2024-9-3_11-35-25.pngto copy the summary to the clipboard.
      • If you're unsatisfied with the summary, click Regenerate image-2024-9-16_11-53-1.pngto receive a new one.
  • Comment tab: Displays the summary converted into a comment for the code.
    • Click image-2024-9-3_11-35-25.png to copy the comments to the clipboard.
    • Click image-2024-9-3_12-2-47.pngto paste the comment to the file. You must open the file in edit mode when you use this option.
    • Click image-2024-9-3_12-3-47.pngto convert the comments to uppercase.
  • Code tab: Displays the selected code to be explained. Click image-2024-9-3_11-35-25.png to copy the code to the clipboard.

To get a summary of a procedure, right-click on any procedure and select Explain Procedure. You can view the Explain <procedure line number> tab and view the summary in the Explanation, Comment, and Code tabs.

 

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