IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Joinkeys - unpaired keys


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
jctgf
Currently Banned

Active User


Joined: 04 Nov 2006
Posts: 109

PostPosted: Wed Mar 31, 2010 12:31 am
Reply with quote

hi there,
i'd like to compare 2 files and write an output file containing only one column with all the unpaired keys in both files.
i'd would like a file like this:
Code:
AAA
CCC
EEE

the code below produces a file with 2 columns, like this:
Code:

AAA***     
***CCC     
***EEE     


Code:
//*---------------------------------------------------------------------
//SORT      EXEC  PGM=SORT,REGION=40M                                   
//SYSOUT    DD SYSOUT=*                                                 
//$ORTPARM  DD DSN=CARDLIB(EVTSRT01),DISP=SHR                           
//SORTJNF1  DD *                                                       
AAA5                                                                   
BBB6                                                                   
//SORTJNF2  DD *                                                       
BBB9                                                                   
CCC8                                                                   
EEE0                                                                   
//SORTOUT   DD SYSOUT=*                                                 
//SYSIN     DD *                                                       
 JOINKEYS FILE=F1,FIELDS=(1,3,A),SORTED                                 
 JOINKEYS FILE=F2,FIELDS=(1,3,A),SORTED                                 
 JOIN UNPAIRED,ONLY                                                     
 REFORMAT FIELDS=(F1:1,3,F2:1,3),FILL=C'*'                             
 


is there a simple way to produce the file i need?
thanks.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Mar 31, 2010 12:50 am
Reply with quote

Here's a DFSORT JOINKEYS job that will do what you asked for (you didn't show what's in the EVTSRT01 member, so I ignored it. If you need something in there, show what you need.

Code:

//SORT      EXEC  PGM=SORT,REGION=40M                     
//SYSOUT    DD SYSOUT=*                                   
//SORTJNF1  DD *                                           
AAA5                                                       
BBB6                                                       
//SORTJNF2  DD *                                           
BBB9                                                       
CCC8                                                       
EEE0                                                       
//SORTOUT   DD SYSOUT=*                                   
//SYSIN     DD *                                           
 JOINKEYS FILE=F1,FIELDS=(1,3,A),SORTED                   
 JOINKEYS FILE=F2,FIELDS=(1,3,A),SORTED                   
 JOIN UNPAIRED,ONLY                                       
 REFORMAT FIELDS=(F1:1,3,F2:1,3,?)                         
 OPTION COPY                                               
 OUTFIL IFTHEN=(WHEN=(7,1,CH,EQ,C'1'),BUILD=(1,3)),       
        IFTHEN=(WHEN=(7,1,CH,EQ,C'2'),BUILD=(4,3))         
/*


SORTOUT would have:

Code:

AAA   
CCC   
EEE   
Back to top
View user's profile Send private message
jctgf
Currently Banned

Active User


Joined: 04 Nov 2006
Posts: 109

PostPosted: Wed Mar 31, 2010 3:01 am
Reply with quote

Hi,
Thanks.
I have a few questions, please:

Code:

REFORMAT FIELDS=(F1:1,3,F2:1,3,?)         
 

What's the purpose of the interrogation mark?

Code:

 OUTFIL IFTHEN=(WHEN=(7,1,CH,EQ,C'1'),BUILD=(1,3)),       
        IFTHEN=(WHEN=(7,1,CH,EQ,C'2'),BUILD=(4,3))

I don't understand how the intermediate file would have 1 or 2 in column 7. Is it because of the interrogation mark?
Thanks again.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Mar 31, 2010 3:07 am
Reply with quote

jctgf,

? indicates a 1-byte indicator is to be included in each joined record. The indicator will be set to one of the following values in each paired or unpaired joined record, as appropriate:

'B' - the key was found in F1 and F2.
'1' - the key was found in F1, but not in F2.
'2' - the key was found in F2, but not in F1.

This is explained in detail in here

www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000174
Back to top
View user's profile Send private message
jctgf
Currently Banned

Active User


Joined: 04 Nov 2006
Posts: 109

PostPosted: Wed Mar 31, 2010 9:15 pm
Reply with quote

hi,

I'm receiving the following syntax error:

Code:

   Display  Filter  View  Print  Options  Help                                 
 -------------------------------------------------------------------------------
 DESA OUTPUT DISPLAY J9487777 JOB08967  DSID   108 LINE 1       COLUMNS 02- 81 
 COMMAND INPUT ===>                                            SCROLL ===> CSR 
 SYNCSORT FOR Z/OS  1.3.2.1N    U.S. PATENTS: 4210961, 5117495   (C) 2007 SYNCSO
                                                       z/OS   1.11.0           
 $ORTPARM : VSCORET=40M                                                         
  OPTION MAINSIZE=40M                                                           
 SYSIN :                                                                       
  JOINKEYS FILE=F1,FIELDS=(1,3,A),SORTED                                       
  JOINKEYS FILE=F2,FIELDS=(1,3,A),SORTED                                       
  JOIN UNPAIRED,ONLY                                                           
  REFORMAT FIELDS=(F1:1,3,F2:1,3,?)                                             
                                *                                               
  OPTION COPY                                                                   
  OUTFIL IFTHEN=(WHEN=(7,1,CH,EQ,C'1'),BUILD=(1,3)),                           
         IFTHEN=(WHEN=(7,1,CH,EQ,C'2'),BUILD=(4,3))                             
 WER903I  SYNCSORT 1.3.2.1 IS NOT LICENSED FOR SERIAL 104AF, TYPE 2094 741, LPAR
 WER903I  PRODUCT WILL STOP WORKING IN  36 DAYS UNLESS A VALID KEY IS INSTALLED.
 WER161B  ALTERNATE PARM USED                                                   
 WER268A  REFORMAT STATEMENT: SYNTAX ERROR                                     
 WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                                 
 WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                                 
******************************** BOTTOM OF DATA ********************************


thanks for any help.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Mar 31, 2010 10:30 pm
Reply with quote

Since you originally posted in the DFSORT Forum, we assumed you were using DFSORT and gave you a solution that works fine with DFSORT. However, the WER messages indicate you're using Syncsort, not DFSORT.

Please post Syncsort questions in the JCL Forum in the future.
Back to top
View user's profile Send private message
jctgf
Currently Banned

Active User


Joined: 04 Nov 2006
Posts: 109

PostPosted: Wed Mar 31, 2010 11:38 pm
Reply with quote

ok.
usually, the syntax is the same.

Code:
   
//SORTJNF1  DD *                                           
AAA5                                                       
BBB6                                                       
//SORTJNF2  DD *                                           
BBB9                                                       
CCC8                                                       
EEE0                                                       
//SORTOUT   DD SYSOUT=*                                   
//SYSIN     DD *                                           
 JOINKEYS FILE=F1,FIELDS=(1,3,A),SORTED                   
 JOINKEYS FILE=F2,FIELDS=(1,3,A),SORTED                   
 JOIN UNPAIRED,ONLY                                       
 REFORMAT FIELDS=(F1:1,3,F2:1,3),FILL=C'*'                 
 SORT FIELDS=(4,1,A),FORMAT=BI                             
 OUTFIL IFTHEN=(WHEN=(1,3,CH,EQ,C'***'),BUILD=(4,3)),     
        IFTHEN=(WHEN=(4,3,CH,EQ,C'***'),BUILD=(1,3))       

In syncsort I did like this, but I wonder if there's a better way.

thanks.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Mar 31, 2010 11:45 pm
Reply with quote

Quote:
usually, the syntax is the same.


Not in this case. DFSORT supports the ? for the indicator. Syncsort does not.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Wed Mar 31, 2010 11:48 pm
Reply with quote

Quote:

usually, the syntax is the same.


Should this be translated to? 'Thank you so much for spending your own free time on this. I am so sorry I wasted your time.'

Quote:

could someone tell me how to do this via syncsort, please?


Should this be translated to? 'Eventhough the syntax is the same, and I could probably take this from here... Could someone else please do my work for me?'
Back to top
View user's profile Send private message
somunote

New User


Joined: 23 Jan 2010
Posts: 7
Location: Toronto

PostPosted: Wed Mar 31, 2010 11:58 pm
Reply with quote

Quote:
Should this be translated to? 'Eventhough the syntax is the same, and I could probably take this from here... Could someone else please do my work for me?'


no, your interpretation is mistaken.
i've posted a solution (didn't you see?) that works, but would like to know if some one else has a better suggestion.
that's all.
thanks.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Thu Apr 01, 2010 12:06 am
Reply with quote

The post had been edited while I was posting my reply?

You, somunote, or jctgf, which ever you are, made the change in the post.

I am glad you found your solution.

You see, the issue is bigger than just your post.

Many people, especially in the DFSORT/Syncsort realm, do not take the time to post enough information.

Frank and Kolusu, spend alot of time providing DFSORT solutions.

When it doesn't work because the OP has Syncsort, the OP thinks nothing of it.

The time those guys (and others) spend doing other peoples work for them (for which they get paid), is taken totally for granted.

Then they ask for a Syncsort solution.
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Thu Apr 01, 2010 9:49 pm
Reply with quote

Here is a SyncSort for z/OS JOIN application that will produce the requested output:
Code:
//SORT   EXEC PGM=SORT                 
//SYSOUT   DD SYSOUT=*                 
//SORTJNF1 DD *                       
AAA5                                   
BBB6                                   
//SORTJNF2 DD *                       
BBB9                                   
CCC8                                   
EEE0                                   
//SORTOUT  DD SYSOUT=*                 
//SYSIN    DD *                       
 JOINKEYS FILE=F1,FIELDS=(1,3,A),SORTED
 JOINKEYS FILE=F2,FIELDS=(1,3,A),SORTED
 JOIN UNPAIRED,ONLY                   
 SORT FIELDS=COPY                     
 OUTREC BUILD=(5,3),VTOF
/*
Back to top
View user's profile Send private message
krunalbafna
Warnings : 1

Active User


Joined: 18 Jan 2010
Posts: 143
Location: Pune

PostPosted: Fri Nov 25, 2011 3:15 pm
Reply with quote

Hi,
As in previous post you are getting output as
AAA
CCC
EEE

But i want only in my output as AAA only from file-1. none of unpaired records from file-2 should be present in the output file.
May you please help?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Nov 25, 2011 6:32 pm
Reply with quote

after 100 posts You should know how ...
Quote:
Start NewTopic
Start a new topic to post your queries. Do not ask your doubts as a reply to another post. Posts are to be made in relevant category/Forum. If you can't find one, post in Other Mainframe topics(e.g. Do not post SQL queries in COBOL Forum).


and tagging questions to a 1 year old topic will not help either
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Mon Nov 28, 2011 9:17 pm
Reply with quote

krunalbafna,

I agree with Enrico, however, the solution to your inquiry is quite simple. Modify the JOIN statement as follows:
Code:

JOIN UNPAIRED,F1,ONLY

This should produce the output you desire.
Back to top
View user's profile Send private message
krunalbafna
Warnings : 1

Active User


Joined: 18 Jan 2010
Posts: 143
Location: Pune

PostPosted: Tue Nov 29, 2011 10:07 am
Reply with quote

Thanks a lot.
I knew I have to post a new topic. But as the issue was similar and i was referring the above post, thought of posting it here.

thanks for the suggestion. I shall keep this in mind.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
No new posts PD not working for unsigned packed JO... DFSORT/ICETOOL 5
No new posts Def PD not working for unsigned packe... JCL & VSAM 3
No new posts Use input file with OMIT rcd keys? DFSORT/ICETOOL 15
No new posts how to keep unpaired records with REPRO. JCL & VSAM 9
Search our Forums:

Back to Top