Comparing COBOL code in the compare editor
You can compare the content of COBOL files from the Rational® Programming Patterns compare editor, or from the IBM® Developer for z Systems® (Rational Developer for z Systems) and Rational Developer for AIX® and Linux compare editor.
Some preferences apply to the COBOL compare editor. For
example, you can indicate that the editor must not flag differences
in the comments or in the EXIT statements. For explanations
on these preferences, see the paragraph COBOL comparison
in
the Preferences on the Pacbase patterns.
The Rational Programming Patterns COBOL compare editor complements the functions of the IBM Developer for z Systems (Rational Developer for z Systems) and Rational Developer for AIX and Linux editor. However, it includes some restrictions.
- In the Design Explorer view, you can compare two local
.cbl files. To open the COBOL compare editor, complete the following steps:
- Click a local .cbl file.
- Press Ctrl and select another local .cbl file in the same view and the same stream.
- Right-click and select .
When the COBOL compare editor opens, you must ensure that the files are displayed through the PDP Generated Code Compare editor and that the corresponding .cblpdp file exists. You can then benefit from the following features:- The two compared files are in edit mode. You can then copy and paste lines in both directions.
- The colors that are specific to each line type are shown in both files. You can then easily see where the lines come from: generated code, specific code, Macros, or micropatterns. For explanation on the line colors, see Preferences on the Pacbase patterns.
- The contextual menu of both files in the editor contains the Generate the code choice to generate the code again after updates and see the result directly in the compare editor.
- In the Design Explorer view, you can compare a new version of a
.cbl file with its current version before validating or discarding this new
version.
When you right-click a Program, Server, or Screen that is already generated and select Generate - preview, a new generation starts. It recognizes the modifications that are not saved in the opened editors. When the generation ends, the COBOL compare editor opens automatically.
When the COBOL compare editor opens, you must ensure that the files are displayed through the PDP Generated Code Compare editor and that the corresponding .cblpdp file exists. You can then benefit from the following features:- The new version of the generated file is in edit mode whereas its current version is in read-only mode. You can then copy and paste lines from the current version to the new version.
- The colors that are specific to each line type are shown in both files. You can then easily see where the lines come from: generated code, specific code, Macros, or micropatterns. For explanation on the line colors, see Preferences on the Pacbase patterns.
If you want to discard the new version, click Cancel in the compare editor. A message informs that the COBOL code has not been modified.
However, if you want to keep the new version, click OK. The new COBOL code then replaces the current code.
- In the Pending Changes view, you can compare a local
.cbl file with its remote version in the stream.
To open the COBOL compare editor, click a .cbl file, or right-click a .cbl file and select Open in Compare editor.
When the COBOL compare editor opens, you must ensure that the files are displayed through the PDP Generated Code Compare editor and that the corresponding .cblpdp file exists. You can then benefit from the following features:- The local file is in edit mode, whereas the remote file is in read-only mode. You can then copy and paste lines from the remote file to the local file.
- The colors that are specific to each line type are shown in both files. You can then easily see where the lines come from: generated code, specific code, Macros, or micropatterns. For explanation on the line colors, see Preferences on the Pacbase patterns.
- The contextual menu of the local file in the editor contains the Generate the code choice to generate the code again after updates and see the result directly in the compare editor.
- The -CP Lines tab of a Program, Screen, or Server. You can then compare
the COBOL code before and after modifications in the Macro calls. To open the COBOL compare editor, complete the following steps:
- Open the -CP Lines tab of a Program, Screen, or Server.
- Modify the Macro calls.
- Click Preview.
The calling instance is generated again and the COBOL compare editor opens so that you can see the impact of your modifications. You can also copy modifications from the previous COBOL code to the new COBOL code.
If you click Cancel in the compare editor, the new COBOL code is not saved and you can keep modifying the Macro calls. If you click OK, the new COBOL code replaces the previous COBOL code and the design of the calling instance is saved with the new Macro calls.
You can start the preview only if the following conditions are met:- A previous version of the COBOL code must exist for the calling instance.
- The existing COBOL code must not contain any migration warning.
- The existing COBOL code must be synchronized with the design of the calling instance.
- The existing COBOL code must not be currently opened in the COBOL editor.
- All the design editors must be closed, except the design editor of the calling instance that is being modified.
- Copying and pasting lines that come from micropatterns is strongly inadvisable because it can cause errors.
- It is not possible to compare files from two different streams.
- It is not possible to compare a local version with a version in the history.