Line numbers in the migrated merged Macros

When several Macros insert lines in the same function or subfunction of the calling instance, they are merged. Their lines are combined. The lines are correctly managed by the merge because the condition lines are separated from the code lines. To avoid orphan code lines, the PROCEDURE DIVISION lines are sometimes automatically repositioned in the generated code and their tags are sometimes automatically calculated again in the Generated code structure view.

All the code lines must be attached to condition lines, if any. A condition can be indicated on more than one line. For example, the first condition line can be IF, the second line can be AND, and the third line can be OR. In the COBOL code editor and the Generated code structure view of the calling instance, the condition lines are always displayed in the ascending order of their line numbers, even if these lines belong to different Macros. The code lines that depend on these condition lines must also be displayed in the order, after the last condition line that they depend on. The line number of the last condition line constitutes the first 3 digits of the line numbers for the code lines that depend on the condition. In some cases, the code lines that come from different Macros are combined without being automatically repositioned in the generated code and without the automatic recalculation of their tags in the Generated code structure view. However, in other cases, some code lines are automatically repositioned and their tags must be calculated again to avoid orphan code lines.

Merge where code lines are not repositioned and their line numbers are not calculated again

If the merge does not create any orphan lines, which are not attached to the subfunction condition, then the code lines are combined when the calling instance is generated without any repositioning or new calculation. They are sorted according to the ascending order of their line numbers.

The Generated code structure view first displays the tag of the function or subfunction title line, if any. This line contains N, the function or subfunction code, and the 3 characters of the line number (N5632000 for example). The view then displays the tag of the function or subfunction level. This line contains F, the function or subfunction code, and the 3 characters of the line number (F5632000 for example). The other tags, which correspond to code lines, also start with F and the function or subfunction code. However, their line numbers are on 6 characters (F5632120200 for example).
Example: The following example shows two Macros that insert lines in subfunction F56BB. Macro AAASQ8 contains a code line 210210. Macro AAASQ7 contains a code line 100100 and a code line 200200. Both Macros are called in the same Program. After the Program is generated, the code lines of the two Macros are combined according to the ascending order of their line numbers. The Generated code structure view displays, in the order, the lines F56BB100100, F56BB200200, and F56BB210210.
Figure 1. Merged Macros without tag modifications
This example shows the code lines of the two Macros, the generated subfunction in the calling Program, and the tags that are displayed in the Generated code structure. The content of each screen capture is described in the preceding explanations.

Merge where code lines are repositioned and their line numbers are calculated again

If the merge creates orphan code lines, which are not attached to the subfunction condition, then these lines are repositioned in the generated code of the calling instance and the corresponding tags are calculated again.

In the generated code, they are inserted between the last condition line and the first code line that depends on it. In the Generated code structure view, the first 3 characters of the line numbers of the repositioned code lines are modified to correspond to the line number of the last condition. The last 3 characters remain unchanged.

Example: The following example shows two Macros that insert lines in subfunction F56BB. Macro AAASQ2 contains a line 000 with an IT condition, a line 010 with the condition continuation that begins with AND, and code lines 100100 and 200200. Macro AAASQ3 complements the condition with a condition line 075 that begins with AND, a condition line 150 that begins with AND, a condition line 210 that begins with OR, and a code line 210210. Both Macros are called in the same Program. After this Program is generated, the condition lines of the two Macros are combined. The Generated code structure view displays, in the ascending order, the condition tags from F56BB000, F56BB010, to F56BB210. Then, it displays the code line tags that are calculated again according to the last condition line, whose line number is 210. The line 100100 of Macro AAASQ2 is then calculated again and transformed into F56BB210100. The line 200200 is transformed into F56BB210200.
Figure 2. Merged Macros with tag modifications
This example shows the code lines of the two Macros, the generated subfunction in the calling Program, and the tags that are displayed in the Generated code structure. The content of each screen capture is described in the preceding explanations.

Feedback