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
 

 

comparing two files & write output

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

New User


Joined: 20 Apr 2010
Posts: 21
Location: USA

PostPosted: Thu Feb 07, 2013 10:54 pm    Post subject: comparing two files & write output
Reply with quote

Hi All,

I have following requirement. Can you anyone help me with the code or logic?

Input 1 :
Code:
11
12
13


Input 2 :
Code:
11 a
11 b
11 c
12 d
12 e
13 f
14 g


Output :
Code:
11 abc
11 abc
11 abc
12 de
12 de
13 f


first two byte is key. if key matches merge the data in the 4th byte of the file2 and write the output as many in the file2. ignore the records if does not match.
Back to top
View user's profile Send private message

Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1534
Location: Andromeda Galaxy

PostPosted: Fri Feb 08, 2013 9:59 am    Post subject:
Reply with quote

Hi,

What needs to be the output if FILE 2 contains values a,b,c,d,e,f for a particular key

In other words how many different values can a key can contain
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Fri Feb 08, 2013 10:10 am    Post subject:
Reply with quote

Anbu - Have you tried something, which worked, did not work?
Back to top
View user's profile Send private message
Anbarasan D

New User


Joined: 20 Apr 2010
Posts: 21
Location: USA

PostPosted: Fri Feb 08, 2013 11:19 pm    Post subject:
Reply with quote

Hi Pandora,

It can be any single byte value(Alphanumeric).
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Fri Feb 08, 2013 11:41 pm    Post subject:
Reply with quote

Anbarasan D wrote:
Hi Pandora,

It can be any single byte value(Alphanumeric).


How many single byte values 1, 2, 3, or 15 or 20?

What are the format & record lengths on all three files.
Back to top
View user's profile Send private message
Anbarasan D

New User


Joined: 20 Apr 2010
Posts: 21
Location: USA

PostPosted: Fri Feb 08, 2013 11:44 pm    Post subject:
Reply with quote

Hi,

Only one single byte. All three files are same format and length.
Format - FB
length - 80
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Sat Feb 09, 2013 12:10 am    Post subject:
Reply with quote

Anbarasan D wrote:
Hi,

Only one single byte. All three files are same format and length.
Format - FB
length - 80


Then why does 11 have 3 and 12 have 2?
Back to top
View user's profile Send private message
Anbarasan D

New User


Joined: 20 Apr 2010
Posts: 21
Location: USA

PostPosted: Sat Feb 09, 2013 1:20 am    Post subject:
Reply with quote

Hi,

Quote:
What needs to be the output if FILE 2 contains values a,b,c,d,e,f for a particular key


I told single byte value for Pandora's question which is in 4th byte position in file 2.

Key value in file 2 can be repeated any number of times.
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1534
Location: Andromeda Galaxy

PostPosted: Sat Feb 09, 2013 1:51 am    Post subject:
Reply with quote

Anbu,

I guess the replies are misleading for me

My question is say for Key 11 what if there are more than 70 records?
Back to top
View user's profile Send private message
Anbarasan D

New User


Joined: 20 Apr 2010
Posts: 21
Location: USA

PostPosted: Sat Feb 09, 2013 2:10 am    Post subject:
Reply with quote

Hi Pandora,

Sorry for the confusion.. It will be within 1 to 30 only.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Feb 12, 2013 4:57 am    Post subject:
Reply with quote

Use the following DFSORT JCL which will give you the desired results. I assumed your input is already sorted on the matching key.

The values will be padded next to each other but if you are missing a value then it will have binary zeroes

Code:

//STEP0100 EXEC PGM=SORT                                         
//SYSOUT   DD SYSOUT=*                                           
//INA      DD *                                                   
11 A                                                             
11 B                                                             
11 C                                                             
12 D                                                             
12 E                                                             
13 F                                                             
14 G                                                             
//INB      DD *                                                   
11                                                               
12                                                               
13                                                               
//SORTOUT  DD SYSOUT=*                                           
//SYSIN    DD *                                                   
  OPTION COPY                                                     
  JOINKEYS F1=INA,FIELDS=(1,2,A),SORTED,NOSEQCK                   
  JOINKEYS F2=INB,FIELDS=(1,2,A),SORTED,NOSEQCK                   
  REFORMAT FIELDS=(F1:1,80)             
                         
  INREC IFOUTLEN=80,IFTHEN=(WHEN=INIT,OVERLAY=(81:4,1,4:30Z)),   
  IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,2),PUSH=(82:SEQ=2)),   
  IFTHEN=(WHEN=(82,2,ZD,EQ,01),OVERLAY=(04:81,1)),       
  IFTHEN=(WHEN=(82,2,ZD,EQ,02),OVERLAY=(05:81,1)),       
  IFTHEN=(WHEN=(82,2,ZD,EQ,03),OVERLAY=(06:81,1)),       
  IFTHEN=(WHEN=(82,2,ZD,EQ,04),OVERLAY=(07:81,1)),       
  IFTHEN=(WHEN=(82,2,ZD,EQ,05),OVERLAY=(08:81,1)),       
  IFTHEN=(WHEN=(82,2,ZD,EQ,06),OVERLAY=(09:81,1)),       
  IFTHEN=(WHEN=(82,2,ZD,EQ,07),OVERLAY=(10:81,1)),       
  IFTHEN=(WHEN=(82,2,ZD,EQ,08),OVERLAY=(11:81,1)),       
  IFTHEN=(WHEN=(82,2,ZD,EQ,09),OVERLAY=(12:81,1)),       
  IFTHEN=(WHEN=(82,2,ZD,EQ,10),OVERLAY=(13:81,1)),       
  IFTHEN=(WHEN=(82,2,ZD,EQ,11),OVERLAY=(14:81,1)),       
  IFTHEN=(WHEN=(82,2,ZD,EQ,12),OVERLAY=(15:81,1)),       
  IFTHEN=(WHEN=(82,2,ZD,EQ,13),OVERLAY=(16:81,1)),       
  IFTHEN=(WHEN=(82,2,ZD,EQ,14),OVERLAY=(17:81,1)),       
  IFTHEN=(WHEN=(82,2,ZD,EQ,15),OVERLAY=(18:81,1)),       
  IFTHEN=(WHEN=(82,2,ZD,EQ,16),OVERLAY=(19:81,1)),       
  IFTHEN=(WHEN=(82,2,ZD,EQ,17),OVERLAY=(20:81,1)),       
  IFTHEN=(WHEN=(82,2,ZD,EQ,18),OVERLAY=(21:81,1)),       
  IFTHEN=(WHEN=(82,2,ZD,EQ,19),OVERLAY=(22:81,1)),       
  IFTHEN=(WHEN=(82,2,ZD,EQ,20),OVERLAY=(23:81,1)),       
  IFTHEN=(WHEN=(82,2,ZD,EQ,21),OVERLAY=(24:81,1)),       
  IFTHEN=(WHEN=(82,2,ZD,EQ,22),OVERLAY=(25:81,1)),       
  IFTHEN=(WHEN=(82,2,ZD,EQ,23),OVERLAY=(26:81,1)),       
  IFTHEN=(WHEN=(82,2,ZD,EQ,24),OVERLAY=(27:81,1)),       
  IFTHEN=(WHEN=(82,2,ZD,EQ,25),OVERLAY=(28:81,1)),       
  IFTHEN=(WHEN=(82,2,ZD,EQ,26),OVERLAY=(29:81,1)),       
  IFTHEN=(WHEN=(82,2,ZD,EQ,27),OVERLAY=(30:81,1)),       
  IFTHEN=(WHEN=(82,2,ZD,EQ,28),OVERLAY=(31:81,1)),       
  IFTHEN=(WHEN=(82,2,ZD,EQ,29),OVERLAY=(32:81,1)),       
  IFTHEN=(WHEN=(82,2,ZD,EQ,30),OVERLAY=(33:81,1))       
                                                                   
  OUTFIL REMOVECC,NODETAIL,                                       
  SECTIONS=(1,2,TRAILER3=(1,3,                                     
           TOT=(04,1,BI,BI,LENGTH=1),TOT=(05,1,BI,BI,LENGTH=1),   
           TOT=(06,1,BI,BI,LENGTH=1),TOT=(07,1,BI,BI,LENGTH=1),   
           TOT=(08,1,BI,BI,LENGTH=1),TOT=(09,1,BI,BI,LENGTH=1),   
           TOT=(10,1,BI,BI,LENGTH=1),TOT=(11,1,BI,BI,LENGTH=1),   
           TOT=(12,1,BI,BI,LENGTH=1),TOT=(13,1,BI,BI,LENGTH=1),   
           TOT=(14,1,BI,BI,LENGTH=1),TOT=(15,1,BI,BI,LENGTH=1),   
           TOT=(16,1,BI,BI,LENGTH=1),TOT=(17,1,BI,BI,LENGTH=1),   
           TOT=(18,1,BI,BI,LENGTH=1),TOT=(19,1,BI,BI,LENGTH=1),   
           TOT=(20,1,BI,BI,LENGTH=1),TOT=(21,1,BI,BI,LENGTH=1),   
           TOT=(22,1,BI,BI,LENGTH=1),TOT=(23,1,BI,BI,LENGTH=1),   
           TOT=(24,1,BI,BI,LENGTH=1),TOT=(25,1,BI,BI,LENGTH=1),   
           TOT=(26,1,BI,BI,LENGTH=1),TOT=(27,1,BI,BI,LENGTH=1),   
           TOT=(28,1,BI,BI,LENGTH=1),TOT=(29,1,BI,BI,LENGTH=1),   
           TOT=(30,1,BI,BI,LENGTH=1),TOT=(31,1,BI,BI,LENGTH=1),   
           TOT=(32,1,BI,BI,LENGTH=1),TOT=(33,1,BI,BI,LENGTH=1)))   
//*
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 Append data from two files into a sin... Praveen04 DFSORT/ICETOOL 5 Thu Mar 16, 2017 7:29 pm
No new posts Problem reading GTF trace output danik56 ABENDS & Debugging 7 Thu Mar 16, 2017 1:02 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts How to get current date -1 and curren... murali.andaluri DFSORT/ICETOOL 3 Wed Mar 08, 2017 2:09 pm
No new posts Write R1 and R2 to OP1 and R1 to OP2 bhaskar_kanteti DFSORT/ICETOOL 10 Fri Mar 03, 2017 11:18 am


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