Converting COBOL Source CodeVS utilities provide conversion tools |
|
From "Migration", Access to Wang, August 1995 |
|
[ Prior Article ] [ Return to the Catalog of articles ] [ Next Article ] |
Like it or not, the day may come when you must consider converting your Wang source files to a new platform. Or perhaps you would just like to know more about your source collection, such as the use of files, subroutine calls, or field names. In either case, VS utilities can help you achieve these goals.
The examples below are drawn from our experience converting COBOL programs, though similar issues exist in other languages. Most tools are VSAIDS (also known as USERAIDS), but recent versions of the Wang operating system have included some of these utilities.
One of the first tasks of any conversion effort is to identify and document source file characteristics. In COBOL source bound for other environments, some of the most important characteristics to be understood is the usage of COPY files, subroutine calls, and data file fields within your source set.
The best tool for identifying COPY and CALL statements is LISTCLIB, a VSAID (or USERAID). LISTCLIB accepts the name of a single file or a library name and produces cross-reference reports for either COPY statements or called subroutines. The report lists the elements found in each program, but the more useful section lists the programs that contain each element; this would show, for example, the programs that use the SORT subroutine.
Another COPY cross-reference tool is MACROUSE, a VSAID. MACROUSE is primarily intended to show Assembler macro usage in programs, but it also lists COPY usage in COBOL source libraries.
Some times it is desirable to know where specific data elements are used in the source set. The LIBRXREF utility - another VSAID - shows the occurrence of the field name in programs, the data level and picture (PIC), the characteristics of the item (group, binary, indexed, or computational), and whether it contains OCCURS or REDEFINES clauses within its definition. (These last parameters are less useful than they sound, since LIBRXREF does not find and analyze COPY files and, thus, does not have full information for these data items - only their occurrence in the source.)
While the report produced by LIBRXREF is useful, it is sometimes more useful to capture the file names and other information in data file format. The work file produced by LIBRXREF may be used for this purpose. To find this file, hit the HELP key while the program is running, select Show Program Statues (PF3) and then Show Files and Devices in Use (PF1); the file will be named XREFDATA and will be opened in OUTPUT mode. A sorted version is also produced as XREFSORT. These files might be resorted or indexed and used for other reporting needs.
In some cases, it is best to use ad hoc search tools to note the occurrence of text within a source library. Several useful tools are available for this purpose, ranging from commercial tools to freebies in the VSAIDS collection. My personal favorite is FINDTEXT, a VSAID, which has been mentioned in several prior columns. I use FINDTEXT in the background with a background procedure named GUMSHOE so that I can release a number of searches without tying up my workstation. (For information on getting a copy of GUMSHOE, contact me at Access to Wang.) A final note: most search tools - including all of the cross- reference tools mentioned above - display their progress on the workstation screen and, therefore, cannot be used in background.
The availability of EZFORMAT, REPORT, DATENTRY, and other VS tools has meant is has been unnecessary to write or save source for menus and simple programs; instead, new VS object code can be generated as needed from the SAVE files, REPORT definitions, or CONTROL files used by these VS utilities. Since most other platforms do not have similar tools, part of a conversion project might include creating program source files for these needs.
COBOL menu programs can be generated easily with the MENUGEN utility, a VSAID. MENUGEN accepts the name of a EZFORMAT screen file and creates COBOL source. Like EZFORMAT, MENUGEN prompts for the program names to be associated with each PF key and can also generate a screen prompting for the file to be run. (Note that there are two differences in syntax between EZFORMAT and MENUGEN: use RUN instead of USERPROG to create a run program screen, and EXIT instead of RETURN to exit the program.)
If you would like to move REPORT definitions into COBOL, the RPTGEN tool is the tool to use. Now part of the Wang operating system, this utility interprets REPORT files and creates a COBOL program. While the program produced by RPTGEN generally compiles and runs, there are some coding inefficiencies to consider: if the REPORT definition includes a sort, the entire data file is sorted before selections are made, and the open mode (INPUT) conflicts with most production use.
If you do not have EZFORMAT screen files (SAVE files) for existing files, the PRT2SAVE utility (a VSAID) will create a screen definition file from a screen dump print file. Again, the generated file is not perfect: underlined fields on the screen are interpreted by PRT2SAVE as rows on the screen, resulting in a loss of one or more rows below.
Some program statements in Wang source files must be converted to work properly in other environments. The CONVERTC utility meets these needs with sophisticated search and text conversion capabilities. CONVERTC, a Wang utility, uses a two-column table of search strings and corresponding actions, reviewing program source files in all languages. Search strings can include specifics such as column position and more complex search logic than the usual "wild card" elements. In most cases, CONVERTC accepts the name of a file or library and creates new files in a new library.
Typical CONVERTC actions include direct replacement of text with new code or merely printing the lines found to a report. One interesting option allows manual changes to program code by prompting the programmer whenever a string is found.
In any large conversion project it is necessary to check the syntax of a large number of programs. The Wang COMPILE utility can aid in this effort.
COMPILE is designed to compile multiple source files with full selection of options. You can select the input files or libraries, the locations of COPY files, and link libraries. A likely use during a conversion would be to use the compiler as a final syntax check by compiling all programs without producing object files (e.g. set the GENERATE option to NO). Like the cross-reference tools mentioned above, COMPILE works in foreground only.
If you need additional information on the tools mentioned above please contact me through this magazine.
Items mentioned:
COMPILE: Compiles multiple source files in any VS language. Part of the Wang operating system.
CONTROL: Data definition tool. Part of the Wang operating system.
CONVERTC: Searches for text strings using wild cards; can convert text strings, producing new source. Part of the Wang operating system.
DATENTRY: Data maintenance tools. Part of the Wang operating system.
EZFORMAT: Screen design and source file generation utility. Part of the Wang operating system.
FINDTEXT: Searches for text in any VS file. A VSAID.
LIBRXREF: Creates a cross-reference of field usage in COBOL source libraries. A VSAID.
LISTCLIB: Creates COPY and CALL cross-references for COBOL programs. A VSAID.
MACROUSE: Creates COPY and Assembler macro cross-references. A VSAID.
MENUGEN: Generates COBOL menu programs from EZFORMAT screen design files. A VSAID.
PRT2SAVE: Creates EZFORMAT screen definition files from screen prints. A VSAID.
REPORT: Ad hoc reporting tool. Part of the Wang operating system.
RPTGEN: Generates COBOL source from Wang REPORT files. Part of the Wang operating system.
Copyright © 1995 Dennis S. Barnes
Reprints of this article are permitted without notification
if the source of the information is clearly identified