CN106775854B - Method and device for generating configuration file - Google Patents

Method and device for generating configuration file Download PDF

Info

Publication number
CN106775854B
CN106775854B CN201611110400.3A CN201611110400A CN106775854B CN 106775854 B CN106775854 B CN 106775854B CN 201611110400 A CN201611110400 A CN 201611110400A CN 106775854 B CN106775854 B CN 106775854B
Authority
CN
China
Prior art keywords
input data
ctf
data item
current
entry
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201611110400.3A
Other languages
Chinese (zh)
Other versions
CN106775854A (en
Inventor
王倩
邢蕴婷
范啸风
段锋
孙郑
叶棋标
申世哲
李鹏芳
宋洁
裘丰
周建胜
徐彦斌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Bank of China Ltd
Original Assignee
Bank of China Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Bank of China Ltd filed Critical Bank of China Ltd
Priority to CN201611110400.3A priority Critical patent/CN106775854B/en
Publication of CN106775854A publication Critical patent/CN106775854A/en
Application granted granted Critical
Publication of CN106775854B publication Critical patent/CN106775854B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • G06F9/4451User profiles; Roaming

Abstract

The embodiment of the invention discloses a method for generating a configuration file, which comprises the following steps: the method comprises the steps of obtaining input data items of all transactions related to the CTF as input data items to be defined, selecting an undefined input data item from the input data items to be defined as a current input data item, comparing the current input data item with a current redefined input data item, judging whether the current input data item needs to be redefined or a new CTF table item needs to be normally defined, and generating a COPYBOOK file based on the definition of the created CTF table item after all the input data items to be defined are defined as the CTF table items. In the embodiment of the application, the input data items which can be redefined to the same CTF table entry can be automatically identified, so that the workload of manual operation is simplified, and the accuracy of redefining the CTF table entry is improved.

Description

Method and device for generating configuration file
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a method and an apparatus for generating a configuration file.
Background
In some computer systems, it is often necessary to configure entries of certain data tables using configuration files. For example, in an application system using an Open Transaction Control Platform (OTCP), a copy book file is required to configure a Common Transaction format table (CTF). Specifically, the CTF is used to record transaction information, and each transaction may involve information of one or more input data items, and therefore, when generating the COPYBOOK file, it is necessary to define the CTF entries as the input data items so that the input data items indicated by each CTF entry are recorded in the COPYBOOK file. Thus, the generated COPYBOOK file can be used to configure the CTF.
It should be noted that, in an application system, each CTF entry occupies a certain memory area. In order to reduce the memory occupation, for a plurality of input data items of the same data type, if the data input items belong to different transactions respectively, the data input items may share the same CTF entry, that is, the same CTF entry may be redefined into a plurality of input data items for a plurality of different transactions, so that the plurality of input data items may share the same memory area, and the memory occupation may be reduced.
In the prior art, in order to minimize the memory occupation of the CTF entries, it is necessary to manually find out which input data entries can be redefined into the same CTF entry and manually write the same CTF entry into the copy book file. However, in general, CTFs need to record information for a large number of transactions, which may involve a large number of input data items. Therefore, the copy book file with redefined CTF entries is generated by manual searching and manual writing, which not only makes manual work huge, but also makes it difficult to guarantee the accuracy of redefined CTF entries.
Disclosure of Invention
The technical problem to be solved by the embodiments of the present application is to provide a method and an apparatus for generating a configuration file, so that input data items that can be redefined to the same CTF entry can be automatically identified, thereby simplifying manual work and improving the accuracy of redefining the CTF entry.
In a first aspect, to solve the above technical problem, the present invention provides a method for generating a configuration file, including:
responding to a generation instruction of the COPYBOOK file, and acquiring input data items of all transactions related to the CTF as input data items to be defined; the COPYBOOK is used for configuring the CTF;
selecting an undefined input data item from the input data items to be defined as a current input data item;
if the current input data item meets a first preset condition, redefining the current CTF table item to enable the definition of the current CTF table item to contain the current input data item, and returning to select an undefined input data item from the input data items to be defined;
if the current input data item meets a second preset condition, creating a CTF table entry in the COPYBOOK file to be used as the current CTF table entry again, defining the current CTF table entry so that the definition of the current CTF table entry comprises the current input data item, and returning to select an undefined input data item from the input data items to be defined;
in response to that all the input data items to be defined are defined as created CTF entries, generating the COPYBOOK file based on the definition of the created CTF entries;
wherein the first predetermined condition is: the data type of the current input data item is the same as that of the current redefined input data item, the identification (name) of the current input data item is not the same as that of any one of the current redefined input data items, and the current input data item and any one of the current redefined input data items do not belong to the same transaction (number); the current redefined input data item is an input data item already existing in the definition of the current CTF entry;
the second predetermined condition includes: the current input data item does not satisfy the first predetermined condition and the identity of the current input data item does not belong to the identity of any one of the defined input data items.
Optionally, the obtaining, in response to the generation instruction of the copy book file, input data items of all transactions related to the CTF as input data items to be defined includes:
acquiring the identification of the CTF in response to the generation instruction;
searching an input data item corresponding to the identifier of the CTF in an application input data item table to serve as the input data item to be defined;
and recording mapping relations among the CTF, the transaction and the input data items in the application input data item table, wherein the mapping relations comprise the identification of the CTF, the identification of the transaction, the identification of the input data items and the data types of the input data items.
Optionally, the method further includes:
and judging whether the identification of each input data item in the application input data item table and the data type have a preset corresponding relationship, if so, selecting an undefined input data item from the input data items to be defined.
Optionally, the determining whether there is a preset corresponding relationship between the identifier of each input data item in the application input data item table and the data type specifically includes:
judging whether the identification of each input data item in the application input data item table and the data type have a corresponding relation in a preset data dictionary or not;
and the data dictionary is used for recording the corresponding relation between the same input data item and the identification and the data type.
Optionally, the method further includes:
and judging whether transactions corresponding to a plurality of input data items with the same identification exist in the application input data item table, and if not, executing the selection of an undefined input data item from the input data items to be defined.
Optionally, the COPYBOOK file includes a file header of the COPYBOOK, a definition of the created CTF entry, and a padding entry of the COPYBOOK, where a length of the padding entry is a difference between a preset maximum CTF length and a total length of the created CTF entry.
Optionally, after creating a CTF entry in the copy book file as the current CTF entry again, the method further includes:
calculating the total length of the CTF table entry which is created currently;
and generating and feeding back prompt information in response to that the total length of the currently created CTF table entry exceeds a preset length threshold, wherein the prompt information is used for prompting that the total length of the currently created CTF table entry exceeds the limit.
In a second aspect, to solve the above technical problem, the present invention provides an apparatus for generating a configuration file, including:
the acquiring unit is used for responding to a generation instruction of the COPYBOOK file, and acquiring input data items of all transactions related to the CTF as input data items to be defined; the COPYBOOK is used for configuring the CTF;
the selection unit is used for selecting an undefined input data item from the input data items to be defined as a current input data item;
a redefining unit, configured to redefine a current CTF entry if the current input data item satisfies a first predetermined condition, so that the definition of the current CTF entry includes the current input data item, and return to trigger the selecting unit;
a defining unit, configured to create a CTF entry in the copy book file as a current CTF entry if the current input data entry meets a second predetermined condition, define the current CTF entry so that the definition of the current CTF entry includes the current input data entry, and return to trigger the selecting unit;
a generating unit, configured to generate the COPYBOOK file based on the definition of the created CTF entry in response to that all of the input data items to be defined have been defined as the created CTF entry;
wherein the first predetermined condition is: the data type of the current input data item is the same as that of the current redefined input data item, the identification of the current input data item is not the same as that of any one of the current redefined input data items, and the current input data item and any one of the current redefined input data items do not belong to the same transaction; the current redefined input data item is an input data item already existing in the definition of the current CTF entry;
the second predetermined condition includes: the current input data item does not satisfy the first predetermined condition and the identity of the current input data item does not belong to the identity of any one of the defined input data items.
Optionally, the obtaining unit includes:
an obtaining subunit, configured to obtain, in response to the generation instruction, an identifier of the CTF;
a searching subunit, configured to search, in an application input data item table, an input data item corresponding to the identifier of the CTF, as the input data item to be defined;
and recording mapping relations among the CTF, the transaction and the input data items in the application input data item table, wherein the mapping relations comprise the identification of the CTF, the identification of the transaction, the identification of the input data items and the data types of the input data items.
Optionally, the method further includes:
the first judgment unit is used for judging whether the self identification of each input data item in the application input data item table and the data type have a preset corresponding relationship or not;
and the first triggering unit is used for triggering the selecting unit under the condition that the judgment result of the first judging unit is yes.
Optionally, the first determining unit is specifically configured to:
judging whether the identification of each input data item in the application input data item table and the data type have a corresponding relation in a preset data dictionary or not;
and the data dictionary is used for recording the corresponding relation between the same input data item and the identification and the data type.
Optionally, the method further includes:
a second judgment unit operable to judge whether there is a transaction corresponding to a plurality of input data items having the same identification in the application input data item table;
and the second triggering unit is used for triggering the selecting unit under the condition that the judgment result of the second judging unit is negative.
Optionally, the COPYBOOK file includes a file header of the COPYBOOK, a definition of the created CTF entry, and a padding entry of the COPYBOOK, where a length of the padding entry is a difference between a preset maximum CTF length and a total length of the created CTF entry.
Optionally, the method further includes:
a calculating unit, configured to calculate a total length of a currently created CTF entry after creating a CTF entry in the copy book file of the defining unit and taking the CTF entry as a current CTF entry again;
and a prompting unit, configured to generate and feed back prompt information in response to that a total length of the currently created CTF entry exceeds a preset length threshold, where the prompt information is used to prompt that the total length of the currently created CTF entry has exceeded a limit.
In the embodiment of the application, when a generation instruction of the copy book file is responded, for the acquired input data items to be defined, undefined input data items are sequentially selected to define the CTF entries. For a current input data item, it is redefined to an already created CTF entry if it satisfies a first predetermined condition and defined as a newly created CTF entry if it satisfies a second predetermined condition. Wherein the first predetermined condition is: the data type of the current input data item is the same as the data type of the input data item existing in the definition of the created CTF table entry, the identification of the current input data item is different from the input data item existing in any one of the definitions of the created CTF table entry, and the identification of the current input data item and the input data item existing in any one of the definitions of the created CTF table entry do not belong to the same transaction. The second predetermined condition is: the current input data item does not satisfy the first predetermined condition and the identification of the current input data item does not belong to the identification of any one defined input data item. After all input data items to be defined have been defined as the created CTF entries, the COPYBOOK file is generated based on the definitions of the created CTF entries. It can be seen that in the embodiment of the present application, the input data items that can be redefined to the same CTF entry can be automatically identified, which not only simplifies the workload of manual operation, but also improves the accuracy of redefining the CTF entry.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments described in the present application, and other drawings can be obtained by those skilled in the art according to the drawings.
FIG. 1 is a flowchart illustrating a method for generating a configuration file according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a method for generating a configuration file according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of an apparatus for generating a configuration file according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The inventor has found through research that, in the prior art, a CTF records information of one or more input data items of multiple transactions, each CTF occupies a certain memory space, and in order to reduce the occupation of the memory space, a plurality of input data items belonging to different transactions but having the same data type can be redefined into the same CTF entry, so that the memory space occupied by the CTF entry is reduced, but at present, when redefining the CTF entry, a copy book file having redefined CTF entries is generated by manually searching the input data items and manually writing, and manual operation is not only huge in workload, but also the redefinition accuracy is difficult to guarantee.
For example, two input data items are contained in a CTF, wherein one input data item has a data type a and belongs to transaction 1, and the other input data item has a data type a and belongs to transaction 2, and when the two input data items satisfy the redefining condition, the two input data items are redefined into a CTF table entry, and the redefined CTF table entry contains the two input data items.
Based on this, in the embodiment of the present invention, a method for generating a configuration file is provided, in which an undefined input data item is selected to define a CTF entry, and if a first predetermined condition is satisfied, the currently selected input data item is redefined into a created CTF entry, and if a second predetermined condition is satisfied, the currently selected input data item is defined as a newly created CTF entry; wherein the first predetermined condition is: the data type of the current input data item is the same as the data type of the input data item existing in the definition of the created CTF table entry, the identification of the current input data item is different from the input data item existing in any one definition of the created CTF table entry, and the identification of the current input data item and the input data item existing in any one definition of the created CTF table entry do not belong to the same transaction; the second preset condition is as follows: the current data entry does not satisfy the first predetermined condition and the identification of the current entry does not belong to the identification of any one of the defined entries. After the identifications of all the input data items to be defined have been defined as the created CTF entries, the COPYBOOK file is generated based on the definitions of the created CTF entries. Therefore, the input data items of the CTF table entry are automatically identified and the CTF table entry is automatically redefined in the embodiment of the invention, so that the workload of manual operation is simplified, and the accuracy of redefining the CTF table entry is improved.
The following describes a specific implementation manner of a method and an apparatus for generating a configuration file according to an embodiment of the present invention in detail by using an embodiment with reference to the accompanying drawings.
Exemplary method
Referring to fig. 1, a flowchart of a method for generating a configuration file in an embodiment of the present invention is shown. In this embodiment, the method may include the steps of:
step 101: responding to a generation instruction of the COPYBOOK file, and acquiring input data items of all transactions related to the CTF as input data items to be defined; the COPYBOOK is used for configuring the CTF.
In some embodiments of this embodiment, the input data items involved in each transaction may be recorded in an application input data item table, and each time the copy book file needs to be generated, the corresponding input item to be defined may be searched and obtained from the application input data item table. Specifically, step 101 may include, for example: acquiring the identification of the CTF in response to the generation instruction; and searching an input data item corresponding to the identification of the CTF in an application input data item table to serve as the input data item to be defined.
And the mapping relation among the CTF, the transaction and the input data items is recorded in the application input data item table. For example, the mapping may include an identification of the CTF, a transaction identification, an identification of the input data item, and a data type of the input data item.
When step 101 is implemented by using an embodiment of setting an application input data item table, an input data item of an application may be imported into the application input data item table, and in the process of generating a configuration file, an input data item corresponding to a specified CTF needs to be read from the application input data item table first. Wherein, the input data item corresponding to each transaction in the application input data item table may include: CTF identification, transaction identification, identification of the input data item, data type of the input data item. Wherein, the CTF is used for distinguishing the transaction in the application system. One or more CTF identities may be defined corresponding to an application, where each CTF identity may in turn correspond to multiple transactions. Besides, the application input data item table may further include a sequence number of an input data item. The entry data item sequence number is used to order the transactions, and the entry data item sequence number is incremented from 1.
It is understood that, after receiving the instruction to generate the COPYBOOK file, the specified CTF identifier may be obtained from the instruction, and then the input data items of all transactions related to the specified CTF identifier may be obtained in the application data item table, and the obtained input data items of all transactions may be used as the input data items to be defined. The instruction for generating the COPYBOOK file may be initiated in response to a trigger operation of a user, for example.
Step 102: and selecting an undefined input data item from the input data items to be defined as a current input data item.
Specifically, an undefined input data item is selected from the input data items to be defined acquired in step 101 as the current input data item. The undefined input data item represents an input data item that has never been selected as the current input data item in the generation process of the copy book file, or an input data item that has not been executed as the current input data item in the subsequent step 103 or the subsequent step 104.
Step 103: if the current input data item satisfies the first predetermined condition, redefining the current CTF entry so that the definition of the current CTF entry includes the current input data item, and returning to step 102.
Wherein the first predetermined condition is: the data type of the current input data item is the same as that of the current redefined input data item, the identification of the current input data item is not the same as that of any one of the current redefined input data items, and the current input data item and any one of the current redefined input data items do not belong to the same transaction; the current redefined input data item is an input data item that already exists in the definition of the current CTF entry.
In this embodiment, the current input data item is determined, and it is necessary to determine whether the current input data item satisfies a first predetermined condition. When a first predetermined condition is satisfied, the current CTF entry may be redefined such that the current input data item is included in the definition of the current CTF entry. Then, it can return to step 102 to re-select an undefined input data item from the input data items to be defined as the current input data item for judging again. Wherein the current input data item satisfies a first predetermined condition, i.e. the data type of the current input data item is the same as the data type of the current redefined input data item, the identification of the current input data item is not the same as the identification of any one of the current redefined input data items, and the current input data item and any one of the current redefined input data items do not belong to the same transaction. Wherein the current redefined input data item is an input data item already existing in the definition of the current CTF entry. Furthermore, the identification of the input data item may be, for example, the name of the input data item, and the transaction identification of the input data item may be, for example, a transaction number. It will be appreciated that the identity of the current input data item is not the same as the identity of any one of the current redefined input data items, and may for example correspond to the name of the current input data item not being the same as the name of any one of the current redefined input data items.
For example, if the transaction number of the acquired current input data item is 5, the name is counter number, the data type is a, the transaction number corresponding to the current redefined input data item is 3 and 4, the name is bank number, and the data type is a, comparing the acquired current input data item with the current redefined input data item, it can be seen that the data type of the current input data item and the data type of the current redefined input data item are the same, the names are different, and the transaction number of the current input data item does not belong to the transaction number in the current redefined input data item, that is, the current input data item and any one of the current redefined input data items do not belong to the same transaction, it can be seen that the current input data item satisfies a first predetermined condition, so the current input data item is redefined to include the current input data item in the definition of the current CTF table item after redefining, i.e. also writes the bank number to the CTF entries that have already been defined. After redefinition, the two input data items counter number and bank number are actually included in the definition of the current CTF entry.
Step 104: if the current data input data item meets a second preset condition, creating a CTF entry in the copy book file to be used as the current CTF entry again, defining the current CTF entry so that the definition of the current CTF entry includes the current data input item, and returning to step S102.
Wherein the second predetermined condition is: the current input data does not satisfy the first predetermined condition and the identification of the current input data item does not belong to the identification of any one defined input data item.
In this embodiment, a current input data item is determined, and if the current input data item satisfies a second predetermined condition, a CTF entry is created in the copy book file and is used as the current CTF entry again, and the current CTF entry is defined, so that the current input data item includes the current input data item. Wherein the second predetermined condition is: the current input data item does not satisfy the first predetermined condition and the identity of the current input data item does not belong to the identity of any one of the defined input data items. It is to be understood that the case where the current input data item does not satisfy the first predetermined condition may be embodied as the following two cases: 1) the data type of the current input data item is different from the data type of the current redefined input data item; 2) the data type of the current input data item is the same as that of the current redefined input data item, the identification of the current input data item is different from that of the current redefined input data item, and the transaction identification of the current input data item belongs to the transaction identification corresponding to the current redefined input data item. And if the current input data item does not meet any one of the two conditions, the current input data item does not meet the first preset condition.
For example, if the transaction number of the obtained current input data item is 5, the name is a counter number, the data type is a, the transaction numbers corresponding to the current redefined input data items are 3 and 4, the name is a transaction service, and the data type is B, the obtained current input data item is compared with the current redefined input data item, it can be seen that the data types of the current input data item and the current redefined input data item are different, and it is seen that the current input data item satisfies the second preset condition, so that a new CTF table entry is created in the copy ok file as the current CTF table entry and the current CTF table entry is defined by using the current input data item.
For example, if the transaction number of the currently input data item is acquired as 5, the name is counter number, the data type is a, the transaction numbers corresponding to the currently redefined input data items are numbers 3, 4 and 5, the name is a bank number, the data type is a, the acquired current input data item is compared with the current redefined input data item and, as can be seen, the current input data item is of the same data type, different name, but the transaction number of the current input data item belongs to the transaction number in the current redefined input data item, i.e. there are input data items in the current redefined input data item that belong to the same transaction as the current input data item, as can be seen, the current input data item satisfies the second preset condition, so a new CTF entry is created in the copy book file as the current CTF entry and the current CTF entry is defined by using the current input data item.
In addition, if the identifier of the input data item belongs to the currently defined input data item, that is, the identifier of the current input data item exists in the identifiers of the currently defined input data items, the current input data item is actually defined, so that the step 102 can be directly returned to without redefining or creating a new CTF entry for definition.
It should be noted that, in this embodiment, the definition of the CTF entry indicates that a new CTF entry is created, where the CTF entry is different from any one of the currently existing and defined CTF entries. After the CTF entry is defined, only one input data item, i.e. the current input data item, is included in the definition of the CTF entry. Redefining the CTF entry means writing the current input data item to the currently existing and defined CTF entry. After redefining the CTF entry, the current input data item and at least one previously defined input data item are included in the definition of the CTF entry, i.e. at least two input data items are included in the definition of the CTF entry.
Step S105: and in response to the input data items to be defined being all defined as the created CTF entries, generating the COPYBOOK file based on the definition of the created CTF entries.
In this embodiment, when all the input data items to be defined have been defined as created CTF entries, the COPYBOOK file may be generated based on the definitions of the created CTF entries. The generated COPYBOOK file may include: the header of the COPYBOOK, the definition of the CTF entry that has been created, and the padding of the COPYBOOK. Wherein, the length of the padding entry of the COPYBOOK is the difference between the preset maximum CTF length and the total length of the created CTF entry.
In the present embodiment, the header of the COPYBOOK may be generated in response to a generation instruction of the COPYBOOK file before step 101, or may be generated after step 101 and before step 102. The length of the padding of the COPYBOOK may be determined by subtracting the total length of the created CTF entries from the preset maximum length of the CTF, where the total length of the CTF entries is determined after all the input data entries corresponding to the specified CTF identifier are defined in the CTF entries, that is, after the number of CTF entries has been determined.
It is understood that there may be information of an input error in the aforementioned application input data item table. To exclude this error message from affecting the accuracy of the COPYBOOK file generation, a validity check may be performed on the input data items in the application data item table before step 102.
For example, an input data item and a data type having a correspondence in the application input data item table may not actually correspond. Specifically, the identification of the input data item may be an illegal identification, or the data type of the input data item may be an illegal data type, or the identification of the input data item and the data type do not have a legal correspondence. For the information of these illegal input data items, in a first implementation of the validity check, this embodiment may further include: and judging whether the identification of each input data item in the application input data item table and the data type have a preset corresponding relationship, and if so, executing the step 102.
The preset corresponding relationship may be an identifier for describing a legal input data item and a data type corresponding to the identifier. In some embodiments, the preset correspondence may be recorded in a data dictionary. Specifically, the determining whether there is a preset corresponding relationship between the identifier of each input data item in the application input data item table and the data type may include: judging whether the identification of each input data item in the application input data item table and the data type have a corresponding relation in a preset data dictionary or not; and the data dictionary is used for recording the corresponding relation between the same input data item and the identification and the data type.
For the foregoing first embodiment of the validity check, the validity check of the input data item in the application input data item table may specifically include the following aspects: in the first aspect, whether the identification of the input data item in the application input data item table belongs to the identification of the input data item defined in the data dictionary is judged; in a second aspect, it is determined whether a data type of an input data item in an application input data item table belongs to a data type of an input data item defined in a data dictionary; in a third aspect, it is determined whether the data types of the input data items are the same for the input data items having the same identification.
As another example, in a real situation, the various input data items involved in the same transaction are necessarily different, and thus, multiple identically identified input data items corresponding to the same transaction that appear in the application data entry table are also illegal. For these illegal input data items, in a second implementation of validity check, this embodiment may further include: it is determined whether there are transactions in the application input data item table corresponding to multiple input data items having the same identification, and if not, step 102 is performed.
In this embodiment, two implementation manners are introduced to the validity check of the input data items in the application input data item table, where the first implementation manner is to determine whether a preset corresponding relationship exists between the identifier of each input data item in the application input data item table and the data type; a second embodiment is to determine whether there is a transaction in the application input data item table that corresponds to multiple input data items having the same identification. In this embodiment, the implementation mode that only performs the first validity check may be the implementation mode that only performs the second validity check, or both the two implementation modes need to be performed, and the order of performing the validity check of the first aspect and then performing the validity check of the second aspect may be performed first, or the order of performing the validity check of the first aspect and then performing the validity check of the second aspect may be performed first.
It should be noted that, in this embodiment, the validity check may be performed on the input data items in the application input data item table periodically according to a certain period, or the validity check may be performed on the input data items in the application input data item table after the generation instruction in response to the copy book file is described.
It can be understood that by performing the validity check on the input data item in the application input data item table, the situations of definition error and conflict of the input data item can be avoided, and the situation that an invalid CTF entry is defined due to the error of the input data item when the input data item is subsequently defined can also be avoided.
In some embodiments of this embodiment, in the process of defining the CTF entry for the COPYBOOK file, a prompt may be sent to the user when the length of the defined CTF entry exceeds the limit, so as to avoid a COPYBOOK file error caused by the length of the CTF entry exceeding the limit. Specifically, after creating a CTF entry in the COPYBOOK file as the current CTF entry in step 104, this embodiment may further include: calculating the total length of the CTF table entry which is created currently; and generating and feeding back prompt information in response to that the total length of the currently created CTF table entry exceeds a preset length threshold, wherein the prompt information is used for prompting that the total length of the currently created CTF table entry exceeds the limit. Therefore, after a CTF table entry is newly defined, the total length of the current CTF table entry can be calculated in real time, and if the total length of the current CTF table entry exceeds a preset length threshold, an alarm is given, so that a user can take measures under prompt to avoid the length of the CTF table entry from exceeding the limit, and the generation error of the COPYBOOK file is avoided. That is, by calculating the total length of the CTF entries in real time, the generation of invalid CTF entries caused by the fact that the total length of the CTF entries exceeds the limit is avoided.
Through the various implementation manners provided by the embodiment, the copy book file is generated based on the definition of the created CTF table entry after all the input data items of all the transactions related to the CTF are acquired as the input data items to be defined, one undefined input data item is selected from the input data items to be defined as the current input data item, the current input data item is compared with the current redefined input data item, whether the current input data item needs to be redefined or a new CTF table entry is normally defined, and when all the input data items to be defined are defined as the CTF table entries. In the embodiment of the application, the input data items which can be redefined to the same CTF table entry can be automatically identified, so that the workload of manual operation is simplified, and the accuracy of redefining the CTF table entry is improved.
Referring to fig. 2, a flow chart of a method for generating a configuration file in an embodiment of the present invention is shown; in this embodiment, the method may include, for example, the following steps:
step 201: and setting an application data item table, and importing input data items of all transactions into the application input data item table.
Wherein the input data items imported into the application input data item table include: the transaction identification of the input data item, the data type of the input data item, the serial number of the input data item and the CTF identification.
Step 202: and carrying out validity check on all input data items in the application input data item table.
Specifically, the validity check of all the input data items may include, for example, the following aspects: on the first hand, judging whether the identification of the input data item belongs to the identification defined in the preset data dictionary; judging whether the data type of the input data item belongs to the data type defined in the preset data dictionary; judging whether the preset corresponding relation between the data type of the input data item and the identification of the input data item in the data dictionary is met; in a fourth aspect, a determination is made as to whether the identity of the input data item is repeatedly defined in the same transaction.
Step 203: and generating a CTF COPYBOOK file header.
In this embodiment, the generating of the CTFCOPYBOOK file header may be directly calling a set CTF copy file header, or may be manually writing the CTF copy file header.
Step 204: and acquiring input data items of all transactions corresponding to the specified CTF identifications in the application input data item table.
Wherein the CTF identifies input data items of all corresponding transactions including: an identification of the input data item, a transaction identification of the input data item, a data type of the input data item, and a serial number of the input data item.
Step 205: and selecting an undefined input data item from the acquired input data items of all transactions corresponding to the specified CTF identification as a current input data item.
It is to be understood that in step 205, step 206 is entered if undefined input data items can also be selected, and step 211 is entered if all input data items are defined and undefined input data items cannot be selected any more.
Step 206: and judging whether the current input data item meets a first preset condition and a second preset condition.
In particular, step 206 may be implemented by comparing the current input data item with the current redefined input data item. Wherein the current redefined input data item is an input data item that currently already exists in the current CTF entry.
The first predetermined condition is: the data type of the current input data item is the same as that of the current redefined input data item, the identification of the current input data item is not the same as that of any one current redefined input data item, and the current input data item and any one current redefined input data item do not belong to the same transaction; the current redefined input data item is an input data item that already exists in the definition of the current CTF entry.
The second predetermined condition is: the current input data item does not satisfy the first predetermined condition and the identification of the current input data item does not belong to the identification of any one defined input data item.
It is understood that after step 206, step 207, step 208 or step 209 may be selected according to the determination result of step 206.
Step 207, if the current input data item neither meets the first predetermined condition nor the second predetermined condition, directly returning to step 205.
Specifically, the current input data item does not satisfy the first predetermined condition nor the second predetermined condition, that is, the identifier of the current input data item belongs to the identifier of the previously defined input data item, that is, the current input data item has been previously defined in the CTF entry without being defined again.
Step 208: if the current input data item satisfies the first predetermined condition, redefining the current CTF entry, and returning to execute step 205.
In this embodiment, redefining the current input data item may indicate that the current input data item is added to the definition of the current CTF entry that already includes other input data items, that is, after redefining, the definition of the current CTF entry includes the current input data item and at least one other input data item, where the other input data item is an input data item that has been defined in the current CTF entry before the current input data item.
Step 209: if the current input data item meets a second predetermined condition, creating a CTF entry in the copy book file as the current CTF entry, defining the current CTF entry, and returning to execute step 205.
In this embodiment, creating a CTF entry may be indicated as creating a new CTF entry, where the new CTF entry is different from any CTF entry that has been created and defined previously. Furthermore, defining the current input data item may mean that the current input data item is added to the newly created definition of the current CTF entry that does not yet contain any input data item, that is, after definition, only one input data item, that is, the current input data item, is contained in the definition of the current CTF entry.
Step 210: after creating a CTF entry in the copy book file as the current CTF entry in step 209, calculating the total length of the currently created CTF entry, and determining whether the total length of the currently created CTF entry exceeds a preset length threshold, if so, feeding back a prompt message.
Step 211: and generating a filling item based on the calculated filling item length in response to that all the input data items to be defined are defined as the created CTF table items, thereby generating the COPYBOOK file.
Wherein the calculation formula of the length of the filling item is as follows: total length of CTF preset-total length of defined CTF entries.
In this embodiment, in addition to the above-listed steps, the following steps may be performed:
on the basis of the above steps 201 to 210, after the step 204, the method may further include:
and arranging the input data items of all the transactions corresponding to the acquired specified CTF identifications in an ascending order according to the identifications of the input data items, the data types of the input data items, the transaction identifications of the input data items and the serial numbers of the input data items.
In the embodiment, the input data items in the application input data item table are subjected to validity check, so that the condition of definition errors is avoided; the input data items passing through the automatic identification of the CTF table items are redefined automatically, so that the workload of manual operation is simplified, and the accuracy of redefining the CTF table items is improved; by calculating the total length of the CTF table entry in real time, the generation of invalid CTF table entries caused by the fact that the total length of the CTF table entries exceeds the limit is avoided.
Exemplary device
Referring to fig. 3, a schematic structural diagram of an apparatus for generating a configuration file in an embodiment of the present invention is shown. In this embodiment, the apparatus may specifically include:
an obtaining unit 301, configured to obtain, in response to a generation instruction of the COPYBOOK file, input data items of all transactions related to the CTF as input data items to be defined; the COPYBOOK is used for configuring the CTF.
A selecting unit 302, configured to select an input data item that is not defined as I from the input data items to be defined, as a current input data item.
A redefining unit 303, configured to redefine the current CTF entry so that the definition of the current CTF entry includes the current input data item, and return to triggering the selecting unit if the current input data item satisfies a first predetermined condition.
A defining unit 304, configured to create a CTF entry in the COPY file as a current CTF entry if the current input data entry meets a second predetermined condition, define the current CTF entry so that the definition of the current CTF entry includes the current input data entry, and return to triggering the selecting unit.
A generating unit 305, configured to, in response to that all of the input data items to be defined have been defined as created CTF entries, generate the COPYBOOK file based on the definitions of the created CTF entries.
Wherein the first predetermined condition is: the data type of the current input data item is the same as that of the current redefined input data item, the identification of the current input data item is not the same as that of any one of the current redefined input data items, and the current input data item and any one of the current redefined input data items do not belong to the same transaction; the current redefined input data item is an input data item that already exists in the definition of the current CTF entry.
The second predetermined condition includes: the current input data item does not satisfy the first predetermined condition and the identity of the current input data item does not belong to the identity of any one of the defined input data items.
Through the various implementation manners provided by the embodiment, the copy book file is generated based on the definition of the created CTF table entry after all the input data items of all the transactions related to the CTF are acquired as the input data items to be defined, one undefined input data item is selected from the input data items to be defined as the current input data item, the current input data item is compared with the current redefined input data item, whether the current input data item needs to be redefined or a new CTF table entry is normally defined, and when all the input data items to be defined are defined as the CTF table entries. In the embodiment of the application, the input data items which can be redefined to the same CTF table entry can be automatically identified, so that the workload of manual operation is simplified, and the accuracy of redefining the CTF table entry is improved.
In this embodiment, the obtaining unit 401 may specifically include, for example:
and the obtaining subunit is used for responding to the generation instruction and obtaining the identification of the CTF.
And the searching subunit is used for searching an input data item corresponding to the identifier of the CTF in an application input data item table to serve as the input data item to be defined.
And recording mapping relations among the CTF, the transaction and the input data items in the application input data item table, wherein the mapping relations comprise the identification of the CTF, the identification of the transaction, the identification of the input data items and the data types of the input data items.
Optionally, in some embodiments of this embodiment, the apparatus further includes:
and the first judgment unit is used for judging whether the identification of each input data item in the application input data item table and the data type have a preset corresponding relationship or not.
And the first triggering unit is used for triggering the selecting unit under the condition that the judgment result of the first judging unit is yes.
The first judging unit is specifically configured to:
and judging whether the identification of each input data item in the application input data item table and the data type have a corresponding relation in a preset data dictionary.
And the data dictionary is used for recording the corresponding relation between the same input data item and the identification and the data type.
Optionally, in some embodiments of this embodiment, the apparatus further includes:
a second judgment unit operable to judge whether or not there is a transaction corresponding to a plurality of input data items having the same identification in the application input data item table.
And the second triggering unit is used for triggering the selecting unit under the condition that the judgment result of the second judging unit is negative.
Wherein, the COPYBOOK file comprises a file header of the COPYBOOK, a definition of the created CTF table entry and a filler of the COPYBOOK, and the length of the filler is the difference between the preset maximum length of the CTF and the total length of the created CTF table entry.
Optionally, in some embodiments of this embodiment, the apparatus further includes:
a calculating unit, configured to calculate a total length of a currently created CTF entry after creating a CTF entry in the copy book file of the defining unit and taking the CTF entry as a current CTF entry again.
And a prompting unit, configured to generate and feed back prompt information in response to that a total length of the currently created CTF entry exceeds a preset length threshold, where the prompt information is used to prompt that the total length of the currently created CTF entry has exceeded a limit.
The names "first" in the names "first … …", "first … …", etc. mentioned in the embodiments of the present invention are only used for name identification, and do not represent the first in sequence. The same applies to "second" etc.
As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that all or part of the steps in the above embodiment methods can be implemented by software plus a general hardware platform. With this understanding, the technical solution of the present invention can be embodied in the form of a software product, which can be stored in a storage medium, such as a read-only memory (ROM)/RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network communication device such as a router, etc.) to execute the method according to the embodiments or some parts of the embodiments of the present invention.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, the method embodiments and apparatus embodiments are substantially similar to the system embodiments and therefore are described in a relatively simple manner, and reference may be made to some of the descriptions of the system embodiments for related points. The above-described embodiments of the apparatus and system are merely illustrative, wherein modules described as separate parts may or may not be physically separate, and parts shown as modules may or may not be physical modules, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
The above description is only for the preferred embodiment of the present invention and is not intended to limit the scope of the present invention. It should be noted that, for a person skilled in the art, several modifications and refinements can be made without departing from the invention, and these modifications and refinements should be regarded as the protection scope of the present invention.

Claims (14)

1. A method of generating a configuration file, comprising:
responding to a generation instruction of the COPYBOOK file, and acquiring input data items of all transactions related to the CTF as input data items to be defined; the COPYBOOK is used for configuring the CTF;
selecting an undefined input data item from the input data items to be defined as a current input data item;
if the current input data item meets a first preset condition, redefining the current CTF table item to enable the definition of the current CTF table item to contain the current input data item, and returning to select an undefined input data item from the input data items to be defined;
if the current input data item meets a second preset condition, creating a CTF table entry in the COPYBOOK file to be used as the current CTF table entry again, defining the current CTF table entry so that the definition of the current CTF table entry comprises the current input data item, and returning to select an undefined input data item from the input data items to be defined;
in response to that all the input data items to be defined are defined as created CTF entries, generating the COPYBOOK file based on the definition of the created CTF entries;
wherein the first predetermined condition is: the data type of the current input data item is the same as that of the current redefined input data item, the identification of the current input data item is not the same as that of any one of the current redefined input data items, and the current input data item and any one of the current redefined input data items do not belong to the same transaction; the current redefined input data item is an input data item already existing in the definition of the current CTF entry;
the second predetermined condition includes: the current input data item does not satisfy the first predetermined condition and the identity of the current input data item does not belong to the identity of any one of the defined input data items.
2. The method as claimed in claim 1, wherein the acquiring input data items of all transactions involved in the CTF as input data items to be defined in response to the generation instruction of the COPYBOOK file comprises:
acquiring the identification of the CTF in response to the generation instruction;
searching an input data item corresponding to the identifier of the CTF in an application input data item table to serve as the input data item to be defined;
and recording mapping relations among the CTF, the transaction and the input data items in the application input data item table, wherein the mapping relations comprise the identification of the CTF, the identification of the transaction, the identification of the input data items and the data types of the input data items.
3. The method of claim 2, further comprising:
and judging whether the identification of each input data item in the application input data item table and the data type have a preset corresponding relationship, if so, selecting an undefined input data item from the input data items to be defined.
4. The method according to claim 3, wherein the determining whether there is a preset correspondence between the identifier of each input data item in the application input data item table and the data type includes:
judging whether the identification of each input data item in the application input data item table and the data type have a corresponding relation in a preset data dictionary or not;
and the data dictionary is used for recording the corresponding relation between the same input data item and the identification and the data type.
5. The method of claim 2, further comprising:
and judging whether transactions corresponding to a plurality of input data items with the same identification exist in the application input data item table, and if not, executing the selection of an undefined input data item from the input data items to be defined.
6. The method of claim 1, wherein a header of the COPYBOOK file, a definition of the created CTF entry, and a padding of the COPYBOOK is included in the COPYBOOK file, and a length of the padding is a difference between a preset maximum CTF length and a total length of the created CTF entry.
7. The method of claim 1, wherein after creating a CTF entry in the COPYBOOK file as the current CTF entry, further comprising:
calculating the total length of the CTF table entry which is created currently;
and generating and feeding back prompt information in response to that the total length of the currently created CTF table entry exceeds a preset length threshold, wherein the prompt information is used for prompting that the total length of the currently created CTF table entry exceeds the limit.
8. An apparatus for generating a configuration file, comprising:
the acquiring unit is used for responding to a generation instruction of the COPYBOOK file, and acquiring input data items of all transactions related to the CTF as input data items to be defined; the COPYBOOK is used for configuring the CTF;
the selection unit is used for selecting an undefined input data item from the input data items to be defined as a current input data item;
a redefining unit, configured to redefine a current CTF entry if the current input data item satisfies a first predetermined condition, so that the definition of the current CTF entry includes the current input data item, and return to trigger the selecting unit;
a defining unit, configured to create a CTF entry in the copy book file as a current CTF entry if the current input data entry meets a second predetermined condition, define the current CTF entry so that the definition of the current CTF entry includes the current input data entry, and return to trigger the selecting unit;
a generating unit, configured to generate the COPYBOOK file based on the definition of the created CTF entry in response to that all of the input data items to be defined have been defined as the created CTF entry;
wherein the first predetermined condition is: the data type of the current input data item is the same as that of the current redefined input data item, the identification of the current input data item is not the same as that of any one of the current redefined input data items, and the current input data item and any one of the current redefined input data items do not belong to the same transaction; the current redefined input data item is an input data item already existing in the definition of the current CTF entry;
the second predetermined condition includes: the current input data item does not satisfy the first predetermined condition and the identity of the current input data item does not belong to the identity of any one of the defined input data items.
9. The apparatus of claim 8, wherein the obtaining unit comprises:
an obtaining subunit, configured to obtain, in response to the generation instruction, an identifier of the CTF;
a searching subunit, configured to search, in an application input data item table, an input data item corresponding to the identifier of the CTF, as the input data item to be defined;
and recording mapping relations among the CTF, the transaction and the input data items in the application input data item table, wherein the mapping relations comprise the identification of the CTF, the identification of the transaction, the identification of the input data items and the data types of the input data items.
10. The apparatus of claim 9, further comprising:
the first judgment unit is used for judging whether the self identification of each input data item in the application input data item table and the data type have a preset corresponding relationship or not;
and the first triggering unit is used for triggering the selecting unit under the condition that the judgment result of the first judging unit is yes.
11. The apparatus according to claim 10, wherein the first determining unit is specifically configured to:
judging whether the identification of each input data item in the application input data item table and the data type have a corresponding relation in a preset data dictionary or not;
and the data dictionary is used for recording the corresponding relation between the same input data item and the identification and the data type.
12. The apparatus of claim 9, further comprising:
a second judgment unit operable to judge whether there is a transaction corresponding to a plurality of input data items having the same identification in the application input data item table;
and the second triggering unit is used for triggering the selecting unit under the condition that the judgment result of the second judging unit is negative.
13. The apparatus of claim 8, wherein a header of the COPYBOOK, a definition of the created CTF entry, and a padding of the COPYBOOK are included in the COPYBOOK file, and a length of the padding is a difference between a preset maximum CTF length and a total length of the created CTF entry.
14. The apparatus of claim 8, further comprising:
a calculating unit, configured to calculate a total length of a currently created CTF entry after creating a CTF entry in the copy book file of the defining unit and taking the CTF entry as a current CTF entry again;
and a prompting unit, configured to generate and feed back prompt information in response to that a total length of the currently created CTF entry exceeds a preset length threshold, where the prompt information is used to prompt that the total length of the currently created CTF entry has exceeded a limit.
CN201611110400.3A 2016-12-06 2016-12-06 Method and device for generating configuration file Active CN106775854B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611110400.3A CN106775854B (en) 2016-12-06 2016-12-06 Method and device for generating configuration file

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611110400.3A CN106775854B (en) 2016-12-06 2016-12-06 Method and device for generating configuration file

Publications (2)

Publication Number Publication Date
CN106775854A CN106775854A (en) 2017-05-31
CN106775854B true CN106775854B (en) 2020-03-10

Family

ID=58878325

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611110400.3A Active CN106775854B (en) 2016-12-06 2016-12-06 Method and device for generating configuration file

Country Status (1)

Country Link
CN (1) CN106775854B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107885492B (en) * 2017-11-14 2021-03-12 中国银行股份有限公司 Method and device for dynamically generating data structure in host

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1816043A (en) * 2005-02-06 2006-08-09 华为技术有限公司 Script generating device based on assembly multiplexing, and method therefor
CN103984578A (en) * 2014-05-29 2014-08-13 中国银行股份有限公司 Updating method and device for COBOL program version
CN104731814A (en) * 2013-12-23 2015-06-24 北京宸瑞科技有限公司 System and method for flexibly comparing and analyzing data

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1816043A (en) * 2005-02-06 2006-08-09 华为技术有限公司 Script generating device based on assembly multiplexing, and method therefor
CN104731814A (en) * 2013-12-23 2015-06-24 北京宸瑞科技有限公司 System and method for flexibly comparing and analyzing data
CN103984578A (en) * 2014-05-29 2014-08-13 中国银行股份有限公司 Updating method and device for COBOL program version

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
"银行测试数据合成有‘招’";郑骏等;《金融电子化》;20100228(第2010年02期);正文第二至四部分 *

Also Published As

Publication number Publication date
CN106775854A (en) 2017-05-31

Similar Documents

Publication Publication Date Title
WO2020186786A1 (en) File processing method and apparatus, computer device and storage medium
CN109614238B (en) Target object identification method, device and system and readable storage medium
CN104246767A (en) Telemetry system for a cloud synchronization system
CN104408118B (en) The creation method and device of database
CN108471421B (en) Method, system and related device for constructing multiple exclusive platforms in cloud environment
CN111367887A (en) Multi-tenant data sharing system, management method thereof and database deployment method
CN109740129B (en) Report generation method, device and equipment based on blockchain and readable storage medium
CN107798120B (en) Data conversion method and device
CN110088744A (en) A kind of database maintenance method and its system
CN109871408B (en) Multi-type database adaptation method, device, electronic equipment and storage medium
CN109634524B (en) Data partition configuration method, device and equipment of data processing daemon
CN106775854B (en) Method and device for generating configuration file
CN112328363B (en) Cloud hard disk mounting method and device
CN110704620B (en) Method and device for identifying same entity based on knowledge graph
CN112506869A (en) File processing method, device and system
CN112789599A (en) Information recommendation method, device, equipment and readable storage medium
CN112783441B (en) Method and device for adjusting read-write speed limit of virtual machine disk and computing equipment
CN112583864B (en) Data migration method and device
CN110532457B (en) Method and system for acquiring network segment ID
CN113342647A (en) Test data generation method and device
CN112632132A (en) Method, device and equipment for processing abnormal import data
CN110750727A (en) Data processing method, device, system and computer readable storage medium
CN112632266A (en) Data writing method and device, computer equipment and readable storage medium
CN112000676B (en) Vehicle information updating method, device, equipment and storage medium
CN114818645B (en) Automatic report generation method, device, equipment and medium based on data body

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant