Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
SYNCSORT Comparing two files with more than 1 condition

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

New User


Joined: 07 Dec 2007
Posts: 26
Location: Bangalore

PostPosted: Wed Jun 04, 2008 4:16 pm    Post subject: SYNCSORT Comparing two files with more than 1 condition
Reply with quote

Please let me know if the following can be done using SYNCSORT.

I have 2 files with 3 columns each... for input
They are

File 1

Col1 Col2 Col3
1 E1 A1
2 E2 A2
3 E3 A3

File 2

Col1 Col2 Col3
1 E1 A1
3 E4 A4
7 E7 E7


Then I need the output file to be

Col1 Col2 Col3 Col4 Col5
3 E3 A3 E4 A4

That is output file should contain only , if Col1 of File 1 = Col1 of File2 and (Col2 or Col3) of File 1 not = (Col2 or col3) of File 2 ...

as you can see the output file should contain columns from both file1 and file 2.
Back to top
View user's profile Send private message

Manuneedhi K

Active User


Joined: 07 May 2008
Posts: 115
Location: Chennai

PostPosted: Wed Jun 04, 2008 4:48 pm    Post subject:
Reply with quote

Try this code.
Code:

//S1 EXEC PGM=SORT                           
//SORTMSG DD SYSOUT=*                         
//DFSMSG DD SYSOUT=*                         
//SYSOUT DD SYSOUT=*                         
//SORTJNF1 DD *                               
1 E1 A1                                       
2 E2 A2                                       
3 E3 A3                                       
//SORTJNF2 DD *                               
1 E1 A1                                       
3 E4 A4                                       
7 E7 E7                                       
//MYOUT DD DSN=USERID.SORTIN,DISP=SHR       
//SYSIN DD *                                 
  OPTION COPY                                 
  JOINKEYS FILES=F1,FIELDS=(1,01,D)           
  JOINKEYS FILES=F2,FIELDS=(1,01,D)           
  REFORMAT FIELDS=(F1:1,80,F2:1,80)           
   OUTFIL FNAMES=MYOUT                           
   OUTREC FIELDS=(1,7,X,83,7,65X)                 
 /*                                               
 //S2 EXEC PGM=SORT                               
 //SORTMSG DD SYSOUT=*                           
 //DFSMSG DD SYSOUT=*                             
 //SYSOUT DD SYSOUT=*                             
 //SORTIN DD DSN=USERID.SORTIN,DISP=SHR         
 //SORTOUT DD DSN=USERID.SORTOUT,DISP=SHR       
 //SYSIN DD *                                     
   SORT FIELDS=COPY                               
   INCLUDE COND=((3,2,CH,NE,9,2,CH),OR,           
                 (6,2,CH,NE,12,2,CH))             
 /*                                               
 //SYSOUT DD SYSOUT=*                             
 //SYSPRINT DD SYSOUT=*


Note: I assumed the LRECL of the file as 80
Back to top
View user's profile Send private message
Aniyaa

New User


Joined: 07 Dec 2007
Posts: 26
Location: Bangalore

PostPosted: Wed Jun 04, 2008 5:10 pm    Post subject:
Reply with quote

Hi , thanks for your solution..
can you pls let me know what X stands for in the below line..

OUTREC FIELDS=(1,7,X,83,7,65X)
Back to top
View user's profile Send private message
sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 183
Location: hyderabad

PostPosted: Wed Jun 04, 2008 5:12 pm    Post subject:
Reply with quote

Aniyaa,
Check the below code.

Code:

//S1       EXEC  PGM=SORT                               
//TOOLMSG  DD SYSOUT=*                                 
//DFSMSG   DD SYSOUT=*                                 
//SYSOUT   DD SYSOUT=*                                 
//SORTJNF1 DD *                                         
1 E1 A1                                                 
2 E2 A2                                                 
3 E3 A3                                                 
//SORTJNF2 DD *                                         
1 E1 A1                                                 
3 E4 A4                                                 
7 E7 E7                                                 
//MYOUT    DD SYSOUT=*                                 
//SYSIN    DD *                                         
  JOINKEYS FILES=F1,FIELDS=(01,01,A)                   
  JOINKEYS FILES=F2,FIELDS=(01,01,A)                   
  REFORMAT FIELDS=(F1:1,7,F2:1,7)                       
  SORT FIELDS=COPY                                     
  OUTFIL FNAMES=MYOUT,INCLUDE=((3,2,CH,NE,10,2,CH),AND,
                      (6,2,CH,NE,13,2,CH)),             
  OUTREC=(1,7,1X,10,5,80:X)                             


Thanks
Back to top
View user's profile Send private message
0d311

Guest





PostPosted: Wed Jun 04, 2008 5:21 pm    Post subject:
Reply with quote

Aniyaa wrote:
Hi , thanks for your solution..
can you pls let me know what X stands for in the below line..

OUTREC FIELDS=(1,7,X,83,7,65X)


'X' stands for space.
Back to top
Aniyaa

New User


Joined: 07 Dec 2007
Posts: 26
Location: Bangalore

PostPosted: Thu Jun 05, 2008 11:13 am    Post subject:
Reply with quote

Hi,

Thanks a lot for all your suggestions . I got the solution right.

Now I have two choices , I can implement the above using a cobol program or using a sort(as you have suggested above).

Which would be better , considering there would be around 60,000 to 70,000 records in each of the input files.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


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

PostPosted: Thu Jun 05, 2008 12:30 pm    Post subject:
Reply with quote

Well,

Run two JOBs one using above sorts & other with the program, check for CPU consumption. Try to run both the JOBs at the same time.
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 Jun 05, 2008 7:46 pm    Post subject:
Reply with quote

Hello,

Quote:
Which would be better , considering there would be around 60,000 to 70,000 records in each of the input files.
This volume should not be an issue either way.

Quote:
Try to run both the JOBs at the same time.
I'd not run them concurrently - there may be performance issues as well as allocation issues. If you run both tests, i'd suggest you run them serially and alternate the order of execution making multiple tests.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


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

PostPosted: Thu Jun 05, 2008 9:59 pm    Post subject:
Reply with quote

Hi Dick,
dick scherrer wrote:
Quote:
Try to run both the JOBs at the same time.
I'd not run them concurrently - there may be performance issues as well as allocation issues. If you run both tests, i'd suggest you run them serially and alternate the order of execution making multiple tests.
Recently, I ran one job two times with the same inputs/setups, but at different times CPU usage were different, so I suggested the above.

For the TS concern, there might be a problem in using the same DSN in both the "concurrent" JOBs (one JOB might go on 'hold') but that DSN name can be changed, while having the same contents, if some one is concerned about performance issues.
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: Fri Jun 06, 2008 2:04 am    Post subject:
Reply with quote

Hello,

Quote:
but at different times CPU usage were different
This should not have an impact on the amount of cpu the "test" job uses. It may impact wall time, but not cpu time needed.

When trying to compare 2 processes like these, it is a good idea to run them in the same job, multiple times, alternating the sequence. This will give a decent approximation of a benchmark without needing to set up some formal benchmark environment.

The 2 items to look at for a simple comparison is cpu time and i/o (excps).
Back to top
View user's profile Send private message
Aniyaa

New User


Joined: 07 Dec 2007
Posts: 26
Location: Bangalore

PostPosted: Mon Jun 09, 2008 2:40 pm    Post subject:
Reply with quote

Thanks a lot for all your suggestions. I have decided to go for the program and not the JCL.. not becos of any performance issues . But becos I can handle exceptions better thru a cobol program.

Thanks
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: Mon Jun 09, 2008 8:14 pm    Post subject: Reply to: SYNCSORT Comparing two files with more than 1 cond
Reply with quote

Thank you for the update icon_smile.gif

Personally, i believe specific exception handling and implementing business rules is better done in code.

d
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


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

PostPosted: Tue Jun 10, 2008 2:49 pm    Post subject:
Reply with quote

Aniyaa wrote:
I can handle exceptions better thru a cobol program.
As a Mianframe progammer I love COBOL code than JCLs to do "magics"..
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 Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 21 Sun Aug 27, 2017 10:35 pm
No new posts Match two files using multiple keys a... santoshks1987 SYNCSORT 11 Fri Aug 18, 2017 10:50 am
No new posts Multiple VSAM files single output fil... Mohan Kothakota DFSORT/ICETOOL 11 Wed Aug 09, 2017 7:57 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us