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
 

 

JOIN KEYS to Compare two files using

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
rarvins

New User


Joined: 24 Jan 2007
Posts: 59
Location: Texas

PostPosted: Wed Sep 03, 2008 9:26 pm    Post subject: JOIN KEYS to Compare two files using
Reply with quote

I have a sort code that compares 2 files using JOIN KEYS and I create a reformatted output file that would take some fields from file 1 and some from file 2. Following is the code that I am using:

Code:
//JS001   EXEC PGM=SORT,REGION=0M                               
//*                                                             
//SYSOUT   DD SYSOUT=*                                               
//*                                                             
//SORTJNF1 DD DISP=SHR,DSN=Qual1.file1
//SORTJNF2 DD DISP=SHR,DSN=Qual2.file2
//*                                                             
//SORTOUT  DD DISP=SHR,DSN=Qual3.file3               
//*                                                             
//SYSIN    DD *                                                 
  JOINKEYS FILE=F1,FIELDS=(3,4,A,7,6,A,1,2,A)                   
  JOINKEYS FILE=F2,FIELDS=(1,4,A,5,6,A,11,2,A)                 
  REFORMAT FIELDS=(F1:1,31,F2:13,19,F1:51,692)   
  SORT FIELDS=COPY                               
/*   



In the above mentioned code I am taking a 19 byte field from the 13th position of file2 and all the remaining bytes from file1. But I have an extra condition to be added:

If the 19th byte starting from the 13th position in file2 is spaces then I need to take the same position from file1

Can somebody please help me in adding the condition
Back to top
View user's profile Send private message

Arun Raj

Moderator


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

PostPosted: Thu Sep 04, 2008 9:24 am    Post subject:
Reply with quote

Quote:
If the 19th byte starting from the 13th position in file2 is spaces then I need to take the same position from file1
Hello rarvins,

When the above condition satisifes, do you want to copy the entire 19 bytes from file2 or just the 19th byte alone starting from 13th position?

Thanks,
Arun
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Thu Sep 04, 2008 10:11 am    Post subject:
Reply with quote

Hello,

Please post a small amount of sample input and the output you want from that input.
Back to top
View user's profile Send private message
rarvins

New User


Joined: 24 Jan 2007
Posts: 59
Location: Texas

PostPosted: Thu Sep 04, 2008 8:42 pm    Post subject:
Reply with quote

File1:
Code:

====
(1-2)         (3-6)            (7-12)             (13-31)             
1------------ 2--------------- 3----------------- 4-------------------
           90        116088625            37448446 374314012010768   
           90        128187385          160318665 374314012032267   


File2:
Code:

====
(1-4)            (5-10)             (11-12)       (13-31)             
1--------------- 2----------------- 3------------ 4-------------------
        116088625          37448446            90 4444444444444444   
        128187385        160318665            90 ________________

Where __ stands for blanks in file2

The output of my code would be as follows:
Code:

============================

(1-2)         (3-6)            (7-12)             (13-31)             
1------------ 2--------------- 3----------------- 4-------------------
           90        116088625            37448446 4444444444444444   
           90        128187385          160318665 ________________

If you see the output of my existing code bytes 13-31 alone have been taken from file2 irrespective of it containing a value or a blank.

What I need help on is to populate the 13-31 bytes from file2 only if there is a valid value present. IF positions 13-31 in file2 is spaces then i have to populate the output file from file1 positions 13-31. So the output should be
Code:

(1-2)         (3-6)            (7-12)             (13-31)             
1------------ 2--------------- 3----------------- 4-------------------
           90        116088625            37448446 444444444444444   
           90        128187385          160318665 374314012032267 

Hope this helps.

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

Moderator


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

PostPosted: Thu Sep 04, 2008 8:55 pm    Post subject:
Reply with quote

rarvins,

Its really difficult for somebody to understand the data positions in your sample data. Can you please post the data using the "Code" tag.

Thanks,
Arun
Back to top
View user's profile Send private message
rarvins

New User


Joined: 24 Jan 2007
Posts: 59
Location: Texas

PostPosted: Thu Sep 04, 2008 10:02 pm    Post subject:
Reply with quote

I think its been changed now arcvns. Please let me know if I need to do anything else
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Thu Sep 04, 2008 10:06 pm    Post subject:
Reply with quote

Hello,

Please re-post the input and output data without all of the dashes. Also, make sure the data is the proper length. The data posted does not always appear to match the specified length.

If you both "Code" the data as well as present it similar to data shown with COLS in tso/ispf, you can get something like:
Code:

         1         2         
....+....0....+....0
903456more


Use the Preview to check how your post will appear to toe forum. After you Preview and are satisfied with the post, click Submit.
Back to top
View user's profile Send private message
rarvins

New User


Joined: 24 Jan 2007
Posts: 59
Location: Texas

PostPosted: Fri Sep 05, 2008 1:39 am    Post subject:
Reply with quote

Code:
 File 1:                       
 9012347891021111111111111111111
 9034567891122222222222222222222
                               
 File 2:                       
 1234789102903333333333333333333
 345678911290                   
                               
 Current output:               
 9012347891023333333333333333333
 903456789112                   
                               
 Expected output:               
 9012347891023333333333333333333
 9034567891122222222222222222222


I have changed the sample input and output so that it matches the lengths and the positions properly. Sorry for the inconvenience caused.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Fri Sep 05, 2008 10:17 am    Post subject:
Reply with quote

Hello rarvins,

The below SYNCSORT card will do what you asked for. I have also considered the 692 bytes from the file-1 as posted in your original requirement.
Code:
//SYSIN    DD *                                           
  JOINKEYS FILE=F1,FIELDS=(3,10,A,1,2,A)                   
  JOINKEYS FILE=F2,FIELDS=(1,10,A,11,2,A)                 
  REFORMAT FIELDS=(F1:1,31,F2:13,19,F1:51,692)             
  INREC IFTHEN=(WHEN=(32,19,CH,EQ,C' '),OVERLAY=(32:13,19))
  SORT FIELDS=COPY                                         
  OUTREC BUILD=(1,12,32,711)                               
/* 

Thanks,
Arun
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts compare 2 rows within the same file ram_vizag SYNCSORT 7 Wed Jun 14, 2017 12:34 am
No new posts Reduce CPU Times for Join Sort santoshn SYNCSORT 12 Sat Jun 10, 2017 1:40 pm
No new posts getting three output files out of JOI... migusd SYNCSORT 7 Mon Jun 05, 2017 11:30 pm
No new posts member list compare jzhardy TSO/ISPF 6 Fri May 12, 2017 3:18 pm
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm


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