Page 1 of 2

moving of matched and unmatched records

PostPosted: Fri Sep 03, 2010 6:45 pm
by shyamsaravan
Hi;
I used the synsort to write a matched and unmatched records to two different files.
JCL is
//STEP0100 EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=*                                       
//INA      DD *                                               
F2010-06-16125ESB46066361                                     
F2010-06-16125ESB77777777                                     
F2010-06-16125ESB12345678                                     
F2010-06-16125ESB23456789                                     
F2010-06-16125ESB98765432                                     
//INB      DD *                                               
F2010-06-16125ESB46066361                                     
F2010-06-16125ESB98765432                                     
F2010-06-16125ESB55555555                                     
F2010-06-16125ESB23456789                                     
F2010-06-16125ESB66666666                                     
F2010-06-16125ESB12345678                                     
//MATCH    DD SYSOUT=*                                       
//UNMATCH  DD SYSOUT=*                                       
//SYSIN    DD *                                               
  OPTION COPY                                                 
  JOINKEYS F1=INA,FIELDS=(1,25,A)                             
  JOINKEYS F2=INB,FIELDS=(1,25,A)                             
  JOIN UNPAIRED                                               
  REFORMAT FIELDS=(?,F1:1,80,F2:1,80)                         
  OUTFIL FNAMES=MATCH,INCLUDE=(1,1,CH,EQ,C'B'),BUILD=(1,80)   
  OUTFIL FNAMES=UNMATCH,SAVE,                                 
  IFTHEN=(WHEN=(1,1,ZD,EQ,1),BUILD=(02,80)),                 
  IFTHEN=(WHEN=(1,1,ZD,EQ,2),BUILD=(82,80))                   
//*


when i am doing 'JJ'
E1  8 DSS20011E  DD 'SORTIN' WAS NOT ALLOCATED.         
E2  8 DSS11051E  UNRECOGNIZED 'SORT' KEYWORD 'JOINKEYS'.
E3  8 DSS11051E  UNRECOGNIZED 'SORT' KEYWORD 'JOINKEYS'.
E4  8 DSS11051E  UNRECOGNIZED 'SORT' KEYWORD 'JOIN'.     
E5  8 DSS11051E  UNRECOGNIZED 'SORT' KEYWORD 'REFORMAT'.

When i ran the jcl,abended and below message got at SYSOUT.What it does mean?
1 SYNCSORT FOR Z/OS  1.3.2.1R    U.S. PATENTS: 4210961, 5117495
                                      ABCCOMPANY
  SYNCSORT LICENSED FOR CPU SERIAL NUMBER A0E5F, MODEL 2094 507
  SYSIN :                                                       
    OPTION COPY                                                 
    JOINKEYS F1=INA,FIELDS=(1,25,A)                             
             *                                                 
    JOINKEYS F2=INB,FIELDS=(1,25,A)                             
             *                                                 
    JOIN UNPAIRED                                               
    REFORMAT FIELDS=(?,F1:1,80,F2:1,80)                         
             *                                                 
    OUTFIL FNAMES=MATCH,INCLUDE=(1,1,CH,EQ,C'B'),BUILD=(1,80)   
    OUTFIL FNAMES=UNMATCH,SAVE,                                 
    IFTHEN=(WHEN=(1,1,ZD,EQ,1),BUILD=(02,80)),                 
      IFTHEN=(WHEN=(1,1,ZD,EQ,2),BUILD=(82,80))                 
  WER268A  JOINKEYS STATEMENT: SYNTAX ERROR                     
  WER268A  JOINKEYS STATEMENT: SYNTAX ERROR                     
  WER268A  REFORMAT STATEMENT: SYNTAX ERROR     

Re: moving of matched and unmatched records

PostPosted: Fri Sep 03, 2010 8:24 pm
by Alissa Margulies
That is not the correct syntax for SyncSort. The following should give you the desired output:
//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*   
//SORTJNF1 DD *         
F2010-06-16125ESB46066361
F2010-06-16125ESB77777777
F2010-06-16125ESB12345678
F2010-06-16125ESB23456789
F2010-06-16125ESB98765432
//SORTJNF2 DD *         
F2010-06-16125ESB46066361
F2010-06-16125ESB98765432
F2010-06-16125ESB55555555
F2010-06-16125ESB23456789
F2010-06-16125ESB66666666
F2010-06-16125ESB12345678
//MATCH    DD SYSOUT=*   
//UNMATCH  DD SYSOUT=*         
//SYSIN    DD *                                               
  JOINKEYS FILES=F1,FIELDS=(1,25,A)                           
  JOINKEYS FILES=F2,FIELDS=(1,25,A)                           
  JOIN UNPAIRED                                               
  REFORMAT FIELDS=(F1:1,80,F2:1,80)                           
  SORT FIELDS=COPY                                           
  OUTFIL FNAMES=MATCH,                                       
     INCLUDE=(1,1,CH,NE,C' ',AND,81,1,CH,NE,C' '),BUILD=(1,80)
  OUTFIL FNAMES=UNMATCH,                                     
    IFTHEN=(WHEN=(1,1,CH,NE,C' '),BUILD=(01,80)),             
    IFTHEN=(WHEN=(1,1,CH,EQ,C' '),BUILD=(81,80))             
/*

Re: moving of matched and unmatched records

PostPosted: Mon Sep 06, 2010 3:45 pm
by shyamsaravan
Hi;
Thanks Alissa,I ran the JCL,below is the output
Matched records output
F2010-06-16125ESB12345678
F2010-06-16125ESB23456789
F2010-06-16125ESB46066361
F2010-06-16125ESB98765432

Unmatched records output
F2010-06-16125ESB12345678
F2010-06-16125ESB23456789
F2010-06-16125ESB46066361
F2010-06-16125ESB55555555
F2010-06-16125ESB66666666
F2010-06-16125ESB77777777
F2010-06-16125ESB98765432

I got unmatched records ouput has repeated matched records also
My unmatched records output should like
F2010-06-16125ESB55555555
F2010-06-16125ESB66666666
F2010-06-16125ESB77777777

OUTFIL FNAMES=UNMATCH,
IFTHEN=(WHEN=(1,1,CH,NE,C' '),BUILD=(01,80)),
IFTHEN=(WHEN=(1,1,CH,EQ,C' '),BUILD=(81,80))

Im trying to write the unmatched records to noe file,but it asks LRECL=160,BLKSIZE=5320 format.
I need to write both match and unmatch records to two different LRECL=80 bytes files
Please Help;

Re: moving of matched and unmatched records

PostPosted: Tue Sep 07, 2010 1:25 am
by Thampy
Change the second Outfil statement as below.

OUTFIL FNAMES=UNMATCH,SAVE,
IFTHEN=(WHEN=(1,1,CH,NE,C' '),BUILD=(01,80)),
IFTHEN=(WHEN=(1,1,CH,EQ,C' '),BUILD=(81,80))

Re: moving of matched and unmatched records

PostPosted: Tue Sep 07, 2010 12:36 pm
by shyamsaravan
Hi;
Thanks Thampy,the only unmatched records moved to UNMATCH file
Im trying to write the unmatched records to noe file,but it asks LRECL=160,BLKSIZE=5320 format.
I need to write both match and unmatch records to two different LRECL=80 bytes files


My question is,why the unmatched records file has LRECL=160 bytes instead of 80bytes ?
I tried to write unmatch records at 80 bytes file,but it is abended,,I want to do at 80bytes file

Re: moving of matched and unmatched records

PostPosted: Tue Sep 07, 2010 8:00 pm
by Alissa Margulies
shyamsaravan wrote:I got unmatched records ouput has repeated matched records also

Thampy wrote:Change the second Outfil statement as below.

OUTFIL FNAMES=UNMATCH,SAVE,
IFTHEN=(WHEN=(1,1,CH,NE,C' '),BUILD=(01,80)),
IFTHEN=(WHEN=(1,1,CH,EQ,C' '),BUILD=(81,80))

Yes, that is correct. Simple mistake of cut/paste. Thank you for pointing that out and making the correction.

Re: moving of matched and unmatched records

PostPosted: Tue Sep 07, 2010 8:21 pm
by Alissa Margulies
shyamsaravan wrote:Im trying to write the unmatched records to noe file,but it asks LRECL=160,BLKSIZE=5320 format.
I need to write both match and unmatch records to two different LRECL=80 bytes files

The following code will produce an 80-byte LRECL for the unmatched records:
OUTFIL FNAMES=UNMATCH,SAVE,                     
  IFTHEN=(WHEN=(1,1,CH,NE,C' '),BUILD=(01,80)),
  IFTHEN=(WHEN=NONE,BUILD=(81,80))             

Re: moving of matched and unmatched records

PostPosted: Wed Sep 08, 2010 1:21 pm
by shyamsaravan
Thanks Alissa;

It is working fine :D

Re: moving of matched and unmatched records

PostPosted: Tue Sep 11, 2012 7:17 pm
by BGronli
Looks like I am barking up the wrong tree, we have DFSORT, so I need to figure it out for that toolset. Thanks.

I am looking to join 2 files, both have lrecl of 455, keys are 1,32,CH,A,81,39,CH,A. I am looking to retain all unmatched records from both files plus matched records from file 1. The code shown in this post looks like it will probably do the trick, but there are a couple of things I am unsure of, such as:

INCLUDE=(1,1,CH,NE,C' ',AND,81,1,CH,NE,C' '),BUILD=(1,80)
What does the 81 represent here? and why the check to see if the first position is not a space?

IFTHEN=(WHEN=NONE,BUILD=(81,80))
Again, why 81 here?

Thank you.

Re: moving of matched and unmatched records

PostPosted: Tue Sep 11, 2012 7:22 pm
by NicC
beacause, I believe, JOINKEYS physically joins the 2 records internally. The first record is bytes 1-80 and the second byte 81-160.

Now, I got that info from reading the forums every day - do likewise and you will learn a lot more - possibly more than you will need but you never know when a new job opportunity might require some knowledge that you would not otherwise have.