If you needed to keep track to see if any field changed in group, knowing the data is passed thru several subroutines, what would be the most efficient code? You could save a copy of the group item in working storage and just do a If =, but is there a better way? Keeping a flag seems error prone when considering future maintenance.
02 X1 PIC XX.
02 X2 PIC S9(5) COMP-3.
02 X3 PIC S9(5) COMP-3.
02 SAVE-X PIC X(8).
MOVE X TO SAVE-X
CALL PROG01 USING X.
CALL PROG02 USING X.
IF X = SAVE-X
DISPLAY 'NO CHANGE'
If X were really 1000 bytes, how efficient is this code?
all ideas welcome, thanks!
NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
This topic has been locked.
Pinned topic Comparing Data
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2013-03-22T20:21:00Z at 2013-03-22T20:21:00Z by BillWoodger
BillWoodger 270005Q076126 PostsACCEPTED ANSWER
Re: Comparing Data2013-03-22T20:21:00Z in response to ebrnWhat are you actually trying to identify by the code, what is your reason for wanting to know in your program that the data is the same before/after?
Note, this does not mean that neither of the sub-programs has done "anything", as they could have set any of those three values to the same value that it already had. If you want to know about those as well, you will need a "flag" for each sub-routine set by each sub-routine.
Your proposed IF will identify any change in any bit in the data-structure.
Do you have an unusually large amount of data?
There is a way to "mangle" this, if your data does not always "conform to PICture", then things which are "numerically equivalent" might end up with different "signs" so cause the IF to fail. I guess you'll find out if that is the case with your data.