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 » Mon Nov 28, 2011 6:19 pm

Hello,

My input file is as follows :

mainframe > xx*
xxst1
xxst2
xxstdatasome
xxsomepoints
yyyy
zzzz
end of file

I want to search for string "mainframe >" which is a constant then sort all the subsequent records into output file as follows :

xxst1
xxst2
xxstdatasome
xxsomepoints

here string "xx" is two characters but it is variable e.g. if it is "te" then subsequent records are :
test1
test2
testdatasome
testsomepoints. Please tell me if this can be done and how.

I have code for searching the string "mainframe >" and sorting the subsequent records into output file. This is as follows :
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
------------------
-----------------
mainframe > xxxxxxxxxxxxx
ramesh
suresh
nnnn
//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)
/*
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 » Mon Nov 28, 2011 7:31 pm

Have a look at PUSH. You should be able to store that value from the mainframe> record and OVERLAY or BUILD to include that value in the correct position on your output.
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 Frank Yaeger » Mon Nov 28, 2011 11:41 pm

vinodj,

Your requirement isn't clear. You need to do a better job of explaining it.

Does "mainframe >" always appear in the first record, or can it appear somewhere else (e.g. 5th record).

Do you want to get the 2 characters after 'mainframe > ' and use them to INCLUDE only subsequent records that start with those 2 characters?
If not, exactly what do you want to do?

You say you want to "sort" the subsequent records, but you show the output as unsorted. Do you want the output sorted or not? If you want it sorted, what positions do you want it sorted on?

What is the RECFM and LRECL of your input file?
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

Re: Sort after a string

Postby vinodj » Wed Dec 14, 2011 6:40 pm

Hello Frank and Billy,

Thanks for your reply!
This issue is already solved (I didn't have to do anymore sorting).

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


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post