Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Selecting records using SORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Arunkumar Chandrasekaran

New User


Joined: 01 Jun 2010
Posts: 61
Location: India

PostPosted: Wed Nov 28, 2012 12:53 am    Post subject: Selecting records using SORT
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

Moderator


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

PostPosted: Wed Nov 28, 2012 2:07 am    Post subject:
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: 578
Location: USA

PostPosted: Wed Nov 28, 2012 3:05 am    Post subject:
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: 61
Location: India

PostPosted: Wed Nov 28, 2012 11:54 am    Post subject:
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

Moderator


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

PostPosted: Wed Nov 28, 2012 12:21 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7235

PostPosted: Wed Nov 28, 2012 12:25 pm    Post subject: Reply to: Selecting records using SORT
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: 61
Location: India

PostPosted: Wed Nov 28, 2012 8:40 pm    Post subject:
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

Moderator


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

PostPosted: Wed Nov 28, 2012 9:40 pm    Post subject:
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: 61
Location: India

PostPosted: Wed Nov 28, 2012 10:30 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7235

PostPosted: Wed Nov 28, 2012 11:13 pm    Post subject: Reply to: Selecting records using SORT
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    Post subject: Reply to: Selecting records using SORT
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: 61
Location: India

PostPosted: Wed Nov 28, 2012 11:35 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 1 Fri Dec 09, 2016 4:40 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us