Sort after a string



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Sort after a string

Postby vinodj » Wed Apr 11, 2012 6:04 pm

I posted following query some days ago :
---------------------------------------------------------------------------------------
I have a PS like this

------------------
-----------------
mainframe > xxxxxxxxxxxxx
ramesh
suresh
nnnn
end of file

I want to search for the string "mainframe >" (this string is constant) using a JCL and then sort all the following records into another file
so the other file will contain all the following records :
ramesh
suresh
nnnn

------------------------------------------------------------------------------------------

I got solution for this as follows and it worked :

//SORTOUT DD SYSOUT=*                                           
//SYSIN DD *                                                     
  OPTION COPY                                                   
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,11,CH,EQ,C'mainframe >'),   
    PUSH=(81:ID=1))                                             
  OUTFIL OMIT=(81,1,CH,EQ,C' ',OR,1,11,CH,EQ,C'mainframe >'),   
    BUILD=(1,80)                                                 
/*


-------------------------------------------------------------------------------------------

Since I did not understand the solution I asked whether my understanding of the solution (which I posted like below) was correct and got an answer that I was correct in my understanding..


WHEN=GROUP means we are working on a group of records (so this is input file)
when 'mainframe >' is encounterd in columns 1 to 11 we are assigning an ID to all the subsequent records( in 81st column). We are then omitting the records that have ID blank or those that start with 'mainframe >'

----------------------------------------------------------------------------------------------

Now I tried to sort the below file using the same solution (there are spaces at the start of 'ramesh', 'suresh', 'nnnn')

------------------
-----------------
mainframe > xxxxxxxxxxxxx
<some spaces>ramesh
<some spaces>suresh
<some spaces>nnnn
end of file

But this solution won't work. The output file is empty. Am I missing something in my understanding?


Regards,
Vinod
vinodj
 
Posts: 29
Joined: Wed Nov 23, 2011 6:16 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Sort after a string

Postby BillyBoyo » Wed Apr 11, 2012 6:49 pm

You have to show the sort cards which you are using. Otherwise we can have no idea.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Sort after a string

Postby skolusu » Wed Apr 11, 2012 9:52 pm

check and see if you input is a VB file. if so then you need to add 4 bytes of RDW to the start position of the field to be checked.
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: Sort after a string

Postby Frank Yaeger » Wed Apr 11, 2012 9:57 pm

As Kolusu says, if your input file has RECFM=VB, then the approach would be somewhat different (insert the id between the RDW and the first data byte).
If you confirm that your input file has RECFM=VB, we can show you how to do it correctly.

If your input file has RECFM=FB, then you need to show us your complete JES log with all of the messages you received so we can try to determine what you're doing wrong.
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
User avatar
Frank Yaeger
Global moderator
 
Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post