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

Selecting records using SORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Arunkumar Chandrasekaran

New User


Joined: 01 Jun 2010
Posts: 63
Location: India

PostPosted: Wed Nov 28, 2012 12:53 am
Reply with quote

Hi,

I am having 2 input files.

INPUTfile:1
-------------
VSAMfile,KEY=(1,8,CH)
field1=(10,2,BI)
Have duplicate keys in file

Inputfile-2
--------------
PDS member,key =(1,8,CH)
NO duplicate keys in file.

I need to match these 2 files in SORT (joinkeys) and have to append the field1 for the matched records present in inputfile-2.the field-1 should be appended from the last matched record in input file-1.while appending the field-1 we should covert into displayable format(FS).

Input file-1
---------------
Code:
AAAAAAAA  12
AAAAAAAA  15
AAAAAAAA  10
BBBBBBBB  78
BBBBBBBB  66
CCCCCCC  34
CCCCCCC  56


input file-2
------------
Code:
AAAAAAAA
BBBBBBBB
CCCCCCC



OUTPUT:
----------
Code:
AAAAAAAA 10
BBBBBBBB 66
CCCCCCC 56


I can do it in sort in multiple steps(using joinkeys,outrec fields,remove cc,no detail) and i tried.
but I need to do it in one step.I believe
it is feasible.please help.
also let me know if you are not clear with my requirement.

Code'd
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed Nov 28, 2012 2:07 am
Reply with quote

What have tried so far?

Show us input and output with the control cards used in code tags please
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Wed Nov 28, 2012 3:05 am
Reply with quote

Arunkumar Chandrasekaran,
Do you have numbers in varying positions in your input OR is this an just an issue with the way your data was "Code'd"?

Regardless,
Quote:
I can do it in sort in multiple steps(using joinkeys,outrec fields,remove cc,no detail) and i tried.
but I need to do it in one step.I believe ...
This is still one step process. Unless you coded different cards for each of this. icon_biggrin.gif icon_biggrin.gif icon_biggrin.gif

Thanks,
Back to top
View user's profile Send private message
Arunkumar Chandrasekaran

New User


Joined: 01 Jun 2010
Posts: 63
Location: India

PostPosted: Wed Nov 28, 2012 11:54 am
Reply with quote

Hi,
No i am not having varying positions.its the issue with "Code'd".
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed Nov 28, 2012 12:21 pm
Reply with quote

If yes please provide your input with code tags ??

or confirm if this is how your input File 1 looks like

Code:
AAAAAAAA  12
AAAAAAAA  15
AAAAAAAA  10
BBBBBBBB  78
BBBBBBBB  66
CCCCCCC   34
CCCCCCC   56
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Nov 28, 2012 12:25 pm
Reply with quote

No, it is an issue with you not Code'ing and Preview'ing in the first place, so that you can ensure that we see your data how you should want us to see - like you see it, and with all the spacing you put into it. We don't want to spend our time making your information usable, we want you to do that in the first place. We absolutely do not want to guess what your data looks like if you are so unconcerned as to not bother with it much yourself.

And show your sort cards. As Pandora-Box and Sqlcode1 are alluding, what you say does not make sense.
Back to top
View user's profile Send private message
Arunkumar Chandrasekaran

New User


Joined: 01 Jun 2010
Posts: 63
Location: India

PostPosted: Wed Nov 28, 2012 8:40 pm
Reply with quote

Hi Sorry for the confusion.Yes its like what Pandora-Box mentioned.

Here is my SYSIN

Code:
 //JNF1CNTL DD *                               
  INREC BUILD=(5,09,10:14,2,BI,TO=ZD,LENGTH=5)     - convering BI to ZD in VSAM file
/*                                             
//SYSIN DD *                                   
  JOINKEYS FILE=F1,FIELDS=(01,08,A)           
  JOINKEYS FILE=F2,FIELDS=(01,08,A)           
  REFORMAT FIELDS=(F2:01,8,F1:10,05)                   
  OPTION COPY                                 
/*                   
 

Here I could get all the matched records as expected.but I couldnt get the field1 in diaplayable format it is coming in same binary format even i converted it in INREC BUILD.

Please advise me where I am wrong??
also I have to get only the last matched record for each key.Can I use REMOVE CC,NO DETAIL in JOINkeys????
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed Nov 28, 2012 9:40 pm
Reply with quote

Why did you use INREC BUILD 5,9 here
Back to top
View user's profile Send private message
Arunkumar Chandrasekaran

New User


Joined: 01 Jun 2010
Posts: 63
Location: India

PostPosted: Wed Nov 28, 2012 10:30 pm
Reply with quote

Hi I wanted to copy the first 9 data bytes of my VSAM file as it is.Thats why I did it.Is it wrong??

Now I modified my SYSIN and now I can get the BI in displayable format.

Code:
//SYSIN DD *                                 
  JOINKEYS FILE=F1,FIELDS=(01,08,A)         
  JOINKEYS FILE=F2,FIELDS=(01,08,A)         
  REFORMAT FIELDS=(F2:01,8,F1:10,02)       
  OUTREC FIELDS=(1,8,9,2,BI,TO=FS,LENGTH=5)
  OPTION COPY

Now all I need is I want to just keep my last matched record for each key.I dont want all matched records.Can i do it here??? USing REMOVE CC ,NODETAIL .

I have used REMOVE CC,NO DETAIL to get last record of PS but here I want to get the last record for every matched KEY.Please advise
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Nov 28, 2012 11:13 pm
Reply with quote

A JOINKEYS application is in two parts. The JOINKEYS task (actually there are two of them) and the maintask.

In the maintask you can do your OUTFIL with REMOVECC,NODETAIL etc. Try it and post your results, please, as it may help someone else in the future.

If you are successfully using 5,9, that is OK as it means you are using the VSAM as a variable-length record file, and a pseudo-RDW is generated, which you then ignore by starting at position 5.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Wed Nov 28, 2012 11:14 pm
Reply with quote

Arunkumar Chandrasekaran,

use the following control cards.

Code:

//SYSIN    DD *                                           
  OPTION COPY                                             
  JOINKEYS F1=INA,FIELDS=(1,8,A),TYPE=F                   
  JOINKEYS F2=INB,FIELDS=(1,8,A)                         
  REFORMAT FIELDS=(F2:1,8,F1:10,2)                       
  INREC OVERLAY=(9:9,2,BI,TO=FS,LENGTH=5)                 
  OUTFIL REMOVECC,NODETAIL,SECTIONS=(1,8,TRAILER3=(1,13))
//*
Back to top
View user's profile Send private message
Arunkumar Chandrasekaran

New User


Joined: 01 Jun 2010
Posts: 63
Location: India

PostPosted: Wed Nov 28, 2012 11:35 pm
Reply with quote

@Skolusu
Hi I tried this and working perfect!!!!!!!!!!!

Thanks a lot for all !!!!
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 5
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top