IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Compare record with record length > 4096


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sprasannapathy

New User


Joined: 04 Jan 2008
Posts: 42
Location: india

PostPosted: Wed Feb 18, 2009 10:53 pm
Reply with quote

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?

Thanks
Prasannaa S
Back to top
View user's profile Send private message
sprasannapathy

New User


Joined: 04 Jan 2008
Posts: 42
Location: india

PostPosted: Thu Feb 19, 2009 10:15 pm
Reply with quote

Hi,

Kindly help me

Thanks
Prasannaa S
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Feb 19, 2009 10:33 pm
Reply with quote

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.......
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Feb 19, 2009 10:34 pm
Reply with quote

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.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Feb 19, 2009 10:36 pm
Reply with quote

dick scherrer wrote:
I've moved your topic from JCL to COBOL.
Why? The op was quite specfic on using Syncsort.
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 459
Location: Belgium

PostPosted: Thu Feb 19, 2009 10:50 pm
Reply with quote

Quote:
If there is change I have to write to an output file1

As both records are different here, which one do you want to be written in output file1?
Back to top
View user's profile Send private message
sprasannapathy

New User


Joined: 04 Jan 2008
Posts: 42
Location: india

PostPosted: Thu Feb 19, 2009 10:52 pm
Reply with quote

Thanking you fro reply. This means in COBOL we can compare field of with any length.
Example

If data-field-1-lenth- 11139 = data-field-2-lenth- 11139
Back to top
View user's profile Send private message
sprasannapathy

New User


Joined: 04 Jan 2008
Posts: 42
Location: india

PostPosted: Thu Feb 19, 2009 11:03 pm
Reply with quote

Hi Ped,

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.

Thanks
Prasannaa S
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Feb 19, 2009 11:10 pm
Reply with quote

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".
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 459
Location: Belgium

PostPosted: Thu Feb 19, 2009 11:21 pm
Reply with quote

Using another utility, EComp, you can do that in one pass for records up to 32750 in files and no limit ( almost ! ) on MQ.

Records are rewritten as desired following given criteria and based on keys.

Now you can move the post to "Mainframe Testing tools" icon_lol.gif
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Thu Feb 19, 2009 11:22 pm
Reply with quote

That's because it was hiding in Off Topics..... icon_lol.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Feb 19, 2009 11:26 pm
Reply with quote

And i believe it was in Other Mainframe Topics originally. . .

Tough "life" for the little topic. . .

If we want to return to JCL, fine by me, but i believe the length will be a problem icon_smile.gif

d
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Thu Feb 19, 2009 11:29 pm
Reply with quote

The length is not impossible, but why don't we wait until the op lets us know if the COBOL answer is what he wants.......
Back to top
View user's profile Send private message
sprasannapathy

New User


Joined: 04 Jan 2008
Posts: 42
Location: india

PostPosted: Thu Feb 19, 2009 11:44 pm
Reply with quote

Thankful to mainframe forum and all peoples helped me greatly. I prefer doing the thing by utility.

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

Thanks
Prasannaa S
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Feb 20, 2009 12:23 am
Reply with quote

sprasannapathy wrote:
I prefer doing the thing by utility.
?
Quote:
If it is in COBOL then we can compare field of with any length.
Well, almost any length:
Table 59. Compiler limits
Language element & Compiler limit
Elementary item size 16,777,215 bytes
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 459
Location: Belgium

PostPosted: Fri Feb 20, 2009 1:09 am
Reply with quote

Quote:

William Thompson wrote :

sprasannapathy wrote:
I prefer doing the thing by utility.
?


My viewpoint : if the length changes, I guess the layout, the structure of data will change also.
So a strong utility is preferable.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Feb 20, 2009 12:48 pm
Reply with quote

sprasannapathy,

You can achieve this using the below SyncSort JOIN application.
Code:
//STEP1    EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTJNF1 DD DISP=SHR,DSN= Input file-1 ----> FB/11150
//SORTJNF2 DD DISP=SHR,DSN= Input file-2 ----> FB/11150
//OUT1     DD DISP=SHR,DSN= Output file-1 ----> FB/11150
//OUT2     DD DISP=SHR,DSN= Output file-2 ----> FB/11150
//OUT3     DD DISP=SHR,DSN= Output file-3 ----> FB/11150
//SYSIN    DD *
  JOINKEYS FILE=F1,FIELDS=(2,10,A)
  JOINKEYS FILE=F2,FIELDS=(2,10,A)
  JOIN UNPAIRED
  REFORMAT FIELDS=(F1:1,11150,F2:1,11150)
  SORT FIELDS=COPY
  OUTFIL FNAMES=OUT2,BUILD=(11151,11150),
         INCLUDE=(2,1,CH,EQ,C' ')
  OUTFIL FNAMES=OUT3,BUILD=(1,11150),
         INCLUDE=(11152,1,CH,EQ,C' ')
  OUTFIL FNAMES=OUT1,BUILD=(1,11150),
         INCLUDE=(2,10,CH,EQ,11152,10,CH,AND,
                 ((12,256,CH,NE,11162,256,CH),OR,
                  (268,256,CH,NE,11418,256,CH),OR,
                  (524,256,CH,NE,11674,256,CH),OR,
                  (780,256,CH,NE,11930,256,CH),OR,
                  (1036,256,CH,NE,12186,256,CH),OR,
                  (1292,256,CH,NE,12442,256,CH),OR,
                  (1548,256,CH,NE,12698,256,CH),OR,
                  (1804,256,CH,NE,12954,256,CH),OR,
                  (2060,256,CH,NE,13210,256,CH),OR,
                  (2316,256,CH,NE,13466,256,CH),OR,
                  (2572,256,CH,NE,13722,256,CH),OR,
                  (2828,256,CH,NE,13978,256,CH),OR,
                  (3084,256,CH,NE,14234,256,CH),OR,
                  (3340,256,CH,NE,14490,256,CH),OR,
                  (3596,256,CH,NE,14746,256,CH),OR,
                  (3852,256,CH,NE,15002,256,CH),OR,
                  (4108,256,CH,NE,15258,256,CH),OR,
                  (4364,256,CH,NE,15514,256,CH),OR,
                  (4620,256,CH,NE,15770,256,CH),OR,
                  (4876,256,CH,NE,16026,256,CH),OR,
                  (5132,256,CH,NE,16282,256,CH),OR,
                  (5388,256,CH,NE,16538,256,CH),OR,
                  (5644,256,CH,NE,16794,256,CH),OR,
                  (5900,256,CH,NE,17050,256,CH),OR,
                  (6156,256,CH,NE,17306,256,CH),OR,
                  (6412,256,CH,NE,17562,256,CH),OR,
                  (6668,256,CH,NE,17818,256,CH),OR,
                  (6924,256,CH,NE,18074,256,CH),OR,
                  (7180,256,CH,NE,18330,256,CH),OR,
                  (7436,256,CH,NE,18586,256,CH),OR,
                  (7692,256,CH,NE,18842,256,CH),OR,
                  (7948,256,CH,NE,19098,256,CH),OR,
                  (8204,256,CH,NE,19354,256,CH),OR,
                  (8460,256,CH,NE,19610,256,CH),OR,
                  (8716,256,CH,NE,19866,256,CH),OR,
                  (8972,256,CH,NE,20122,256,CH),OR,
                  (9228,256,CH,NE,20378,256,CH),OR,
                  (9484,256,CH,NE,20634,256,CH),OR,
                  (9740,256,CH,NE,20890,256,CH),OR,
                  (9996,256,CH,NE,21146,256,CH),OR,
                  (10252,256,CH,NE,21402,256,CH),OR,
                  (10508,256,CH,NE,21658,256,CH),OR,
                  (10764,256,CH,NE,21914,256,CH),OR,
                  (11020,131,CH,NE,22170,131,CH)))
Back to top
View user's profile Send private message
sprasannapathy

New User


Joined: 04 Jan 2008
Posts: 42
Location: india

PostPosted: Tue Feb 24, 2009 7:34 pm
Reply with quote

Thanking you
Prasanna S
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 459
Location: Belgium

PostPosted: Tue Feb 24, 2009 7:47 pm
Reply with quote

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.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Feb 25, 2009 12:26 am
Reply with quote

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?
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 459
Location: Belgium

PostPosted: Wed Feb 25, 2009 1:23 am
Reply with quote

Arun,

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.
Back to top
View user's profile Send private message
sprasannapathy

New User


Joined: 04 Jan 2008
Posts: 42
Location: india

PostPosted: Wed Feb 25, 2009 2:01 pm
Reply with quote

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.

Thanks
Prasannaa S
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Feb 25, 2009 2:04 pm
Reply with quote

You're welcome icon_smile.gif . Thanks for making your "wish" clear to all.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Store the data for fixed length COBOL Programming 1
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
Search our Forums:

Back to Top