---------------------------------------------------------------------------------------
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)
/*
//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