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
 

 

How to use SORT for below Quey

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

New User


Joined: 06 May 2008
Posts: 90
Location: Chennai

PostPosted: Tue Apr 02, 2013 11:59 pm    Post subject: How to use SORT for below Quey
Reply with quote

I want to use SORT function to do the following function.

Input FILE
Code:

1,2,3,4  EMC6RAH1 ndqlndlqndlqnldnql
2,3,4    EMC6RAH2 ndqlndlqndlqnldnql
1,3,4    EMC6RAH3 ndqlndlqndlqnldnql
3,4      EMC6RAH1 ndqlndlqndlqnldnql



Output File
Code:

EMC6RAH1
EMC6RAH2
EMC6RAH3


Input file is of RECLENGTH = 80
Basically I want to remove duplicates from the Input files taking in consideration the fields starting from position 16 and 8 length.

And output file should only have unique rows and only the data which start from position 16 and 8 length.

Can anyone please guide me some initial steps which I can use to acheive this.
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Wed Apr 03, 2013 12:14 am    Post subject: Reply to: How to use SORT for below Quey
Reply with quote

Have a look in the manual at how the different parts of the SORT hang together.

You need to SORT your data. SUM FIELDS=NONE can get rid of the duplicates.

To get the minimum amount of data into SORT, use INREC to prepare only the data you need. You can use BUILD on INREC.

Code:
  INREC BUILD=(for you to determine)
  SORT FIELDS=(again straightforward)
  SUM FIELDS=(NONE)
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Wed Apr 03, 2013 12:19 am    Post subject: Reply to: How to use SORT for below Quey
Reply with quote

Your INPUT and OUTPUT does not match.

Position 16 for 8 bytes has the following

Code:

----+----1----+----2----+----3----+----4----+
1,2,3,4  EMC6RAH1 NDQLNDLQNDLQNLDNQL         
2,3,4    EMC6RAH2 NDQLNDLQNDLQNLDNQL         
1,3,4    EMC6RAH3 NDQLNDLQNDLQNLDNQL         
3,4      EMC6RAH1 NDQLNDLQNDLQNLDNQL         


H1 NDQLN
H2 NDQLN
H3 NDQLN
H1 NDQLN


Your Output shows the contents from position 10. is your Input a VB file? or FB file?

As Bill points out it is an elementary task.

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000080
Back to top
View user's profile Send private message
scorp_rahul23

New User


Joined: 06 May 2008
Posts: 90
Location: Chennai

PostPosted: Thu Apr 04, 2013 4:20 pm    Post subject: Reply to: How to use SORT for below Quey
Reply with quote

I have used below conditions

Code:

//SYSIN DD *                         
    INREC BUILD=(1:16,8)             
    SORT FIELDS=(16,8,CH,A)         
    SUM FIELDS=NONE                 
*/                                   


And Input file is like

Code:


----+----1----+----2----+----3----+----4----+
1,2,3,4        EMC6RAH1 NDQLNDLQNDLQNLDNQL         
2,3,4          EMC6RAH2 NDQLNDLQNDLQNLDNQL         
1,3,4          EMC6RAH3 NDQLNDLQNDLQNLDNQL         
3,4            EMC6RAH1 NDQLNDLQNDLQNLDNQL         




I am getting below error

Code:


3 INVALID DATA SET ATTRIBUTES: SORTOUT  RECFM   - REASON CODE IS 08   
0 VLSHRT NOT USED FOR SORT, MERGE, INCLUDE, OMIT OR SUM STATEMENT FIELD

Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Thu Apr 04, 2013 4:28 pm    Post subject: Reply to: How to use SORT for below Quey
Reply with quote

Can you post the messages including the message numbers, please?
Back to top
View user's profile Send private message
scorp_rahul23

New User


Joined: 06 May 2008
Posts: 90
Location: Chennai

PostPosted: Thu Apr 04, 2013 4:35 pm    Post subject: Reply to: How to use SORT for below Quey
Reply with quote

Code:

ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES A
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R12 - 06:47 ON THU A
              INREC BUILD=(1:16,8)                                             
              SORT FIELDS=(16,8,CH,A)                                         
              SUM FIELDS=NONE                                                 
          */                                                                   
ICE043A 3 INVALID DATA SET ATTRIBUTES: SORTOUT  RECFM   - REASON CODE IS 08   
ICE150I 0 VLSHRT NOT USED FOR SORT, MERGE, INCLUDE, OMIT OR SUM STATEMENT FIELD
Back to top
View user's profile Send private message
scorp_rahul23

New User


Joined: 06 May 2008
Posts: 90
Location: Chennai

PostPosted: Thu Apr 04, 2013 4:55 pm    Post subject: Reply to: How to use SORT for below Quey
Reply with quote

I got it write finally

//SYSIN DD *
SORT FIELDS=(16,8,CH,A)
SUM FIELDS=NONE
OUTREC FIELDS=(1:16,8)
*/
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1715
Location: UK

PostPosted: Thu Apr 04, 2013 4:58 pm    Post subject:
Reply with quote

Why do you have '*/' in your sort control cards?
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Thu Apr 04, 2013 5:03 pm    Post subject: Reply to: How to use SORT for below Quey
Reply with quote

Is your input variable (as Kolusu guessed already?)

Try:

Code:
//SYSIN DD *
  INREC BUILD=(1,4,16,8)
  SORT FIELDS=(5,8,CH,A)
  SUM FIELDS=NONE


If you input is variable and you want your output fixed, look at OUTFIL and VTOF.
Back to top
View user's profile Send private message
chandan.inst

Active User


Joined: 03 Nov 2005
Posts: 269
Location: Mumbai

PostPosted: Thu Apr 04, 2013 5:07 pm    Post subject: Re: Reply to: How to use SORT for below Quey
Reply with quote

scorp_rahul23 wrote:
I have used below conditions

Code:

//SYSIN DD *                         
    INREC BUILD=(1:16,8)             
    SORT FIELDS=(16,8,CH,A)         
    SUM FIELDS=NONE                 
*/                                   




For this change the code as below and it will work

Code:
//SYSIN DD *                         
    INREC BUILD=(1:16,8)             
    SORT FIELDS=(1,8,CH,A)         
    SUM FIELDS=NONE           


I am not sure but I guess Inrec will be more efficient than Outrec..
May be Bill or Skolusu can confirm on this

Regards,
Chandan
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Thu Apr 04, 2013 5:48 pm    Post subject: Reply to: How to use SORT for below Quey
Reply with quote

The less data which goes into the actual SORT, the better. Unless dependent on the sorted order (like the need to use WHEN=GROUP, or similar), "cutting down" a record should be done with INREC.

BUILD would never need "1:", as this is the default. Columns in BUILD can lead to spaces in between fields, which may be the design, or not. Can also lead to "overlapping" fields, which is not allowed on BUILD.

I thing the problem is that the input is variable, requiring the input RDW (position one for length of four) to be included in the INREC record.

scorp_rahul23,

I avoid using FIELDS= in such situations. It is equivalent to BUILD, and is there for "backwards compatibility" for Sort Control Decks written many years ago. FIELDS is very "overloaded" (the same word meaning different things in different contexts, like SUM, SORT, INCLUDE/OMIT), so just because you can, doesn't mean it is a good idea to do so.

If you can clear up the variable/fixed question for your input and output, we can finish this off.
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 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 Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


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