Optimizing COBOL Packed Decimal Sign Assignment

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

COBOL programs using packed decimal variables face issues with incorrect sign assignment in calculations, leading to costly and inefficient ZAP instructions that decrease operating speed.

Innovation Solution

A method is developed to detect and optimize sign assignment instructions by analyzing whether the input operand results from an add or subtract operation and checking if the value is negative zero, generating the ZAP instruction only when necessary, and replacing or removing it to improve efficiency.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If ZAP instruction is always executed to correct sign assignment in packed decimal calculations, then sign correctness is ensured, but execution speed decreases due to the costly nature of ZAP instructions

Engineering Contradiction:
Improvesign assignment correctnessVSAvoidexecution speed
Core Design Contradiction:
ReliabilityVSSpeed

Solution Approach 1:

The patent applies partial action by executing the ZAP instruction only when necessary - specifically when the input operand is determined to be negative zero through analysis of the operation type and value comparison. Instead of always executing ZAP to ensure sign correctness, the system performs partial correction only in cases where negative zero is detected, thereby maintaining reliability while improving execution speed by avoiding unnecessary ZAP instructions

Inventive Principle:
Principle #16Partial or excessive action

2Speed

If ZAP instruction is removed or reduced to improve execution speed, then speed increases, but sign assignment correctness may be compromised

Engineering Contradiction:
Improveexecution speedVSAvoidsign assignment correctness
Core Design Contradiction:
SpeedVSReliability

Solution Approach 1:

The patent applies preliminary action by performing analysis of the operation type and comparing values before the ZAP instruction is executed. The system determines in advance whether the input operand is negative zero by checking if the operation is add or subtract and whether the value is greater than the prior value. This preliminary detection ensures that ZAP is executed only when needed, maintaining sign correctness while improving speed

Inventive Principle:
Principle #10Preliminary action

3Speed

If analysis of input operand is performed to determine necessity of ZAP instruction, then execution speed improves by avoiding unnecessary ZAP, but computational overhead is introduced by the analysis process

Engineering Contradiction:
Improveoverall execution speedVSAvoidinstruction analysis complexity
Core Design Contradiction:
SpeedVSDevice complexity

Solution Approach 1:

The patent applies local quality by performing detailed analysis only on specific aspects of the input operand that are relevant to detecting negative zero - specifically the operation type (add or subtract) and the value comparison (whether the value is greater than the prior value). This localized analysis approach avoids comprehensive examination of the entire operand, reducing computational overhead while maintaining the ability to accurately identify cases requiring ZAP instruction

Inventive Principle:
Principle #3Local quality

Data Source

PatentUS9996327B2Method, program, and system for code optimization
Publication Date: 2018.06.12 INTERNATIONAL BUSINESS MACHINE CORPORATION
  • US9996327B2 patent drawing
  • US9996327B2 patent drawing
  • US9996327B2 patent drawing

AI summary

Method, program and system for code optimization. A sign assignment instruction with identically sized packed decimal format input and output operands is detected where the sign assignment instruction assigns a value of zero to a packed decimal data value input operand having a value of negative zero. If the input operand to the sign assignment instruction does not result from an add or subtract operation, or the value of the input operand is not greater than a value prior to that operation, the possibility that the value of the input operand of the sign assignment instruction is negative zero is checked when the input operand and the output operand have identical addresses. An instruction is generated and inserted for executing the sign assignment instruction only when there is the possibility that the operand value is negative zero.