Using Code Insights Explain


The 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 the COBOL program.

You can use the Code Insights Explain feature as a stand-alone tool to provide program summaries. You can host Code Insights Explain on premises so you don't need to share your code outside your organization.

You must install the BMC AMI AI Services to use the Code Insights Explain feature. For more information, see BMC AMI AI Services integration with Code Insights Explain .

The following diagram depicts the Code Insights Explain architecture:

image-2024-9-18_15-50-12.png

To use the Code Insights Explain feature in BMC AMI DevX, you must set the BMC AMI AI Services by configuring the CES setting where the Code Insights Explain instance is provisioned. You can select your local settings if you have your local AI service setup.

To configure the BMC AMI AI services

  1. From the Window menu, select Preferences > BMC > AMI Platform. The AMI Platform dialog box is displayed.

    image-2024-8-26_10-32-12.png
  2. Under AI services, select the USE settings stored on CES option to use the CES where Code Insights Explain is provisioned. This option is selected by default.
  3. To change the CES URL, click CES.
  4. In the Common Enterprise Services section of the Preferences dialog box, follow these steps:
    1. In the Connection field, enter the CES URL and click Validate Connection. When the entered URL is validated successfully, a validation success message is displayed. If a message appears regarding authentication, click Credentials.
    2. Enter the credentials for logging into CES (if required), then click OK.
    3. Click Apply and Close to save your settings and close the dialog box.
  5. If you have not configured the CES where Code Insights Explain is provisioned and you want to use your local AI service, select the Use local settings option. When you select this option, the AI services URL and Code Insights Explain access token fields are enabled and you can enter the URL and access token in the respective fields.

    Important

    The Use local settings option is not available in this release. This option will be available in a future release.

  6. Click Apply to save your selection.

To use the Explain Selection or Explain Program options

After configuring BMC AMI AI Services, you can select a paragraph or procedure in the COBOL program and produce a summary of the selected code by using the Explain Selection option or the entire program by using the Explain Program option. You can copy and paste the inset summaries generated as comments in a program in the code in one click. BMC AMI AI Servicesrecognizes COBOL programs with copybooks and generates explanations.

  1. From the editor, select a section of the code for which you want the summary.
  2. Right-click and select Explain Selection. For a summary of the whole program, select Explain Program.
    If you select a code snippet or program containing more than 20,000 words, the Explain process might take several minutes to explain and you see the notification for the same.
  3. In the notification dialog box, click Continue to proceed. If you have selected an incomplete code snippet, you see a notification message. In the notification dialog box, click Proceed to continue the Explain process.
  4. If the selected code has a copy statement and the copybook has not been downloaded, click Download Copybooks in the notification dialog box. The copybooks will be downloaded, and the explanation process will start. If you do not want to download copybooks then click Skip to proceed or click Cancel to cancel the process.
    The Code Insights Explain dialog box is displayed.
  5. To view a summary of the code, select the Explanation tab. To copy the summary, click Copy.

    image-2024-8-30_14-50-51.png
  6. To display the summary converted into a comment for COBOL, select the Comment tab.

    image-2024-8-30_14-51-17.png
  1. To copy the comment to the clipboard, from the Copy/Paste drop-down, select Copy.
  2. To paste the comment to the file, select Copy/Paste > Paste above Explained Code. To use this option, you must open the file in edit mode.
  3. To view the selected code to be explained, select the Code tab. To copy the code, click Copy.

    image-2024-8-30_15-6-19.png
  1. If you are unsatisfied with the displayed summary, click Regenerate to receive a new summary or close the dialog box.

 

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