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
 

 

Sorting only particular rows from complete file

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

New User


Joined: 06 Mar 2006
Posts: 76
Location: Chennai

PostPosted: Thu Sep 11, 2008 4:37 pm    Post subject: Sorting only particular rows from complete file
Reply with quote

Hi,

I would like to SORT and SUM only some rows from the whole PS file.

Those particular rows have special character 'LINE' at position 4.

This file is VB file, so we can expect any different record length for each row, but 'LINE' row will have record length of 250.

Can any one tell me how can i sort only LINE rows? I can't use INCLUDE or INREC IFTHEM.

Please give me your thoughts.
Back to top
View user's profile Send private message

Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Thu Sep 11, 2008 4:50 pm    Post subject: Reply to: Sorting only particular rows from complete file
Reply with quote

Noork,

Quote:
I can't use INCLUDE or INREC IFTHEM.


Why??

One usually would include the records with 'LINE' starting position 8(as VB) and then sort and sum the fields as per your requirement.

Quote:
I would like to SORT and SUM only some rows from the whole PS file.


You will have to be specific of what needs to be sorted and summed and how.
Back to top
View user's profile Send private message
noorkh

New User


Joined: 06 Mar 2006
Posts: 76
Location: Chennai

PostPosted: Thu Sep 11, 2008 5:58 pm    Post subject:
Reply with quote

Hi Aaru,

Let me explain you with Example.

Let us consider there are 10 rows in a VB file.

position 4
1st row: .................... HIGHT rec length 255
2nd row: .................... LINE rec length 250
3rd row: .................... LOW rec length 120
4th row: .................... HIT rec length 130
5th row: .................... NIGHT
6th row: .................... FREIGHT
7th row: .................... HIGHT
8th row: .................... HIGYNIC
9th row: .................... LINE rec length 250
10th row: .................... HIGHT


now i would like to sort only 2 and 9th row on position 4. Can you now explain me how can i do that?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Thu Sep 11, 2008 6:04 pm    Post subject:
Reply with quote

Sort in respect to what. i.e. Where will the sorted records go within this file.

And may I ask why the restriction on using INCLUDE and/or INREC ?
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Thu Sep 11, 2008 6:09 pm    Post subject:
Reply with quote

Hi,

and what exactly is going to be SUMmed?

and I'm assuming a row is a record ?


Gerry
Back to top
View user's profile Send private message
noorkh

New User


Joined: 06 Mar 2006
Posts: 76
Location: Chennai

PostPosted: Thu Sep 11, 2008 6:32 pm    Post subject:
Reply with quote

Hi Expat,

There is no restriction in using INCLUDE/INREC. i had wrongly mentioned it.

I want to sort only those 2 records because it could be duplicate. and if it is duplicate i would like to sum = none.

I would like to sort on Position 25. which has value PEOPLE. and this sorting should happen only for 2 and 9th record which has Unique value 'LINE' in position 4.

If I Sort on Position 4 and then 25.. and SUM=NONE, then these 2 rows will become single row.

I would like to write this record in the same file along with other records.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Thu Sep 11, 2008 6:41 pm    Post subject:
Reply with quote

If the position within the file of the records with 'LINE' in them is not important, then I would suggest splitting the file into two, those with LINE in them and those without.

Performing your SORT SUM on the LINE records and then concatenating the two files back together again.

If the record position within the file is important then I will leave this one to someone who knows and uses the sort product far better than I do. Although if you read the document for smart tricks with DFSORT I recall an example that puts seq numbers on the records and these could then be used to place the LINE record(s) back in their original places.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Thu Sep 11, 2008 9:42 pm    Post subject: Reply to: Sorting only particular rows from complete file
Reply with quote

noorkh,

As expat mentioned if the position of the records is not mandatory then the following DFSORT JCL will give you the desired results

Code:

//STEP0100 EXEC PGM=ICEMAN                                 
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD DSN=YOUR INPUT VB FILE,
//            DISP=SHR                           
//SORTOUT  DD DSN=yout output vb file,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(X,Y),RLSE)
//SYSIN    DD *                                           
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,SEQNUM,8,ZD,14X,5)), 
    IFTHEN=(WHEN=(30,4,CH,EQ,C'LINE'),OVERLAY=(5:C'1',30,21))
  SORT FIELDS=(5,22,CH,A)                                 
  SUM FIELDS=NONE             
  OUTFIL BUILD=(1,4,27)                                   
/*   


If you do need the records in the original order after eliminating the dups then use the following DFSORT/ICETOOL jcl

Code:

//STEP0100 EXEC PGM=ICETOOL                                         
//TOOLMSG  DD SYSOUT=*                                               
//DFSMSG   DD SYSOUT=*                                               
//IN       DD DSN=YOUR INPUT VB FILE,DISP=SHR
//T1       DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//OUT      DD DSN=yout output vb file,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(X,Y),RLSE)           
//TOOLIN   DD *                                                     
  COPY FROM(IN) USING(CTL1)                                         
  COPY FROM(T1) USING(CTL2)                                         
//CTL1CNTL DD *                                                       
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,SEQNUM,8,ZD,SEQNUM,8,ZD,13X,5)),
    IFTHEN=(WHEN=(37,4,CH,EQ,C'LINE'),OVERLAY=(13:38,21))     
  SORT FIELDS=(13,21,CH,A)                                           
  SUM FIELDS=NONE                   
  OUTFIL FNAMES=T1,BUILD=(1,4,5,8,34)                               
//CTL2CNTL DD *                                                     
  SORT FIELDS=(5,8,CH,A)                                             
  OUTFIL FNAMES=OUT,BUILD=(1,4,13)                                   
/*

Hope this helps...

Cheers
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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm


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