Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Match or compare two files in VB Format

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
anatol

New User


Joined: 20 May 2010
Posts: 99
Location: canada

PostPosted: Thu Nov 03, 2016 7:41 pm    Post subject: Match or compare two files in VB Format
Reply with quote

Hi,

For files FB 80 I can compare 2 files and split for in both, in first, in second by:
Code:

  JOINKEYS FILE=F1,FIELDS=(1,10,A)                       
  JOINKEYS FILE=F2,FIELDS=(1,10,A)                       
  JOIN UNPAIRED,F1,F2                                     
  REFORMAT FIELDS=(F1:1,80,F2:1,80,?)                     
  OPTION COPY                                             
 OUTFIL FNAMES=BOTH,INCLUDE=(161,1,CH,EQ,C'B'),           
 BUILD=(1,80)                                             
 OUTFIL FNAMES=FIRST,INCLUDE=(161,1,CH,EQ,C'1'),         
 BUILD=(1,80)                                             
 OUTFIL FNAMES=SECOND,INCLUDE=(161,1,CH,EQ,C'2'),         
 BUILD=(81,80)                                           


but how I can do it for files VB 80?
Back to top
View user's profile Send private message

Arun Raj

Moderator


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

PostPosted: Thu Nov 03, 2016 8:41 pm    Post subject:
Reply with quote

Quote:
z/OS DFSORT >> z/OS DFSORT Application Programming Guide >> Using a JOINKEYS application for joining two files >> JOINKEYS statements
mentions what needs to be considered while handling variable length records in a JOIN application. Please read through, try it out and get back if you come across something unexpected. Or search the forum for working examples.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Nov 03, 2016 9:59 pm    Post subject:
Reply with quote

BTW also searching the forum would have been a good start

search word ==> JOINKEYS
forum ==> dfsort
author Frank Yaeger

and You would have landed here ( one of the many replies )

http://ibmmainframes.com/viewtopic.php?t=53484&highlight=joinkeys

the general rule is to take into account the RDW and add 4 to all field positions
but I am not a sort expert
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Thu Nov 03, 2016 10:42 pm    Post subject: Reply to: match 2 files
Reply with quote

As long as at least one of your JOINKEYS files is of variable-length records, then you can create a variable-length REFORMAT record.

On the other hand, even if both your files are variable-length records you don't have to create a variable-length REFORMAT records.

You create a variable-length REFORMAT record by including the RDW from one input file which contains variable-length records.

Code:
REFORMAT FIELDS=(F2:1,4,F1:5,80,F2:5)


You have to consider short records (they will be padded, you have control over with what) and may need a VLTRIM on some of the OUTFILs.
Back to top
View user's profile Send private message
anatol

New User


Joined: 20 May 2010
Posts: 99
Location: canada

PostPosted: Thu Nov 03, 2016 10:55 pm    Post subject: Reply to: match 2 files
Reply with quote

Thank you, Bill ... unfortunately both files are VB .. with
REFORMAT FIELDS=(F2:1,4,F1:5,80,F2:5) I can get VB records from F2 , but not from F1 ... so I think I have to use 3 steps to get in both, in first, in second
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Thu Nov 03, 2016 11:15 pm    Post subject:
Reply with quote

Quote:
so I think I have to use 3 steps to get in both, in first, in second
I don't think you need 3 steps to do this. Did you try using the "?". Can you show what have you tried.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Thu Nov 03, 2016 11:45 pm    Post subject:
Reply with quote

Quote:
I cannot create VB for file 1 and VB from file 2
This statement is not true. So far you have posted only what you tried with FB data sets nothing with VB. So no point in referring to your initial post which is regarding your FB test.

hmmm... I think we are on the verge of getting locked. icon_smile.gif
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Thu Nov 03, 2016 11:53 pm    Post subject:
Reply with quote

I just ran a test with VB input, and all the 3 outputs - VB again. I don't see a problem here.
Back to top
View user's profile Send private message
anatol

New User


Joined: 20 May 2010
Posts: 99
Location: canada

PostPosted: Fri Nov 04, 2016 12:04 am    Post subject:
Reply with quote

wow Arun, could you please show what you use for test?
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Fri Nov 04, 2016 12:26 am    Post subject: Reply to: match 2 files
Reply with quote

Did anyone read my post?

Try this:

Code:
 REFORMAT FIELDS=(F1:1,4,F1:5,F2:5)


Use that for a JOINKEYS with F1,F2,ONLY and see what you get.

Otherwise, I've already shown a REFORMAT which will get you variable-length records, some of which you'll have to later VLTRIM.
Back to top
View user's profile Send private message
anatol

New User


Joined: 20 May 2010
Posts: 99
Location: canada

PostPosted: Fri Nov 04, 2016 1:01 am    Post subject: Reply to: match 2 files
Reply with quote

ok, actual file is 1000 , not as I ask before .I've used
Code:

  JOINKEYS FILE=F1,FIELDS=(9,71,A)                 
  JOINKEYS FILE=F2,FIELDS=(9,71,A)                 
  JOIN UNPAIRED,F1,F2,ONLY                         
   REFORMAT FIELDS=(F1:1,4,?,F1:5,F2:5)           
  SORT FIELDS=COPY                                 
 OUTFIL FNAMES=INBOTHF,INCLUDE=(5,1,CH,EQ,C'B')   
 OUTFIL FNAMES=INF1ONLY,INCLUDE=(5,1,CH,EQ,C'1')   
 OUTFIL FNAMES=INF2ONLY,INCLUDE=(5,1,CH,EQ,C'2')   

in first and in second file are good, but nothing in file both
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Fri Nov 04, 2016 1:07 am    Post subject:
Reply with quote

Code:
JOIN UNPAIRED,F1,F2,ONLY
You have included ONLY NON MATCHING records.

You need
Code:
JOIN UNPAIRED
OR
Code:
JOIN UNPAIRED,F1,F2
to be able to output matched records too.

The other problem here is you will not know where exactly the file2 record begins, depends on how long is the "current" file1 record which is also of variable length. So BUILDing each output would be tricky.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Fri Nov 04, 2016 1:13 am    Post subject: Reply to: match 2 files
Reply with quote

I'm going to take a heavy axe to this topic shortly. Anyone want to complain, don't bother.

Anatol,

I wasn't suggesting that code for you to use, because you want matches. F1,F2,ONLY will only get you mismatches. If you take off the ,ONLY you'll get REFORMAT records for B, but they would need some work because the F2 data would start immediately after the end of the F1 data.

Your best option is RDW,"fixed" data from one file,"variable" data from the other. Then, on any OUTFIL where the fixed data is used for output, you VLTRIM (be careful not to trim a vital value, so know what data can be in the last position).
Back to top
View user's profile Send private message
anatol

New User


Joined: 20 May 2010
Posts: 99
Location: canada

PostPosted: Fri Nov 04, 2016 1:21 am    Post subject: Reply to: match 2 files
Reply with quote

Thank you all ... I think we all tired of this topic ... it was good learning .. I like sort icon_biggrin.gif
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Fri Nov 04, 2016 4:38 pm    Post subject:
Reply with quote

Quote:
Your best option is RDW,"fixed" data from one file,"variable" data from the other. Then, on any OUTFIL where the fixed data is used for output, you VLTRIM (be careful not to trim a vital value, so know what data can be in the last position).



I was going to say that is what I said anatol should do several posts back.

But wait, my posts are gone. icon_sad.gif

It kinda hurts when you spend time responding, and it gets deleted.

Yea, I know, there were some 'off topic' bantering going on, but most of my posts were on point.

Guess we will never know.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts Low values Results from VARCHAR FORMAT balaji81_k DB2 10 Thu Oct 20, 2016 1:18 am
No new posts output data in CSV Format janmejay COBOL Programming 8 Sat Oct 15, 2016 2:20 pm
This topic is locked: you cannot edit posts or make replies. output data in CSV Format janmejay DFSORT/ICETOOL 3 Sat Oct 15, 2016 2:16 pm
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us