Page 1 of 1

SYNCSORT to match 2 files and write selected info

PostPosted: Fri Feb 19, 2010 11:04 am
by manjeera.bonakurthi
Hi....
I need to compare two files using SORT based on composit key (Acc.no+time+date)(which is present in both files).
If it is same for specific records in two files then I have to write the Trnsction number field(which is present in both files) for that perticular rec.into a third file.

Re: SYNCSORT to match 2 files and write selected info

PostPosted: Fri Feb 19, 2010 11:20 am
by dick scherrer
Hello and welcome to the forum,

When you have a question, please start a new topic for your question (your question has been split into a new topic).

For someone to help, you need to post some sample input data from both files and the output you want from this input. Mention the relevant data positions and the recfm and lrecl of the files. The sample data should include all possible data combinations (i.e. mis-matched data, duplicate keys, etc). When posting data use the "Code" tag to preserve alignment and improve readability.

Explain any rules for getting from the input to the output.

Re: SYNCSORT to match 2 files and write selected info

PostPosted: Fri Feb 19, 2010 11:43 am
by manjeera.bonakurthi
Thank u for ur suggession ...

I have two i/p files like this..

File 1 :
Tras-id acc.no date     time     amt
1       1234   12/3/10  12:20:23 5000
2       1234   04/3/10  12:20:23 5000
3       2345   11/4/10  11:34:28 10000
4       2345   05/4/10  04:45:28 10000


File 2:
Tras-id acc.no date     time     amt
11      1234   12/3/10  12:20:23 5000
22      1234   05/3/10  01:45:23 5000
33      2345   05/4/10  04:45:28 10000
44      4567   01/4/10  11:34:28 10000

I want o/p file to b..( i have to match acc.no ,date n time in both files)...

File 3
1 11
4 33


edited: coded

Re: SYNCSORT to match 2 files and write selected info

PostPosted: Fri Feb 19, 2010 10:38 pm
by Alissa Margulies
Here is a SyncSort for z/OS job that will produce your requested output:
//SORT1  EXEC PGM=SORT                             
//SORTJNF1 DD *                                   
1       1234   12/3/10  12:20:23 5000             
2       1234   04/3/10  12:20:23 5000             
3       2345   11/4/10  11:34:28 10000           
4       2345   05/4/10  04:45:28 10000           
//SORTJNF2 DD *                                   
11      1234   12/3/10  12:20:23 5000             
22      1234   05/3/10  01:45:23 5000             
33      2345   05/4/10  04:45:28 10000           
44      4567   01/4/10  11:34:28 10000           
//SORTOUT  DD SYSOUT=*                             
//SYSOUT   DD SYSOUT=*                             
//SYSIN    DD *                                     
   JOINKEYS FILES=F1,FIELDS=(9,4,A,16,8,A,25,8,A)
   JOINKEYS FILES=F2,FIELDS=(9,4,A,16,8,A,25,8,A)
   REFORMAT FIELDS=(F1:1,2,F2:1,2)               
   SORT FIELDS=COPY                               
/*                                               

Re: SYNCSORT to match 2 files and write selected info

PostPosted: Mon Feb 22, 2010 10:57 am
by manjeera.bonakurthi
Hi...
Thank u for your solution.
But when am trying this giving a sortout file ... am getting an empty file..

Re: SYNCSORT to match 2 files and write selected info

PostPosted: Mon Feb 22, 2010 11:10 am
by dick scherrer
Hello,

Do not post "it didn't work". . . This provides nothing for anyone to use to help tou.

You need to post the job you submitted (jcl and sort control), the informational output from the sort and a bit of the actual inputs.

Re: SYNCSORT to match 2 files and write selected info

PostPosted: Mon Feb 22, 2010 1:58 pm
by manjeera.bonakurthi
This is the info of two i/p files.. Data Set Information
Command ===>

Data Set Name . . . . : WXX093.MANJEERA.TEST1

General Data Current Allocation
Management class . . : TPS035 Allocated cylinders : 1
Storage class . . . : DEFAULT Allocated extents . : 1
Volume serial . . . : MIZABB
Device type . . . . : 3390
Data class . . . . . : NONSTD Current Utilization
Organization . . . : PS Used cylinders . . : 1
Record format . . . : VB Used extents . . . : 1
Record length . . . : 80
Block size . . . . : 800
1st extent cylinders: 1
Secondary cylinders : 3
Data set name type : SMS Compressible : NO

Creation date . . . : 2010/02/18 Referenced date . . : 2010/02/21
Expiration date . . : ***None***




Data Set Name . . . . : WXX093.MANJEERA.TEST2

General Data Current Allocation
Management class . . : TPS035 Allocated cylinders : 1
Storage class . . . : DEFAULT Allocated extents . : 1
Volume serial . . . : MIZAA1
Device type . . . . : 3390
Data class . . . . . : NONSTD Current Utilization
Organization . . . : PS Used cylinders . . : 1
Record format . . . : VB Used extents . . . : 1
Record length . . . : 80
Block size . . . . : 800
1st extent cylinders: 1
Secondary cylinders : 3
Data set name type : SMS Compressible : NO

Creation date . . . : 2010/02/18 Referenced date . . : 2010/02/21
Expiration date . . : ***None***


These are the contents of two i/p files

WXX093.MANJEERA.TEST1

000001 1 1234 12/3/10 12:20:23 5000
000002 2 1234 04/3/10 12:20:23 5000
000003 3 2345 11/4/10 11:34:28 10000
000004 4 2345 05/4/10 04:45:28 10000

WXX093.MANJEERA.TEST2

11 1234 12/3/10 12:20:23 5000
22 1234 05/3/10 01:45:23 5000
33 2345 05/4/10 04:45:28 10000
44 4567 01/4/10 11:34:28 10000

This is the jcl i have submitted....

//PS010 EXEC PGM=SORT
//*
//* INPUT FILE
//*
//SORTJNF1 DD DSN=WXX093.MANJEERA.TEST1,
// DISP=SHR
//SORTJNF2 DD DSN=WXX093.MANJEERA.TEST2,
// DISP=SHR
//*
//SORTOUT DD DSN=WXX093.MANJEERA.OUT,
// DISP=(NEW,CATLG,CATLG)
//*
//*
//SYSIN DD *
JOINKEYS FILES=F1,FIELDS=(9,4,A,16,8,A,25,8,A)
JOINKEYS FILES=F2,FIELDS=(9,4,A,16,8,A,25,8,A)
REFORMAT FIELDS=(F1:1,2,F2:1,2)
SORT FIELDS=COPY
/*
//SYSOUT DD SYSOUT=*
//*
//SYSPRINT DD SYSOUT=*
//*

Re: SYNCSORT to match 2 files and write selected info

PostPosted: Mon Feb 22, 2010 3:03 pm
by manjeera.bonakurthi
This is the first i/p file..WXX093.MANJEERA.TEST1

1 1234 12/3/10 12:20:23 5000
2 1234 04/3/10 12:20:23 50000
3 3 2345 11/4/10 11:34:28 10000
4 4 2345 05/4/10 04:45:28 10000

Re: SYNCSORT to match 2 files and write selected info

PostPosted: Mon Feb 22, 2010 9:14 pm
by Alissa Margulies
Please use code tags for your input records so we can see the actual field positions. Thank you.
For example
[code]
1 1234 12/3/10 12:20:23 5000
2 1234 04/3/10 12:20:23 50000
3 3 2345 11/4/10 11:34:28 10000
4 4 2345 05/4/10 04:45:28 10000
[/code]

Re: SYNCSORT to match 2 files and write selected info

PostPosted: Wed Feb 24, 2010 11:07 am
by arcvns
JOINKEYS FILES=F1,FIELDS=(9,4,A,16,8,A,25,8,A)
JOINKEYS FILES=F2,FIELDS=(9,4,A,16,8,A,25,8,A)
The key fields are at different positions in the input files shown by you. But you have mentioned the same field positions in the sort card you used. Change the field positions as per the actual field positions and rerun your sort job or else post the starting position and length of each relevant field along with some sample input data using "Code" tags.