I have a record with logical record length of 11150. First character is a control character. 2 through 11(length of 10) is key field. 12 through 11150 (length of 11139) is data field. Now I have to compare the field 12 through 11150 (data field). If there is change I have to write to an output file1. If there is any add in key field (column 1 through 11) I have to write to output file2 similarly if there is any delete I have to write to output file3.
• Is there any best way to handle this situation?
• Is there any possibility to compare the character field which has length greater than 4096?
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
Quote:
Is there any possibility to compare the character field which has length greater than 4096?
In one pass, no....
But with multple passes, it should be easy.
One pass to get the last two outputs built (but I'm not of how the deletes will be worked).
Since the only output from the first requirement is differences, scan each 4000 or so bytes in 4 passes.......
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
Hello,
I've moved your topic from JCL to COBOL.
Quote:
Is there any best way to handle this situation?
Suggest you write a 2-file match/merge to accomplish what you want. If you do not know how to write match/merge code there is working sample code in a "Sticky" at the top of this cobol part of the forum.
Download the code and modify for your use. If you find something in the code you do not understand, post questoins here and someone will be able to clarify.
Each of the files needs to be sorted in key sequence before this code is executed.
If the key field of file-1 and file-2 matches (column 2 through 11 - length of 10) then I have to compare the data field of file-1 and file-2 (column 12 through 11150 - length of 11139). It both data fields 1 and 2 are same then there is no problem. If there is change then I have to write the record from file-2 (column 1 through 11150) to output file1.
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
Hello,
Quote:
Why? The op was quite specfic on using Syncsort.
Yup, but there were no replies in almost 24 hours. . .
Also, i know how to get the desired output in cobol in one pass (given that the inputs are in key sequence) and have much greater flexibility to implement as yet undiscovered "rules".
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
PeD wrote:
Quote:
If it is in COBOL then we can compare field of with any length.
Example
If data-field-1-Length- 11139 = data-field-2-Length- 11139
Even if the solution from Arun works, the reuse is not met.
It is just harcoded.
But OK it should run.
Ped,
I think the OP was not asking about a reuse. I just re-read the entire thread. It seems like he/she was worried about comparing fields of such huge length.i.e., a field1-of-length-11139 with another field2-of-length-11139. Or is there something which I missed here?
I really don't know for sure. Maybe it is, but when the poster wrote
Quote:
This means in COBOL we can compare field of with any length
this is for me like a "wish" to make comparison of files with different lengths ( layouts ).
Maybe not.
In any case, you gave a solution and that's good.
Thanking you for help. I am anxious about of comparing fields of huge length. Now, I got the information through the link (complier limits) given by William Thompson. Once again thanking all of you for Kind help.