CN-121996250-A - Cobol code conversion deployment method, device and medium
Abstract
The invention discloses a method, a device and a medium for converting and deploying Cobol codes, which are characterized in that the method is used for receiving and carrying out standardized processing on original Cobol codes to output standardized Cobol codes, carrying out partition structural analysis on the standardized Cobol codes to obtain a target parsed _result data structure body, respectively generating Java public code parts and Java service code parts by adopting a preset conversion tool and a preset large model based on the target parsed _result data structure body, then combining the Java public code parts and the Java service code parts to obtain target Java engineering codes, compiling and packaging the target engineering codes to obtain target Jar packages, deploying the target Jar packages into a target environment through a preset deployment platform, and carrying out standardized processing, partition structural analysis, code collaborative generation and compiling and deploying to solve the technical problems of poor conversion precision and low efficiency of the Cobol codes in the related technology.
Inventors
- LIU ZIHUANG
- HE WENJIAN
- Dou Zixing
- XIANG GUO
Assignees
- 维恩贝特科技有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20260106
Claims (10)
- 1. A Cobol transcoding deployment method, comprising: receiving an original Cobol code, and performing code normalization processing on the original Cobol code to obtain a normalized Cobol code; carrying out partition structured analysis on the standardized Cobol code according to a preset analysis logic to obtain a target parsed _result data structure; Obtaining Java public code parts according to public code generation logic by adopting a preset conversion tool according to the target parsed _result data structure; generating a Java service code part by adopting a preset large model according to the target parsed _result data structure body and preset prompt words; combining the Java public code part and the Java business code part to obtain a complete target Java engineering code; compiling and packaging the target Java engineering code by adopting a preset compiling and packaging tool to obtain a target Jar package; and the docking preset deployment platform deploys the target Jar package into a target environment.
- 2. The Cobol transcoding deployment method of claim 1, wherein the performing a code normalization process on the original Cobol code to obtain a normalized Cobol code comprises: the method comprises the steps of preprocessing an original Cobol code, reading the original Cobol code according to lines, filtering empty lines, and storing the empty lines as a character string list, wherein the preprocessing comprises the steps of detecting file codes of the original Cobol code by using tool software, and using configured default codes if detection fails; annotation filtering processing including identifying annotation lines for filtering deletion; Performing continuous line processing, namely performing continuous line connection processing after identifying continuous line marks, and deleting the continuous line marks; Format normalization processing including case unification processing, indentation specification processing, keyword alignment processing, and sentence splitting processing.
- 3. The Cobol transcoding deployment method according to claim 1 or 2, wherein before the partition structured parsing of the standardized Cobol code according to the preset parsing logic to obtain the target parsed _result data structure, the method further comprises: loading the standardized Cobol code and constructing a line number index; And identifying four large core module areas in the standardized Cobol code, and dividing the four large core module areas into an identification part area, an environment part area, a data definition part area and a process logic part area.
- 4. The Cobol transcoding deployment method of claim 3, wherein the partitioning the standardized Cobol code according to the preset parsing logic to obtain the target parsed _result data structure comprises: Analyzing the standardized statement in the identification part area to obtain a parsed _result data structure of a program basic information module; Respectively analyzing the identification part area, the environment part area, the data definition part area and the process logic part area to obtain parsed _result data structure bodies of the original partition content modules; analyzing the FILE-CONTROL clause and the I-O-CONTROL clause in the environment part area to obtain a parsed _result data structure of the environment configuration module; analyzing FILE SECTION, WORKING-STORAGE SECTION and LINKAGE SECTION in the data definition part area to obtain a parsed _result data structure of the data definition module; Analyzing paragraph definition, call chains and control flow sentences in the process logic part area to obtain parsed _result data structures of the process logic module; And analyzing the auxiliary information in the analysis process to obtain the parsed _result data structure body of the analysis metadata module.
- 5. The Cobol transcoding deployment method of claim 1 or 2, wherein the preset conversion tools include Python tools and CobolTypeConvertUtil tool classes; the obtaining the Java common code part according to the common code generation logic by adopting a preset conversion tool according to the target parsed _result data structure body comprises the following steps: Constructing a Java engineering catalog through the Python tool; the Python tool generates logic according to entity classes, and maps FILE SECTION and LINKAGE SECTION in the target parsed _result data structure body into entity classes respectively; The Python tool maps WORKING-STORAGE SECTION in the target parsed _result data structure to an internal class according to internal data class generation logic; the Python tool generates logic according to the processor class, and maps file configuration, database processing and report output logic in the target parsed _result data structure body into the processor class; The Python tool maps hard-coded constants with VALUE clauses in the target parsed _result data structure to constant classes according to constant class generation logic; the Python tool maps custom exceptions corresponding to the error processing sections in the target parsed _result data structure body into exception classes according to exception class generation logic; The Python tool maps the object parsed _result data structure to a main program framework according to main program framework generation logic based on the object parsed _result data structure.
- 6. The Cobol transcoding deployment method of claim 5, wherein the pre-set large model comprises GPT-4 or universal thousands of questions, the pre-set hint words comprising context information, conversion rules, paragraph codes, and generation requirements; The obtaining the complete target Java engineering code by combining the Java public code part and the Java business code part comprises the following steps: Traversing placeholders in the main program framework through the Python tool, and replacing the JAVA service code part with the placeholders to obtain Java main program classes; And combining the Java main program class, the entity class, the internal class, the constant class and the abnormal class to obtain the target Java engineering code.
- 7. The Cobol transcoding deployment method of claim 1 or 2, wherein the preset compilation packaging tool comprises a Maven tool; The step of obtaining the target Jar package after compiling and packaging the target Java engineering code by using a preset compiling and packaging tool comprises the following steps: Compiling the target engineering code by adopting the Maven tool; If the compiling process is successful, executing unit testing process; and if the unit test processing is successful, executing engineering packaging to obtain the target Jar package.
- 8. The Cobol transcoding deployment method of claim 1 or 2, wherein the preset deployment platform comprises a DevOps platform; the docking preset deployment platform for deploying the target Jar package into a target environment comprises: Performing deployment configuration on the DevOps platform, wherein the configuration comprises configuration deployment parameters and configuration file generation; The deployment mode is selected, including single machine deployment, containerized deployment and cluster deployment; deployment verification, including service health checking, functional verification, and log checking; and outputting deployment results, including outputting deployment reports and exception handling.
- 9. A Cobol transcoding deployment apparatus, comprising: the code normalization module is used for receiving an original Cobol code and executing code normalization processing on the original Cobol code to obtain a normalized Cobol code; the code analysis module is used for carrying out partition structural analysis on the standardized Cobol code according to a preset analysis logic to obtain a target parsed _result data structure; The public code generation module is used for obtaining Java public code parts according to public code generation logic by adopting a preset conversion tool according to the target parsed _result data structure body; the service code generation module is used for generating a Java service code part by adopting a preset large model according to the target parsed _result data structure body and using preset prompt words; The code assembly module is used for combining the Java public code part and the Java service code part to obtain a complete target Java engineering code; the compiling and packing module is used for compiling and packing the target Java engineering codes by adopting a preset compiling and packing tool to obtain target Jar packages; The deployment module is used for docking a preset deployment platform to deploy the target Jar package into a target environment.
- 10. A computer-readable storage medium storing an executable program that is executed by a processor to implement the Cobol transcoding deployment method of any one of claims 1 to 8.
Description
Cobol code conversion deployment method, device and medium Technical Field The present invention relates to the field of computer software technologies, and in particular, to a Cobol code conversion deployment method, device, and medium. Background The Cobol language is close to natural language, and has strong data processing capability, and many development languages of the traditional financial and government core business systems are selected for development, however, along with the digitalized transformation of various industries, the Java language has the advantages of strong cross-platform and cloud computing architecture adaptation, and the like, and the financial and government institutions are urgent to migrate the Cobol system to Java ecology. In the related art, in the conventional Cobol code conversion Java code technology, the steps of grammar analysis, rule mapping, code generation, later repair and the like are usually simply performed, and the code conversion mode usually has a large number of grammar errors and logic deletions, so that a developer is often required to perform a large number of manual repair works, and the technical problems of low code conversion precision and low efficiency exist. Therefore, how to solve the technical problem of converting the conventional Cobol code into the Java code in the related art becomes a technical problem to be overcome by those skilled in the art. Disclosure of Invention The embodiment of the invention provides a Cobol code conversion deployment method, a device and a medium, which are used for solving the technical problems of low code conversion precision and poor conversion efficiency in the related technology. In a first aspect, an embodiment of the present invention provides a Cobol transcoding deployment method, including: receiving an original Cobol code, and performing code normalization processing on the original Cobol code to obtain a normalized Cobol code; carrying out partition structured analysis on the standardized Cobol code according to a preset analysis logic to obtain a target parsed _result data structure; obtaining Java public code parts according to public code generation logic by adopting a preset conversion tool according to the target; generating a Java service code part by adopting a preset large model according to the target parsed _result data structure body and preset prompt words; combining the Java public code part and the Java business code part to obtain a complete target Java engineering code; compiling and packaging the target Java engineering code by adopting a preset compiling and packaging tool to obtain a target Jar package; and the docking preset deployment platform deploys the target Jar package into a target environment. The Cobol code conversion deployment method of the embodiment of the invention has at least the following beneficial effects: According to the Cobol code conversion deployment method, an original Cobol code is received and standardized to output a standardized Cobol code, the standardized Cobol code is subjected to partition structural analysis to obtain a target parsed _result data structure, a Java public code part and a Java service code part are respectively generated by adopting a preset conversion tool and a preset large model based on the target parsed _result data structure, then a target Java engineering code is obtained through combination, the target engineering code is compiled and packaged to obtain a target Jar package, finally the target Jar package is deployed into a target environment through a preset deployment platform, and the technical problems of poor conversion precision and low efficiency of the Cobol code in the related technology are solved through standardized processing, partition structural analysis, code collaborative generation and compiling deployment. According to further embodiments of the present invention, the performing a code normalization process on the original Cobol code to obtain a normalized Cobol code includes: the method comprises the steps of preprocessing an original Cobol code, reading the original Cobol code according to lines, filtering empty lines, and storing the empty lines as a character string list, wherein the preprocessing comprises the steps of detecting file codes of the original Cobol code by using tool software, and using configured default codes if detection fails; annotation filtering processing including identifying annotation lines for filtering deletion; Performing continuous line processing, namely performing continuous line connection processing after identifying continuous line marks, and deleting the continuous line marks; Format normalization processing including case unification processing, indentation specification processing, keyword alignment processing, and sentence splitting processing. According to another embodiment of the present invention, before the partition structure parsing of the standardized Cobol code