View previous topic :: View next topic
|
Author |
Message |
pli guy
New User
Joined: 11 Apr 2008 Posts: 5 Location: hyderabad
|
|
|
|
i wanna compare two strucures which are of 22000 chars size & i wanna find the point at which they are mismatching... please tell me logic to code in pli lang.... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello pli guy and welcome to the forums,
Is there some reason you posted in the COBOL part of the forum?
Please clarify what you mean by structures. . . Do you mean definition or content? |
|
Back to top |
|
|
murugan_mf
Active User
Joined: 31 Jan 2008 Posts: 148 Location: Chennai, India
|
|
|
|
Put a loop for 22000 times and use SUBSTR function if mismatch occurs
come out of the loop |
|
Back to top |
|
|
pli guy
New User
Joined: 11 Apr 2008 Posts: 5 Location: hyderabad
|
|
|
|
if you can give the logic in cobol or pli, it is fine with me.
i have a structure which collects data from some fields entered on screens. this structure i wanna compare with another structure which has same fields(values may be same or different). |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
this structure i wanna compare with another structure which has same fields(values may be same or different). |
You need to make your requirement much more clear.
Pretend you only have 40-byte structures (rather than 22k). Please post some sample info from both "input"s and what you want for output. If individual fields are to be considered, you need to show the field attributes as well. |
|
Back to top |
|
|
pli guy
New User
Joined: 11 Apr 2008 Posts: 5 Location: hyderabad
|
|
|
|
ok fine...
strucutre1
1 field1 char(20),
1 field1 fixed dec(3,2),
1 field1 fixed dec(5,2),
1 field1 fixed dec(7,2),
1 field1 fixed dec(9,2),
1 field1 fixed dec(11,2);
strucutre2
1 field1 char(20),
1 field1 fixed dec(3,2),
1 field1 fixed dec(5,2),
1 field1 fixed dec(7,2),
1 field1 fixed dec(9,2),
1 field1 fixed dec(11,2);
these are only the diff fileds available in both the structures... now how to compare these structures and how to find out where they are mismatching? output is if while comparing, some fields mismatches then i want the field where it mismatches.... |
|
Back to top |
|
|
PeD
Active User
Joined: 26 Nov 2005 Posts: 459 Location: Belgium
|
|
|
|
ECOMP can easely do that
Suppose you have
STR1
Code: |
01 ZFIELD1 CHAR(22),
01 ZFIELD2 FIXED DEC(3,2),
01 ZFIELD3 FIXED DEC(5,2),
01 ZFIELD4 FIXED DEC(8,3),
01 ZFIELD5 FIXED BIN(15),
01 ZFIELD5A FIXED DEC(9,2),
01 ZFIELD6 FIXED DEC(11,3); |
STR2
Code: |
01 ZFIELD1 CHAR(20),
01 ZFIELD2 FIXED DEC(3,2),
01 ZFIELD3 FIXED DEC(5,2),
01 ZFIELD4 FIXED DEC(8,2),
01 ZFIELD5 FIXED DEC(9,2),
01 ZFIELD6 FIXED DEC(11,3); |
Results
Code: |
Thu, Jul 03, 2008 07:22:10 COMPARE E>>Comp V0301 OCMP001D
Page : 1 TENV.EVOLA.CMPV9201.WRK(STR1) AND TENV.EVOLA.CMPV9201.WRK(STR2) SITE
------------------------------------------------------------------------------------------------------------------------------------
ALPHA L1 01 ZFIELD1 CHAR(22),
--->> >>-- - <<--
OMEGA L1 01 ZFIELD1 CHAR(20),
ALPHA L4 01 ZFIELD4 FIXED DEC(8,3),
--->> >>-- - <<--
OMEGA L4 01 ZFIELD4 FIXED DEC(8,2),
ALPHA L5 01 ZFIELD5 FIXED BIN(15),
--->> >>-- --- ----- <<--
OMEGA L5 01 ZFIELD5 FIXED DEC(9,2),
ALPHA L6 01 ZFIELD5A FIXED DEC(9,2),
____________________________________________________________________________________________________________________________________ |
Cheers
Pierre |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hi Pierre,
You changed the definitions to meet a different requirement?
If i understand (the TS still has still not shown input and output data, but only the defintions which are the same), the TS wants to compare those fields and when there is a difference in the data, show which field is different and the 2 values.
That was why i asked for sample data (info) from both files and the desired output.
Of course, i may completely misunderstand. . . . |
|
Back to top |
|
|
PeD
Active User
Joined: 26 Nov 2005 Posts: 459 Location: Belgium
|
|
|
|
My understandiing was the OP wants to compare structures and not data applied on that.
But as he showed 2 absolutely same structures, I guessed it was a mistake and I adapted the requirement to show how my solution is.
But OK ,maybe I am wrong. ( just to be occupied during a waiting time at work .. ) |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Maybe OP will clarify. . .
d |
|
Back to top |
|
|
pli guy
New User
Joined: 11 Apr 2008 Posts: 5 Location: hyderabad
|
|
|
|
hi!
the structures will be same only.... but the data in fields will be different...
i wanna compare data present and want to know where the feild mismatches.... |
|
Back to top |
|
|
PeD
Active User
Joined: 26 Nov 2005 Posts: 459 Location: Belgium
|
|
|
|
Ecomp does the same with content of files.
like SuperC, File-Aid, Comparex, but according to some users pretty much better. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
i wanna compare data present and want to know where the feild mismatches.... |
What have you tried so far (SuperC, etc)?
Did you get the differences?
Is there some problem/question? |
|
Back to top |
|
|
|