This page describes how to export assessment results for offline viewing,
for analysis in other tools, or for graph analysis in Neo4j databases.
You can export results in the following ways:

- [Export HTML report](https://docs.cloud.google.com/mainframe-assessment-tool/docs/export-results.md.txt#export-report)
- [Export JSON report](https://docs.cloud.google.com/mainframe-assessment-tool/docs/export-results.md.txt#export-json)
- [Export assessment data to your Neo4j database](https://docs.cloud.google.com/mainframe-assessment-tool/docs/export-results.md.txt#export-to-neo4j)

## Export HTML report

Download your assessment report as a zip file in HTML format to view the
report offline or share it with others.

To download the report, follow these steps:

1. In the navigation menu, click **Assessments**.
2. On the **Assessments** page, click the arrow to view a specific assessment.
3. Click **Export**.
4. Click **HTML report**.
5. Optional: To download a report with only selected assets, filter the assets, and then click **Download report**.

The report is downloaded as a zip archive to your computer. The zip
archive includes an HTML file for each program in your assessment. These
HTML files contain the information found on **Assessments** page,
including summaries, detailed logic, and generated code
suggestions.

The zip archive also contains a table of contents file named `index.html`,
which has links to all of the files in the archive.

## Export JSON report

Download your assessment report as a zip file in JSON format to use the
assessment data in other tools or for custom analysis.

To download the report, follow these steps:

1. In the navigation menu, click **Assessments**.
2. On the **Assessments** page, click the arrow to view a specific assessment.
3. Click **Export**.
4. Click **JSON report**.
5. Optional: To download a report with only selected assets, filter the assets, and then click **Download report**.

The report is downloaded as a zip archive to your computer. The zip
archive includes a JSON file for each program in your assessment,
containing all the collected data, including summaries and detailed logic.

## Export assessment data to your Neo4j database

You can export your assessment data to a Neo4j database to
analyze and query the complex relationships between your mainframe
application components. The data is downloaded in a JSON Lines format, which
you can then import into your Neo4j database.

To export your assessment data to your Neo4j database, follow these steps:

1. In the left pane, click **Assessments**.
2. On the **Assessments** page, click the arrow for a specific assessment.
3. Click **Export**.
4. Click **Neo4j graph**.

The file is downloaded as a zip archive file to your computer. The zip
archive includes the graph data. This file contains nodes and relationships of
programs, JCL jobs, datasets, databases, and BMS maps.

After downloading the assessment data, you can import it into your own
Neo4j database by following these steps:

1. Ensure you have a Neo4j database installed and running.

2. Install the [APOC library](https://neo4j.com/labs/apoc/). APOC is required
   for importing data of JSON format.

3. Extract the JSON Lines file containing the graph data from the downloaded
   archive. Each line in this file is a JSON object that represents
   either a node or a relationship from the assessment results.

4. Copy the JSON Lines file into the `import` directory of your Neo4j database
   installation so that APOC procedures can access it using `file:///`.

5. For better performance on large datasets, create constraints for all node
   labels using a query similar to the following:

   ```cypher
   CALL apoc.load.jsonl('file:///<your-data-file>.jsonl') YIELD value
   WHERE value.type = 'node'
   UNWIND value.labels as label
   WITH distinct label
   CALL apoc.cypher.doIt("CREATE CONSTRAINT IF NOT EXISTS FOR (n:" + apoc.text.quoteLabel(label) + ") REQUIRE n.id IS UNIQUE", {}) YIELD value
   RETURN count(*);
   ```

   This query reads node labels from the file and creates a unique constraint
   on the `id` property for each label. These constraints also create indexes
   that speed up data import and querying.
6. Import nodes using a Cypher query similar to the following:

   ```cypher
   CALL apoc.load.jsonl('file:///<your-data-file>.jsonl') YIELD value
   WHERE value.type = 'node'
   CALL apoc.merge.node(value.labels, {id: value.id}, value.properties, value.properties) YIELD node
   RETURN count(node);
   ```

   This query reads each line from the file, and if it's a node, it creates a
   corresponding node in the Neo4j database with its labels and properties,
   using `MERGE` to avoid duplicates based on node `id`.
7. After importing the nodes, import relationships using a query similar to
   the following:

   ```cypher
   CALL apoc.load.jsonl('file:///<your-data-file>.jsonl') YIELD value
   WHERE value.type = 'relationship'
   MATCH (startNode{id: value.start.id}), (endNode{id: value.end.id})
   CALL apoc.merge.relationship(startNode, value.label, {}, value.properties, endNode) YIELD rel
   RETURN count(rel);
   ```

   This query reads relationship objects from the file and creates
   relationships in the Neo4j database between nodes that were created in the
   previous step.

After completing these steps, your assessment data will be loaded into the Neo4j
database, and you can use the Neo4j Browser or other tools to explore the graph.

## What's next

- Learn how to [modernize your mainframe application](https://docs.cloud.google.com/code/docs/vscode/modernize-mainframe-application).