Home      Mainframe Forum      Mainfarme Tutorials      IBM Manuals      Mainframe Interview Questions      Mainframe Books      IT News     SiteMap     Downloads


     
 
MAINFRAME - TIP OF THE DAY : All available storage is assigned to the job or jobstep, If REGION is coded 0K or 0M

Google
 
Web mainframegurukul.com

DFSORT - JOINKEYS

 
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> DFSORT , ICETOOL & Utilities
  View previous topic :: View next topic  
Author Message
ragsara
Member


Joined: 22 Mar 2012
Posts: 3

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Thu Mar 22, 2012 6:16 pm    Post subject: DFSORT - JOINKEYS Reply with quote

Hi

I am trying to join File F1 and File 2 with keys in position 1 to 75 in both the files.

A key in in F1 contains two matching records in F2. Normally when we perform join two records gets written into the output file.

But according to my requirement, I need only one record in the output. However, I should write the matching columns one after the other in the same record.

For instance, if keys match, I should write position 1 to 75 (key), followed by pos 76 to 200 (the first match), followed by the second match from position 201 to 325.

Is this possible in Joinkeys? if so please help me

Please find the below example
File 1

----+----1----+----2----+----3
00001
00002

File2

----+----1----+----2----+----3
00001 M12345
00001 P12345
00002 M12345
00002 P12345


OUTPUT FILE

----+----1----+----2----+----3
00001 M12345P12345
00002 M12345P12345
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.

Frank Yaeger
Moderator


Joined: 18 Feb 2006
Posts: 812
Location: San Jose, CA

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Thu Mar 22, 2012 10:44 pm    Post subject: Reply with quote

I'd suggest using the a DFSORT/ICETOOL SPLICE job like the following rather than JOINKEYS:

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/75)
//IN2 DD DSN=.... input file2 (FB/200)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/325)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(1,75,CH) WITHANY -
  WITH(76,125) WITH(201,125) WITH(326,1) USING(CTL3)
//CTL1CNTL DD *
  INREC OVERLAY=(326:C'BB',X)
//CTL2CNTL DD *
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(326:C'VV')),
     IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,75),PUSH=(328:SEQ=1)),
     IFTHEN=(WHEN=(328,1,ZD,EQ,2),BUILD=(1,75,201:76,125,326,3))
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,INCLUDE=(326,2,CH,EQ,C'VB'),
    BUILD=(1,325)
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
ragsara
Member


Joined: 22 Mar 2012
Posts: 3

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Fri Mar 23, 2012 2:38 pm    Post subject: Reply with quote

Thanks Frank,

Why i have decided to go for for Join keys is for the following reason,

File1 - 520 (first 75 key)
File2 - 250 (First 75 key)

I need to evaluate 76th position in File 2, to see if its P or M .

Based on this i need to evaluate File1 and File2, here are the scenarios which i need to handle :

1) Nomatch - Keep File1 record alone in the output file. Output file - (520(F1) + 175X(space) + 175X(space))
2) Match with P of File 2 alone - Keep File1 record + P record of File2 . Output file - (520(F1) + 175(P of F2) + 175X(space))
3) Match with M of File2 alone - Keep File 1 record + M record of file2. Output file - (520(F1) + 175X(space) + 175(M of F2) )
4) If matched with both P and M of F2 - Keep File 1 record + P record of File2 + Mrecord of File2. Output file - (520(F1) + 175(P of F2) + 175(M of F2) )

It will be great if we can handle this too in ICETOOL Smile
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Frank Yaeger
Moderator


Joined: 18 Feb 2006
Posts: 812
Location: San Jose, CA

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Fri Mar 23, 2012 10:00 pm    Post subject: Reply with quote

I don't understand how you expect somebody to help you if you only give a small part of your requirement the first time. If you knew you needed all of that you described in your second post, why didn't you say so?

Your full requirement is certainly not clear at this point. In your original example, every record in file1 had a match in file2. Now you're talking about unmatched records as well. You need to start over and show a much better example of input and expected output for your full requirement covering all possible variations including duplicates within file1 and duplicates within file 2 (matching/non-matching) where possible.
_________________
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
ragsara
Member


Joined: 22 Mar 2012
Posts: 3

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
1 salutes

PostPosted: Mon Mar 26, 2012 6:36 pm    Post subject: Reply with quote

Hi Yaeger,
Apologise for not providing you the complete requirement at the first look.

Here is an example of my requiremnet.

File1 :

Record 1: 1-75 (KEY) 76-521 (DATA)


File2 :

Record 1: 1-75 (KEY) 76 (P) 77-277(DATA)
Record 2: 1-75 (KEY) 76 (M) 77-277(DATA)

Output file

Record 1 : 1-75 (KEY File1) 76-521 (DATA File1) 522 ('P' Record1 & File2) 523-708 (Data Record 1 & File2) 709 ('M' Record2 & File2) 710-894 (Data Record 2 & File2)

Scenarios :

1)File 1 wont contain any duplicates.
2)In Normal case , For each Key in File1 , File 2 has two corresponding records (P and M).
3)In abnormal case , If File 1 doesnt have any match then output data corresponding to File 2 has to be populated with spaces.

Output file

Record 1 : 1-75 (KEY File1) 76-521 (DATA File1) 522 ('SPACE' Record1 & File2) 523-708 (SPACE Record 1 & File2) 709 ('SPACE' Record2 & File2) 710-894 ('Space' Record 2 & File2)


4) In certain case where File 2 conatins only 'P' or 'M' record for a match with File1, then 'P' or 'M' data should be populated rest should be populated with spaces. Lets assume only 'M' record is present for a match in File1, then the output file will look like :

Output file

Record 1 : 1-75 (KEY File1) 76-521 (DATA File1) 522 ('Space' Record1 & File2) 523-708 (Space Record 1 & File2) 709 ('M' Record2 & File2) 710-894 (Data Record 2 & File2)



Please let me know if am clear or you need more explanation.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Frank Yaeger
Moderator


Joined: 18 Feb 2006
Posts: 812
Location: San Jose, CA

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Mon Mar 26, 2012 11:35 pm    Post subject: Reply with quote

Quote:
Please let me know if am clear or you need more explanation.


As previously requested, show an example of the records in your input files and the expected output for all possible cases. Your descriptions of the rules are difficult to follow, so examples would certainly help.
_________________
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
academyindia4
Guest





Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Mon Jan 25, 2016 10:29 pm    Post subject: Topic deleted by Admin Reply with quote

<< Content deleted By Admin >>
Back to top
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
academyindia4
Guest





Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Mon Feb 01, 2016 10:06 pm    Post subject: Topic deleted by Admin Reply with quote

<< Content deleted By Admin >>
Back to top
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Display posts from previous:   
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> DFSORT , ICETOOL & Utilities All times are GMT + 5 Hours
Page 1 of 1



 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Related topics
 Topics   Replies   Author   Views   Last Post 
No new posts Query For IEBPTPCH 3 padmajeet.gaikwad 13445 Mon Feb 01, 2016 10:56 pm
academyindia4 View latest post
No new posts Unable to achieve below scenario using ICETOOL 27 sirianangel 33683 Mon Feb 01, 2016 10:01 pm
academyindia4 View latest post
No new posts Need to put records a Sorting order as mentioned below. 14 Yash1911 12633 Mon Jan 25, 2016 9:50 pm
academyindia4 View latest post
No new posts how to deal with the below scenario using iebgener 7 mainframes_6002 11170 Wed Dec 07, 2011 10:34 am
DikDude View latest post
No new posts Coulu someone explain the parameters in the below code? 1 lovely sweety 11352 Thu Jun 09, 2011 3:50 pm
dbzTHEdinosauer View latest post
 


Cobol Tutorial
This cobol tutorial covers most of the important topics like STRING, UNSTRING, COMP, COMP-3.....
DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. Explains in simple language. Some Chapters are locked, Forum members have free access to these chapters
CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming...
JCL Tutorial
This is most popular JCL tutorial from mainframegurukul. It does contain important jcl ....
SORT Tutorial
This Tutorial covers all important aspects of DFSORT. Has more SORT examples
INTERVIEW Questions
This page covers important interview questions
Mainframe Jobs
Mainframe Jobs posted by members of mainframegurukul forum
FaceBook Page
MainframeGurukul FaceBook Page
LinkedIn Page
MainframeGurkul Linkedin Page

This widget requires Flash Player 9 or better







Go to top of the page
 

Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  DB2 INTERVIEW QUESTIONS ||  COBOL INTERVIEW QUESTIONS  ||  JCL INTERVIEW QUESTIONS ||  JCL2 INTERVIEW QUESTIONS ||  VSAM INTERVIEW QUESTIONS ||  CICS INTERVIEW QUESTIONS  ||  Online tutorials ||  Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  SiteMap  ||  Expeditor Tutorial  ||  FILE-AID Tutorial  ||  Changeman Tutorial  ||  COBOL   ||  DB2   ||  JCL  ||  CICS  ||  VSAM  ||  DB2 Interview Questions ( 110 )   || Simple JCL Tutorials  || JCL Tutorial from MainframeGurukul.com   || Simple JCL Tutorial - Chapter1 ;|| Mainframe Forum - Tutorials  || Mainframe Tutorials || Mainframe CICS tutorial|| Mainframe COBOL Tutorial

Drona Educational Forums - Mainframe Cobol DB2 CICS Board
Powered by phpBB

mainframetopic-6372.html