|
View previous topic :: View next topic
|
| Author |
Message |
Aniyaa
New User

Joined: 07 Dec 2007 Posts: 26 Location: Bangalore
|
|
|
|
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 |
|
 |
Manuneedhi K
Active User

Joined: 07 May 2008 Posts: 115 Location: Chennai
|
|
|
|
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 |
|
 |
Aniyaa
New User

Joined: 07 Dec 2007 Posts: 26 Location: Bangalore
|
|
|
|
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 |
|
 |
sril.krishy
Active User
Joined: 30 Jul 2005 Posts: 183 Location: hyderabad
|
|
|
|
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 |
|
 |
0d311
Guest
|
|
|
|
| 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
|
|
|
|
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 |
|
 |
Anuj Dhawan
Superior Member

Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
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 |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
 |
Anuj Dhawan
Superior Member

Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
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 |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
 |
Aniyaa
New User

Joined: 07 Dec 2007 Posts: 26 Location: Bangalore
|
|
|
|
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 |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Thank you for the update
Personally, i believe specific exception handling and implementing business rules is better done in code.
d |
|
| Back to top |
|
 |
Anuj Dhawan
Superior Member

Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
| 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 |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|