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
 

 

Comparison of twofiles using another file

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

New User


Joined: 07 Mar 2009
Posts: 8
Location: mangalore

PostPosted: Sat Mar 07, 2009 6:32 pm    Post subject: Comparison of twofiles using another file
Reply with quote

I want the solution for the below problem.
The datasets(fiels )are as below
TEST-1:
Code:
COL1(6) COL2(20)     COL3(30)
Numeric Alphanumeric Alphanumeric
000001  Kash N karry United States
001200  Walmart      Australia
123456  Delhize      United States
099912  Pepsi        Brazil
564721  Thumsup      Newzealand
000010  Kingfisher   Southafrica

TEST-2:
Code:
COL1(6) COL2(20)     COL3(30)
Numeric Alphanumeric Alphanumeric
500001  Kash N karry United States
601200  Walmart      Australia
123456  Delhize      United States
599912  Pepsi        Brazil
564721  Thumsup      Newzealand
500010  Kingfisher   Southafrica


REF:
Code:
COL1(6) COL2(6)
Numeric Numeric
000001  500001
001200  601200
000010  500010
099912  599912


I want to compare TEST-1 and TEST-2 record by record
My condition is COL1(TEST-2)=COL1( TEST-1)
COL1(TEST-2)=COL2(REF) for COL1(TEST-1)= COL1(REF)



If the first condition is met status=’C’
If the second condition is met status=’NC’ in OUTPUT dataset
And the output dataset should look like this
OUTPUT:
Code:
COL1(6) from file:TEST-1 COL1(6) from file:TEST-2 Status
Numeric                  Numeric                  Character
000001                   500001                   C
001200                   601200                   C
123456                   123456                   NC
099912                   599912                   C
564721                   564721                   NC
000010                   500010                   C


Above C:change ,NC:No Change
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Sun Mar 08, 2009 8:52 pm    Post subject:
Reply with quote

Quote:
I want to compare TEST-1 and TEST-2 record by record
My condition is COL1(TEST-2)=COL1( TEST-1)
COL1(TEST-2)=COL2(REF) for COL1(TEST-1)= COL1(REF)

If the first condition is met status=’C’
If the second condition is met status=’NC’ in OUTPUT dataset



These rules are not clear and don't seem to match your example.

File1 record 1 COL1 is 000001 and File2 record 1 COL1 is 500001 so they don't match, yet you show C for that output record. It only gets worse from there. I have no idea what you mean by:

COL1(TEST-2)=COL2(REF) for COL1(TEST-1)= COL1(REF)

You need to do a better job of explaining the "rules" and how they work for your example records.
Back to top
View user's profile Send private message
vanakar

New User


Joined: 07 Mar 2009
Posts: 8
Location: mangalore

PostPosted: Mon Mar 09, 2009 5:22 pm    Post subject: Reply to: Comparison of twofiles using another file
Reply with quote

for the first record in TEST-1 the colomn1 is 000001 which is also present in colomn1 in REF, so corresponding colomn2 value in REF should be present in colomn1 in TEST-2. if they are matched, then status in output is 'C"
i hope now you have got it
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Mon Mar 09, 2009 9:39 pm    Post subject: Reply to: Comparison of twofiles using another file
Reply with quote

vanakar,

The following DFSORT/ICETOOL JCL will give you the desired results



Code:

//STEP0100 EXEC PGM=ICETOOL                                           
//TOOLMSG  DD SYSOUT=*                                               
//DFSMSG   DD SYSOUT=*                                               
//TEST1    DD *                                                       
000001  KASH N KARRY       UNITED STATES                             
001200  WALMART            AUSTRALIA                                 
123456  DELHIZE            UNITED STATES                             
099912  PEPSI              BRAZIL                                     
564721  THUMSUP            NEWZEALAND                                 
000010  KINGFISHER         SOUTHAFRICA                               
//TEST2    DD *                                                       
500001  KASH N KARRY       UNITED STATES                             
601200  WALMART            AUSTRALIA                                 
123456  DELHIZE            UNITED STATES                             
599912  PEPSI              BRAZIL                                     
564721  THUMSUP            NEWZEALAND                                 
500010  KINGFISHER         SOUTHAFRICA                               
//REF      DD *                                                       
000001500001                                                         
001200601200                                                         
000010500010                                                         
099912599912                                                         
//T1       DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(CYL,(1,1),RLSE)         
//T2       DD DSN=&&T2,DISP=(MOD,PASS),SPACE=(CYL,(1,1),RLSE)         
//OUT      DD SYSOUT=*                                               
//TOOLIN   DD *                                                       
  COPY FROM(REF)   USING(CTL1)                                       
  COPY FROM(TEST1) USING(CTL2)                                       
  COPY FROM(TEST2) USING(CTL4)                                       
  SPLICE FROM(T1) TO(T2) KEEPNODUPS ON(1,6,CH) WITH(1,6) USING(CTL3) 
  SPLICE FROM(T2) TO(OUT) KEEPNODUPS ON(1,6,CH) WITH(7,7) USING(CTL5)
//CTL1CNTL DD *                                           
  OUTFIL FNAMES=T1,BUILD=(1,6,7,6)                       
//CTL2CNTL DD *                                           
  OUTFIL FNAMES=T1,BUILD=(1,6,6X)                         
//CTL3CNTL DD *                                           
  OUTFIL FNAMES=T2,IFOUTLEN=13,                           
  IFTHEN=(WHEN=(7,6,CH,NE,C' '),BUILD=(7,6,1,6,C'C'))     
//CTL4CNTL DD *                                           
  OUTFIL FNAMES=T2,BUILD=(1,6,7X)                         
//CTL5CNTL DD *                                           
  OUTFIL FNAMES=OUT,IFOUTLEN=16,                         
  IFTHEN=(WHEN=INIT,BUILD=(1,6,X,7,6,X,13,1,X)),         
  IFTHEN=(WHEN=(8,6,CH,EQ,C' '),OVERLAY=(8:1,6,15:C'NC'))
/*


The output from this job is

Code:

123456 123456 NC
500001 000001 C
500010 000010 C
564721 564721 NC
599912 099912 C
601200 001200 C
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 Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 3 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


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