A Software Automatic Plate-Chasing Method, Device, Equipment and Readable Storage Medium
By converting and optimizing the AS/400 source code format, generating JAVA source code and splitting and submitting it, the problem that the AS/400 source code cannot be directly applied to distributed architecture is solved, and efficient version updates and cost reduction are achieved.
Patent Information
- Application Number
- CN202111512103.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-07
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2041-12-07
AI Technical Summary
The existing technology cannot effectively apply the source code of IBM AS/400 directly to distributed architectures, resulting in increased risk of system performance and stability, and the use of separate JAVA source code is wasted.
By obtaining the AS/400 source code, converting the format definition file into JAVA's IO and DAO source files, and compiling and generating jar packages, combining RPG-JAVA code conversion, optimizing JAVA source code, and finally splitting the jar package and java source code to submit to the version server.
It realizes that the content of AS/400 software version is automatically added to the distributed system, reducing the process of demand analysis, programming, program development and program testing, shortening the version pursuit cycle, and reducing costs.
Smart Images

Figure CN114237663B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of software update, and more particularly, to a method, apparatus, device and readable storage medium for automatically chasing software versions. Background Art
[0002] Currently, IBM AS / 400 in the market has been in a non-mainstream position, and there are unpredictable risks in the technical development and support of the product itself, resulting in an increased risk coefficient of system performance and stability in the next few years. Moreover, the technical architecture of this product lacks horizontal scalability and is difficult to meet the requirements of high capacity and dynamic resource allocation of bank IT systems in the Internet economy era.
[0003] Developing a distributed architecture can better solve the above problems. However, since the newly updated AS / 400 source code cannot be directly applied to the distributed architecture, and it is extremely wasteful of human resources to separately develop JAVA source code for the same update content. Currently, there is no process method for migrating the version from AS / 400 to a distributed architecture system. Summary of the Invention
[0004] The purpose of the present invention is to provide a method, apparatus, device and readable storage medium for automatically chasing software versions to improve the above problems. To achieve the above purpose, the technical solutions adopted by the present invention are as follows:
[0005] In a first aspect, the present application provides a method for automatically chasing software versions, including:
[0006] Obtain AS / 400 source code;
[0007] Convert the format definition file in the AS / 400 source code to obtain JAVA IO source files and DAO source files, and compile them into a jar package;
[0008] Perform RPG-JAVA code conversion on the code files in the AS / 400 source code to obtain java source code;
[0009] After splitting the jar package and the java source code, submit them to the version server.
[0010] Further, the obtaining of the AS / 400 source code includes:
[0011] Call the FTP tool and set it to UTF-8 encoding format to download the AS / 400 source code;
[0012] Obtain the download status, where the download status includes the status of successful download of the AS / 400 source code or the status of failed download of the AS / 400 source code;
[0013] If the download status is the status where the AS / 400 source code download fails, the AS / 400 source code is obtained using the binary conversion download method.
[0014] Further, obtaining the AS / 400 source code using the binary conversion download method includes:
[0015] Invoking an FTP tool to download the binary file of the AS / 400 source code;
[0016] Transcoding the binary file line by line in the UTF-8 encoding format and obtaining the conversion status of each line of code in the binary file, where the conversion status includes successful conversion or conversion failure;
[0017] After deleting the last character of each line of code with conversion failure, the line of code with conversion failure is the line of code in the binary file where the conversion status is conversion failure;
[0018] Transcoding the binary file line by line in the UTF-8 encoding format to obtain the AS / 400 source code.
[0019] Further, before splitting the jar package and the java source code and submitting them to the version server, it includes:
[0020] Optimizing the java source code to obtain the optimized java source code.
[0021] Further, optimizing the java source code to obtain the optimized java source code includes:
[0022] Loop steps: Encapsulating and compiling the JAVA source code to obtain a compilation log, where the compilation log includes first information, second information, and third information. The first information includes all unused imports in the JAVA source code and the positions corresponding to each unused import. The second information includes all unused variables and the positions corresponding to each unused variable. The third information includes unread variables and the positions corresponding to each unread variable; Optimizing the JAVA source code according to the compilation log to obtain a first sub-optimized JAVA source code;
[0023] Repeatedly execute the loop steps until the compilation log does not include the first information, second information, and third information to obtain a second sub-optimized JAVA source code;
[0024] Formatting the second sub-optimized JAVA source code to obtain a third optimized JAVA source code.
[0025] Further, optimizing the JAVA source code according to the compilation log to obtain a first optimized JAVA source code includes:
[0026] If the compilation log includes unused imports, delete all the unused imports in the JAVA source code according to the compilation log;
[0027] If the compilation log includes unused variables, delete all the unused variables in the JAVA source code according to the compilation log;
[0028] If the compilation log includes unread variables, delete all the unread variables in the JAVA source code according to the compilation log.
[0029] In a second aspect, the present application further provides a software automatic version tracking device, including:
[0030] A first acquisition unit, configured to acquire AS / 400 source code;
[0031] A first transcoding unit, configured to convert the format definition file in the AS / 400 source code to obtain a JAVA IO source file and a DAO source file, and compile them into a jar package;
[0032] A second transcoding unit, configured to perform RPG-JAVA code conversion on the code file in the AS / 400 source code to obtain a java source code;
[0033] A splitting and submitting unit, configured to split the jar package and the java source code and then submit them to a version server.
[0034] Further, the first acquisition unit includes:
[0035] A first calling unit, configured to call an FTP tool and set it to UTF-8 encoding format to download the AS / 400 source code;
[0036] A second acquisition unit, configured to obtain a download status, where the download status includes a status of successful download of the AS / 400 source code or a status of failed download of the AS / 400 source code;
[0037] A first logic unit, configured to, if the download status is a status of failed download of the AS / 400 source code, obtain the AS / 400 source code using a binary conversion download method.
[0038] Further, the first logic unit includes:
[0039] A second calling unit, configured to call an FTP tool to download a binary file of the AS / 400 source code;
[0040] A first sub-transcoding unit, configured to perform UTF-8 encoding format transcoding on the binary file line by line, and obtain the conversion status of each line of code in the binary file, where the conversion status includes successful conversion or failed conversion;
[0041] A first deletion unit, configured to delete the last character of each code line with a failed conversion, where the code line with a failed conversion is a code line in the binary file with a conversion status of failed conversion;
[0042] A second sub-transcoding unit, configured to perform UTF-8 encoding format transcoding on the binary file line by line to obtain the AS / 400 source code.
[0043] Further, it further includes:
[0044] An optimization unit, configured to optimize the java source code to obtain the optimized java source code.
[0045] Further, the optimization unit includes:
[0046] A loop unit, configured to perform a loop of steps: encapsulating and compiling the JAVA source code to obtain a compilation log, where the compilation log includes a first piece of information, a second piece of information, and a third piece of information, the first piece of information includes all unused imports in the JAVA source code and the positions corresponding to each unused import, the second piece of information includes all unused variables and the positions corresponding to each unused variable, and the third piece of information includes unread variables and the positions corresponding to each unread variable; optimizing the JAVA source code according to the compilation log to obtain a first sub-optimized JAVA source code;
[0047] A repetition unit, configured to repeatedly execute the loop steps until the compilation log does not include the first piece of information, the second piece of information, and the third piece of information to obtain a second sub-optimized JAVA source code;
[0048] A formatting unit, configured to perform formatting processing on the second sub-optimized JAVA source code to obtain a third optimized JAVA source code.
[0049] Further, the loop unit includes:
[0050] A second logic unit, configured to, if the compilation log includes unused imports, delete all unused imports in the JAVA source code according to the compilation log;
[0051] A third compilation unit is used for deleting all the unused variables in the JAVA source code according to the compilation log if the compilation log includes unused variables;
[0052] The fourth logic unit is used to delete all the unread variables in the JAVA source code according to the compilation log if the compilation log includes unread variables.
[0053] In a third aspect, the present application also provides a software automatic version tracking device, including:
[0054] Memory for storing computer programs;
[0055] A processor is used to implement the steps of the automatic software version tracking method when executing the computer program.
[0056] In a fourth aspect, the present application further provides a readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned software-based automatic copy tracking method are implemented.
[0057] The beneficial effects of the present invention are:
[0058] The present invention automatically adds the software version update content of AS / 400 to the distributed system through an automated processing mode. Compared with the prior art, the present method reduces the process of demand analysis, program design, program development, program self-testing, and program black box testing for the distributed system. It realizes the synchronous implementation of one version update of two systems, shortens the distributed system's version tracking cycle, reduces the distributed system's version tracking cost, and synchronously updates the distributed system version.
[0059] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or be understood by implementing the embodiments of the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0061] Figure 1 It is a schematic diagram of the process flow of the automatic software copy tracking method described in an embodiment of the present invention;
[0062] Figure 2 Schematic structural diagram of the software automatic version tracking device described in the embodiments of the present invention;
[0063] Figure 3 Schematic structural diagram of the software automatic version tracking device described in the embodiments of the present invention. Specific implementation manners
[0064] To make the objectives, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some but not all of the embodiments of the present invention. The components of the embodiments of the present invention usually described and illustrated in the accompanying drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts fall within the scope of protection of the present invention.
[0065] It should be noted that: similar reference numerals and letters denote similar items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of the present invention, the terms "first", "second", etc. are only used for descriptive distinction and cannot be understood as indicating or implying relative importance.
[0066] At present, the core systems of large and medium-sized domestic banks basically run on the Z series mainframes and AS / 400 series minicomputers of IBM Corporation, and their technologies are relatively closed.
[0067] From the market perspective, IBM AS / 400 has already been in a non-mainstream position, and there are unpredictable risks in the technical development and support of the product itself, resulting in an increased risk coefficient of the performance and stability of the system in the next few years. On the other hand, the technical architecture of this product lacks horizontal scalability and is difficult to meet the requirements of high capacity and dynamic resource allocation of bank IT systems in the Internet economy era.
[0068] In order to gradually get rid of the dependence on foreign commercial products and enhance the technical support ability in Internet finance, and to achieve the goal of not changing the application functions, the current research direction is to develop a distributed architecture. However, since the newly updated AS / 400 source code cannot be directly applied to the distributed architecture, and at the same time, it is extremely wasteful of human resources to develop JAVA source code separately for the same updated content, so the present invention is mainly a process method implemented to complete the version migration of the bank core system from AS / 400 to a distributed system.
[0069] Embodiment 1:
[0070] This embodiment provides a software automatic version tracking method.
[0071] Refer to Figure 1 , which shows that this method includes step S100, step S200, step S300, step S400, step S500 and step S600.
[0072] S100. Obtain the AS / 400 source code;
[0073] It should be noted that for new business requirements, the modified programs are determined during the testing phase. The AS / 400 source program can be automatically downloaded according to the program list. The source program is downloaded using FTP. Since the AS / 400 source program is in EBCDIC code system, while the distributed systems generally developed based on JAVA are in UTF-8 or GBK code system, the source program needs to be transcoded. Therefore, this step includes steps S110, S120 and S130 to solve the problem.
[0074] S110. Call the FTP tool and set it to UTF-8 encoding format to download the AS / 400 source code;
[0075] S120. Obtain the download status, where the download status includes the status of successful download of the AS / 400 source code or the status of failed download of the AS / 400 source code;
[0076] S130. If the download status is the status of failed download of the AS / 400 source code, obtain the AS / 400 source code using the binary conversion download method.
[0077] It should be noted that the FTP tool class can automatically transcode, but in the actual download process, it is found that some code files fail to download. After analysis, it is caused by garbled characters, and the garbled characters are all in the last digit. Therefore, during the transcoding process of the FTP tool, there may be a situation of transcoding failure. So step S130 also includes steps S131, S132, S133 and S134 to process the AS / 400 source code with transcoding failure.
[0078] S131. Use the FTP tool to download the binary file of the AS / 400 source code;
[0079] S132. Transcode the binary file line by line into UTF-8 encoding format and obtain the conversion status of each line of code in the binary file. The conversion status includes successful conversion or failed conversion;
[0080] S133. After deleting the last character of each line of the conversion failure code, the line of the conversion failure code is the line of the code in the binary file whose conversion status is conversion failure;
[0081] S134. Transcode the binary file line by line in UTF-8 encoding format to obtain the AS / 400 source code.
[0082] It should be noted that since not all code lines have the problem of garbled characters in the last digit during the transcoding process, different operations are performed on different code lines in this step. For the code lines with correct transcoding, the original state remains unchanged, and only the code lines with conversion errors are modified. This shortens the version tracking cycle of this method and reduces the update cost of the distributed system.
[0083] S200. Preprocess the suffix name of the AS / 400 source code;
[0084] Specifically, this step includes step S210, step S220, step S230, step S240, step S250, and step S260.
[0085] S210. Add the suffix name.RPGLE to the RPGLE files in the AS / 400 source code;
[0086] S220. Add the suffix name.H to the header files in the AS / 400 source code;
[0087] S230. Add the suffix name.IO to the IO interface files in the AS / 400 source code;
[0088] S240. Add the suffix name.copy to the COPY files in the AS / 400 source code;
[0089] S250. Add the suffix name.PF to the physical files in the AS / 400 source code;
[0090] S260. Add the suffix name.LF to the logical files in the AS / 400 source code;
[0091] It should be noted that through the processing of S200, the AS / 400 source code files can be conveniently divided into code classes and format definition classes. Among them, the format definition classes are the files with the suffix names.IO,.PF, and.LF; the code classes are the files with the suffix names.RPGLE,.H, and.copy. Through the above processing, it is convenient for subsequent processing.
[0092] S300. Convert the format definition file in the AS / 400 source code to obtain the JAVA IO source file and DAO source file, and compile them into a jar package;
[0093] It should be noted that converting the format definition file in the AS / 400 source code to obtain the JAVA IO source file and DAO source file, and compiling them into a jar package are common knowledge in the art, so they will not be elaborated in this application.
[0094] At the same time, it should be noted that by pre-processing the format definition file in this step, it is convenient for subsequent code conversion steps. And for the IO interfaces, physical files, and logical files in the AS / 400 code, the most common practice in the prior art is to parse and extract information such as field names, types, and lengths in the files and then save them in the database for subsequent code conversion. However, this method directly converts the IO interfaces, physical files, and logical files into JAVA IO interface classes and DAO classes. There are two reasons for adopting this method:
[0095] (1) If its data structure is saved in the database, it depends on the database, increasing the complexity of the conversion process.
[0096] (2) In the subsequent step (S600), when compiling the converted code, it depends on the IO classes and DAO classes. Therefore, generating the IO classes and DAO classes in this step can not only meet the needs of conversion but also meet the needs of compilation.
[0097] S400. Perform RPG-JAVA code conversion on the code file in the AS / 400 source code to obtain the java source code;
[0098] It should be noted that the RPG-JAVA code conversion in this step is a prior art. For details, please refer to the previous application (Application No.: CN201910673794.0), which will not be elaborated in this application.
[0099] S500. Optimize the AS / 400 source code to obtain the optimized AS / 400 source code.
[0100] It should be noted that although the source code generated by the RPG-JAVA automatic conversion technology is complete code, there will be some variable reference problems in the conversion between the two types of code, and further optimization is still needed to make the code more elegant and reduce some useless variables and useless import problems.
[0101] Specifically, this step includes step S510, step S520, and step S530.
[0102] S510. Loop step: Package and compile the JAVA source code to obtain a compilation log, which includes first information, second information, and third information. The first information includes all unused imports in the JAVA source code and the corresponding positions of each unused import. The second information includes all unused variables and the corresponding positions of each unused variable. The third information includes unread variables and the corresponding positions of each unread variable. Optimize the JAVA source code according to the compilation log to obtain a first sub-optimized JAVA source code.
[0103] S520. Repeat the loop step until the compilation log does not include the first information, second information, and third information, to obtain a second sub-optimized JAVA source code.
[0104] It should be noted that in step S510, after deleting the unused variables or unread variables, new unused imports may be introduced. Therefore, it is necessary to re-optimize the imports to achieve the purpose of improving the beauty of the JAVA source code.
[0105] S530. Format the second sub-optimized JAVA source code to obtain a third optimized JAVA source code.
[0106] It should be noted that code formatting is common knowledge in this field, and those skilled in the art do not need to compile. They can use the class CodeFormatter in eclipse to handle it.
[0107] It also needs to be noted that the main optimization points in step S500 include three: 1. Re-organize imports; 2. Format the code; 3. Remove unused variables and unread variables. For manual development, general IDEs support re-organizing and formatting imports through manual commands or shortcut keys. However, for an automated process, if these generated source codes are processed one by one manually, it is time-consuming and laborious. But if no optimization is done, the code does not look so beautiful in form. First, for import reorganization, it is difficult to process and optimize through static scanning and requires dynamic compilation. Therefore, in this step, optimization analysis and processing are carried out based on the results of the compilation process.
[0108] Specifically, step S510 also includes step S511, step S512, and step S513.
[0109] S511. If the compilation log includes unused imports, delete all unused imports in the JAVA source code according to the compilation log.
[0110] It should be noted that in the step, deleting all unused imports in the JAVA source code means deleting the unused import statements according to the log information to make the source code concise;
[0111] S512. If the compilation log includes unread variables, delete all unused variables in the JAVA source code according to the compilation log;
[0112] It should be noted that this step is similar to S511, and both can be directly deleted.
[0113] S513. If the compilation log includes unused variables, delete all unread variables in the JAVA source code according to the compilation log.
[0114] It should be noted that since the unread variable means that the variable has been assigned a value in the program but is not actually used, this scenario cannot be directly deleted. Because if the variable is directly deleted, a compilation error will occur because the variable has been assigned a value in the program. Therefore, the statement dpmsta01 = new Dpmsta() also needs to be deleted. At the same time, it should be noted that the variable may not be newly created but may be the return value of other methods. Deleting the entire statement will affect the program's functionality.
[0115] So for unread variables, in this embodiment, the following steps are included:
[0116] S5131. Sequentially determine whether the assignment form of all unread variables in the JAVA source code is the return value of a method. If the assignment form of the unread variable is the return value of a method, delete the unread variable. If the assignment form of the unread variable is not the return value of a method, delete the code line where the unread variable is located.
[0117] The following are two examples for illustration:
[0118] Example 1:
[0119] / / Declare a variable
[0120] private Dpmsta dpmsta01;
[0121] / / Assign a value to the variable
[0122] dpmsta01 = new Dpmsta();
[0123] For the above scenario, if the variable is deleted, a compilation error will occur because the variable has been assigned a value in the program. Therefore, the statement dpmsta01 = new Dpmsta() also needs to be deleted.
[0124] Since variables are not created and may be the return values of other methods, deleting the entire statement will affect the program's functionality.
[0125] Example 2:
[0126] For example, the following statement returns a variable isExistData after executing a query:
[0127] / / Declare a variable
[0128] private boolean isExistData;
[0129] / / Assign a value to the variable
[0130] isExistData = dpmsta02.select();
[0131] For this scenario, only the variable on the left side of the equal sign needs to be deleted (leaving dpmsta02.select()), and the entire statement cannot be deleted.
[0132] S600. Compile the jar package and JAVA source code for pre-compilation.
[0133] It should be noted that this step is an optional step, that is, to compile the jar package and JAVA source code in advance and output a pre-compilation log; by judging whether there is a program with compilation failure in the compilation log. Those skilled in the art can know from the pre-compilation log which reasons in the jar package or JAVA source code cause the compilation in this version update, so as to reduce the problems brought by update failures. It is also convenient to solve the problems before actual problems occur.
[0134] S700. After splitting the jar package and java source code, submit them to the version server.
[0135] It can be understood that the splitting mentioned in this step refers to splitting using the component factory method. In the traditional component program call method, the code for Program A to call Program B is:
[0136] / / First create a B object, and then call the method of b
[0137] B b = new B();
[0138] b.process();
[0139] While using the component factory method, the code for Program A to call Program B is:
[0140] ComponentFactoryUtils.createComponent("B").process();
[0141] Through comparison in two ways, it can be seen that the A component program depends on B and needs to import the B class. While adopting the component factory method, there is no need to introduce the B class. Just passing in the name B is enough, and the component factory container controls the life cycle of B. Adopting this method can achieve the decoupling of component calls, through the structure between component programs, so that the monolithic application can be split into different projects, laying a good foundation for the development of distributed applications.
[0142] To sum up, in this method, the content update of the software version of IBM AS / 400 is automatically appended to the distributed system. Compared with the existing technology, this method reduces the processes of requirements analysis, program design, program development, program self-testing, and program black box testing for the distributed system. It has the characteristics of realizing the simultaneous update of two systems with one version update, shortening the version chasing cycle of the distributed system, reducing the cost of version chasing of the distributed system, and synchronously updating the version of the distributed system.
[0143] Embodiment 2:
[0144] As Figure 2 shown, this embodiment provides a software automatic version chasing device, which includes:
[0145] The first acquisition unit 1 is used to acquire the AS / 400 source code;
[0146] The preprocessing unit 2 is used to preprocess the suffix name of the AS / 400 source code;
[0147] The first transcoding unit 3 is used to convert the format definition file in the AS / 400 source code to obtain the JAVA IO source file and DAO source file, and compile them into a jar package;
[0148] The second transcoding unit 4 is used to perform RPG-JAVA code conversion on the code file in the AS / 400 source code to obtain the java source code;
[0149] The optimization unit 5 is used to optimize the java source code to obtain the optimized java source code;
[0150] The pre-compilation unit 6 is used to perform pre-compilation on the jar package and the JAVA source code;
[0151] The splitting and submission unit 7 is used to split the jar package and the java source code and then submit them to the version server.
[0152] Optionally, the first acquisition unit 1 includes:
[0153] The first calling unit 11 is used to call the FTP tool, set it to the UTF-8 encoding format, and download the AS / 400 source code;
[0154] The second obtaining unit 12 is used to obtain the download status, where the download status includes the status of successful download of the AS / 400 source code or the status of failed download of the AS / 400 source code;
[0155] The first logic unit 13 is used to, if the download status is the status of failed download of the AS / 400 source code, obtain the AS / 400 source code using the binary conversion download method.
[0156] Optionally, the first logic unit 13 includes:
[0157] The second calling unit 131 is used to call the FTP tool to download the binary file of the AS / 400 source code;
[0158] The first sub-transcoding unit 132 is used to perform UTF-8 encoding format transcoding on the binary file line by line and obtain the conversion status of each line of code in the binary file, where the conversion status includes successful conversion or failed conversion;
[0159] The first deletion unit 133 is used to delete the last character of each line of code with a failed conversion, where the line of code with a failed conversion is the line of code in the binary file with a conversion status of failed conversion;
[0160] The second sub-transcoding unit 134 is used to perform UTF-8 encoding format transcoding on the binary file line by line to obtain the AS / 400 source code.
[0161] Optionally, the optimization unit 5 includes:
[0162] The loop unit 51 is used to loop through the steps: encapsulate and compile the JAVA source code to obtain a compilation log, where the compilation log includes the first information, the second information, and the third information. The first information includes all unused imports in the JAVA source code and the corresponding positions of each unused import, the second information includes all unused variables and the corresponding positions of each unused variable, and the third information includes unread variables and the corresponding positions of each unread variable; optimize the JAVA source code according to the compilation log to obtain the first sub-optimized JAVA source code;
[0163] The repetition unit 52 is used to repeatedly execute the loop steps until the compilation log does not include the first information, the second information, and the third information to obtain the second sub-optimized JAVA source code;
[0164] Formatting unit 53, configured to format the second sub-optimized JAVA source code to obtain the third optimized JAVA source code.
[0165] Optionally, the loop unit 51 includes:
[0166] A second logic unit 511, configured to, if the compilation log includes unused imports, delete all unused imports in the JAVA source code according to the compilation log;
[0167] A third logic unit 512, configured to, if the compilation log includes unread variables, delete all unused variables in the JAVA source code according to the compilation log;
[0168] A fourth logic unit 513, configured to, if the compilation log includes unused variables, delete all unread variables in the JAVA source code according to the compilation log.
[0169] Optionally, the fourth logic unit 513 includes:
[0170] A fifth logic unit 5131, configured to sequentially determine whether the assignment form of all unread variables in the JAVA source code is a method return value. If the assignment form of the unread variable is a method return value, delete the unread variable. If the assignment form of the unread variable is not a method return value, delete the code line where the unread variable is located.
[0171] It should be noted that for the device in the above embodiments, the specific manners in which each module performs operations have been described in detail in the embodiments related to the method, and will not be elaborated herein.
[0172] Embodiment 3:
[0173] Corresponding to the above method embodiment, a software automatic version tracking device is also provided in this embodiment. A software automatic version tracking device described below can be mutually corresponding and referred to with a software automatic version tracking method described above.
[0174] Figure 3 It is a block diagram of a software automatic version tracking device 800 shown according to an exemplary embodiment. As Figure 3 shown, the software automatic version tracking device 800 may include: a processor 801, a memory 802. The software automatic version tracking device 800 may further include one or more of a multimedia component 803, an input / output (I / O) interface 804, and a communication component 805.
[0175] Among them, the processor 801 is used to control the overall operation of the software automatic version chasing device 800 to complete all or part of the steps in the above software automatic version chasing method. The memory 802 is used to store various types of data to support the operation of the software automatic version chasing device 800. These data may include, for example, instructions for any application or method operating on the software automatic version chasing device 800, as well as application-related data, such as contact data, sent and received messages, pictures, audio, video, and so on. The memory 802 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic memory, flash memory, magnetic disk or optical disc. The multimedia component 803 may include a screen and an audio component. The screen can be, for example, a touch screen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone, and the microphone is used to receive external audio signals. The received audio signals can be further stored in the memory 802 or sent through the communication component 805. The audio component also includes at least one speaker for outputting audio signals. The I / O interface 804 provides an interface between the processor 801 and other interface modules, and the above other interface modules can be a keyboard, a mouse, buttons, etc. These buttons can be virtual buttons or physical buttons. The communication component 805 is used for wired or wireless communication between the software automatic version chasing device 800 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G or 4G, or a combination of one or more of them. Accordingly, the communication component 805 may include: a Wi-Fi module, a Bluetooth module, an NFC module.
[0176] In an exemplary embodiment, the software automatic version tracking device 800 can be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components, and is used to execute the above-mentioned software automatic version tracking method.
[0177] In another exemplary embodiment, a computer-readable storage medium including program instructions is further provided. When the program instructions are executed by a processor, the steps of the above-mentioned software automatic version tracking method are implemented. For example, the computer-readable storage medium can be the above-mentioned memory 802 including program instructions, and the above-mentioned program instructions can be executed by the processor 801 of the software automatic version tracking device 800 to complete the above-mentioned software automatic version tracking method.
[0178] Embodiment 4:
[0179] Corresponding to the above method embodiment, a readable storage medium is further provided in this embodiment. A readable storage medium described below can be correspondingly referred to with a software automatic version tracking method described above.
[0180] A readable storage medium stores a computer program. When the computer program is executed by a processor, the steps of the software automatic version tracking method in the above method embodiment are implemented.
[0181] Specifically, the readable storage medium can be various readable storage media such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disc that can store program codes.
[0182] The above are only the preferred embodiments of the present invention and are not used to limit the present invention. For those skilled in the art, various changes and modifications can be made to the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
[0183] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention can easily think of changes or substitutions, which should all be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. A software automatic version tracking method, characterized in that, Including: Obtain AS / 400 source code; Convert the format definition file in the AS / 400 source code to obtain JAVA IO source file and DAO source file, and compile them into a jar package; Perform RPG-JAVA code conversion on the code file in the AS / 400 source code to obtain java source code; After splitting the jar package and the java source code, submit them to the version server; The obtaining of the AS / 400 source code includes: Call the FTP tool and set it to UTF-8 encoding format to download the AS / 400 source code; Obtain the download status, where the download status includes the status of successful download of the AS / 400 source code or the status of failed download of the AS / 400 source code; If the download status is the status of failed download of the AS / 400 source code, obtain the AS / 400 source code using the binary conversion download method; The obtaining of the AS / 400 source code using the binary conversion download method includes: Call the FTP tool to download the binary file of the AS / 400 source code; Transcode each line of the binary file to UTF-8 encoding format and obtain the conversion status of each line of code in the binary file, where the conversion status includes successful conversion or failed conversion; After deleting the last character of each line of code with conversion failure, the line of code with conversion failure is the line of code in the binary file with the conversion status of conversion failure; Transcode each line of the binary file to UTF-8 encoding format to obtain the AS / 400 source code.
2. The software automatic version tracking method according to claim 1, wherein Before splitting the jar package and the java source code and submitting them to the version server, including: Optimize the java source code to obtain the optimized java source code.
3. The software automatic version tracking method according to claim 2, wherein, The optimizing of the java source code to obtain the optimized java source code includes: Loop step: Package and compile the JAVA source code to obtain a compilation log, where the compilation log includes the first information, the second information, and the third information. The first information includes all unused imports in the JAVA source code and the corresponding positions of each unused import. The second information includes all unused variables and the corresponding positions of each unused variable. The third information includes unread variables and the corresponding positions of each unread variable; Optimize the JAVA source code according to the compilation log to obtain the first sub-optimized JAVA source code; Repeat the loop step until the compilation log does not include the first information, the second information, and the third information to obtain the second sub-optimized JAVA source code; Format the second sub-optimized JAVA source code to obtain the third optimized JAVA source code.
4. The software automatic version tracking method according to claim 3, wherein The optimizing of the JAVA source code according to the compilation log to obtain the first optimized JAVA source code includes: If the compilation log includes unused imports, delete all the unused imports in the JAVA source code according to the compilation log; If the compilation log includes unused variables, delete all the unused variables in the JAVA source code according to the compilation log; If the compilation log includes unread variables, delete all the unread variables in the JAVA source code according to the compilation log.
5. A software automatic version tracking device, characterized in that, It includes: A first acquisition unit for acquiring AS / 400 source code; A first transcoding unit for converting the format definition file in the AS / 400 source code to obtain JAVA's IO source file and DAO source file, and compiling them into a jar package; A second transcoding unit for performing RPG-JAVA code conversion on the code file in the AS / 400 source code to obtain java source code; A splitting and submission unit for splitting the jar package and the java source code and submitting them to the version server; The first acquisition unit includes: A first calling unit for calling an FTP tool and setting it to UTF-8 encoding format to download the AS / 400 source code; A second acquisition unit for acquiring the download status, where the download status includes the status of successful download of the AS / 400 source code or the status of failed download of the AS / 400 source code; A first logic unit for, if the download status is the status of failed download of the AS / 400 source code, obtaining the AS / 400 source code using a binary conversion download method; The first logic unit includes: A second calling unit for calling an FTP tool to download the binary file of the AS / 400 source code; A first sub-transcoding unit for transcoding the binary file line by line into UTF-8 encoding format and obtaining the conversion status of each line of code in the binary file, where the conversion status includes successful conversion or failed conversion; A first deletion unit for deleting the last character of each line of code with conversion failure, where the line of code with conversion failure is the line of code in the binary file with the conversion status of failed conversion; A second sub-transcoding unit for transcoding the binary file line by line into UTF-8 encoding format to obtain the AS / 400 source code.
6. The software automatic version chasing device according to claim 5, characterized in that, It also includes: An optimization unit for optimizing the java source code to obtain the optimized java source code.
7. The software automatic version chasing device according to claim 6, wherein The optimization unit includes: A loop unit for looping through the steps of encapsulating and compiling the JAVA source code to obtain a compilation log, the compilation log including first information, second information, and third information. The first information includes all unused imports in the JAVA source code and the positions corresponding to each of the unused imports. The second information includes all unused variables and the positions corresponding to each of the unused variables. The third information includes unread variables and the positions corresponding to each of the unread variables. Optimize the JAVA source code according to the compilation log to obtain a first sub-optimized JAVA source code. A repetition unit for repeatedly executing the loop steps until the compilation log does not include the first information, second information, and third information, to obtain a second sub-optimized JAVA source code. A formatting unit for formatting the second sub-optimized JAVA source code to obtain a third optimized JAVA source code.
8. The software automatic version tracking device according to claim 7, characterized in that The loop unit includes: A second logic unit for deleting all unused imports in the JAVA source code according to the compilation log if the compilation log includes unused imports. A third logic unit for deleting all unused variables in the JAVA source code according to the compilation log if the compilation log includes unused variables. A fourth logic unit for deleting all unread variables in the JAVA source code according to the compilation log if the compilation log includes unread variables.
9. A software automatic version tracking device, characterized in that, Includes: A memory for storing computer programs. A processor for implementing the steps of the software automatic version tracking method according to any one of claims 1 to 4 when executing the computer program.
10. A readable storage medium, characterized in that: A computer program is stored on the readable storage medium, and when the computer program is executed by the processor, the steps of the software automatic version tracking method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
A method for automatically converting RPG programs into JAVA programs
CN110879710B
Method for automatically converting RPG program into JAVA program
CN110879710A
File conversion method and device and storage medium
CN112416365A