Page 2 of 3

Re: Detail record sorting

PostPosted: Fri Feb 17, 2012 3:21 pm
by purva
Please suggest if its okay now.
Thanks for explaining me properly Nick.

123456789012345678901234567890
HH
AS,1234567,H,N,20120217
JR,W,2210
JR,W,2211
JR,w,2212
AS,1234561,H,N,20120215
JR,W,2201
JR,W,2202
JR,w,2203
TT
123456789012345678901234567890


Thanks,
Purva

Re: Detail record sorting

PostPosted: Fri Feb 17, 2012 3:38 pm
by purva
Hi Enrico,

I have posted 'POSTREPLY'the input file data in 'Code Tags', please look into it ans let me know.

Regards,
Purva

Re: Detail record sorting

PostPosted: Fri Feb 17, 2012 3:40 pm
by Nik22Dec
Purva,

Please try using the below given sample sort card. This is just to give you an idea. Please try & let us know if you come across any issues.

OPTION COPY                                           
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,7,CH,EQ,C'RAJEEV'),
END=(1,7,CH,EQ,C'SAMEER'),PUSH=(11:ID=2))             
SORT FIELDS=(11,2,ZD,A,1,7,CH,A)                     
OUTFIL INCLUDE=(11,2,CH,NE,C' '),BUILD=(1,7)         


PS: Learn to respond to those people who are trying to help you with some respect starting with spelling their names corectly.

Re: Detail record sorting

PostPosted: Fri Feb 17, 2012 3:41 pm
by Nik22Dec
You might also want to have a look on this link -

ftp://ftp.software.ibm.com/storage/dfsort/mvs/sorttrck.pdf

Re: Detail record sorting

PostPosted: Fri Feb 17, 2012 3:42 pm
by enrico-sorichetti
You can see that it looks better Yourself,
but if You did not know how to use tags, wouldn' t have been simpler to ask after my first comment ???

@Nik the link You posted does not seem to work ( http://www-01.ibm.com/support/docview.w ... g3T7000094 )

and ... Nick instead of Nik seems a very minor misspelling to me
( my name has been mangled in much worse ways ) ;)

Re: Detail record sorting

PostPosted: Fri Feb 17, 2012 3:48 pm
by Nik22Dec
Enrico,

A 3 character name deserves to be spelled correctly. Doesn't it?

I have corrected the link address. Try accessing it now.

Also, how does the SORT Card looks to you. Conceptually, I know this is right but, somehow, it is not working as expected at my site. Looks like some installation issue. What do you think?

Re: Detail record sorting

PostPosted: Fri Feb 17, 2012 4:29 pm
by enrico-sorichetti
apart the record layout and some missing information from the TS
I would rather go with something along the lines of


 000005 //ICE     EXEC PGM=SORT                                                 
 000006 //SYSPRINT  DD SYSOUT=*                                                 
 000007 //SYSOUT    DD SYSOUT=*                                                 
 000008 //SORTIN    DD *                                                       
 000009 AS EMP1 HEADER                                                         
 000010 JR 1 EMP1                                                               
 000011 JR 2 EMP1                                                               
 000012 JR 3 EMP1                                                               
 000013 AS EMP0 HEADER                                                         
 000014 JR 3 EMP0                                                               
 000015 JR 4 EMP0                                                               
 000016 JR 1 EMP0                                                               
 000017 JR 2 EMP0                                                               
 000018 AS EMP5 HEADER                                                         
 000019 JR 1 EMP5                                                               
 000020 JR 2 EMP5                                                               
 000021 JR 3 EMP5                                                               
 000022 JR 4 EMP5                                                               
 000023 AS EMP2 HEADER                                                         
 000024 JR 1 EMP2                                                               
 000025 JR 2 EMP2                                                               
 000026 JR 3 EMP2                                                               
 000027 JR 4 EMP2                                                               
 000028 //SORTOUT   DD SYSOUT=*,                                               
 000029 //             DCB=(RECFM=FB,LRECL=80)                                 
 000030 //SYSIN     DD *                                                       
 000031   SORT   FIELDS=(51,4,CH,A,61,4,ZD,A)                                   
 000032   INREC  IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,C'AS'),                   
 000033                  PUSH=(51:4,4,61:SEQ=4))                               

which gives as output

********************************* TOP OF DATA **********************************
AS EMP0 HEADER                                    EMP0      0001               
JR 3 EMP0                                         EMP0      0002               
JR 4 EMP0                                         EMP0      0003               
JR 1 EMP0                                         EMP0      0004               
JR 2 EMP0                                         EMP0      0005               
AS EMP1 HEADER                                    EMP1      0001               
JR 1 EMP1                                         EMP1      0002               
JR 2 EMP1                                         EMP1      0003               
JR 3 EMP1                                         EMP1      0004               
AS EMP2 HEADER                                    EMP2      0001               
JR 1 EMP2                                         EMP2      0002               
JR 2 EMP2                                         EMP2      0003               
JR 3 EMP2                                         EMP2      0004               
JR 4 EMP2                                         EMP2      0005               
AS EMP5 HEADER                                    EMP5      0001               
JR 1 EMP5                                         EMP5      0002               
JR 2 EMP5                                         EMP5      0003               
JR 3 EMP5                                         EMP5      0004               
JR 4 EMP5                                         EMP5      0005               
******************************** BOTTOM OF DATA ********************************


I did not cleanup the record to show the <auxiliary> sort fields

Re: Detail record sorting

PostPosted: Fri Feb 17, 2012 4:34 pm
by purva
This is what exatly I am looking for. Thanks a ton Enrico!!

Regards,
Purva

Re: Detail record sorting

PostPosted: Fri Feb 17, 2012 4:41 pm
by enrico-sorichetti
and here is the same using ICETOOL to take care of the header and trailer


 000004 //ICE     EXEC PGM=ICETOOL                                             
 000005 //TOOLMSG   DD SYSOUT=*                                                 
 000006 //DFSMSG    DD SYSOUT=*                                                 
 000007 //IN1       DD *                                                       
 000008 HH                                                                     
 000009 AS EMP1 HEADER                                                         
 000010 JR 1 EMP1                                                               
 000011 JR 2 EMP1                                                               
 000012 JR 3 EMP1                                                               
 000013 AS EMP0 HEADER                                                         
 000014 JR 3 EMP0                                                               
 000015 JR 4 EMP0                                                               
 000016 JR 1 EMP0                                                               
 000017 JR 2 EMP0                                                               
 000018 AS EMP5 HEADER                                                         
 000019 JR 1 EMP5                                                               
 000020 JR 2 EMP5                                                               
 000021 JR 3 EMP5                                                               
 000022 JR 4 EMP5                                                               
 000023 AS EMP2 HEADER                                                         
 000024 JR 1 EMP2                                                               
 000025 JR 2 EMP2                                                               
 000026 JR 3 EMP2                                                               
 000027 JR 4 EMP2                                                               
 000028 TT                                                                     
 000029 //OUT       DD SYSOUT=*                                                 
 000030 //TOOLIN    DD *                                                       
 000031   DATASORT FROM(IN1) TO(OUT) USING(CTL1) HEADER(1) TRAILER(1)           
 000032 //CTL1CNTL DD *                                                         
 000033   SORT   FIELDS=(51,4,CH,A,61,4,ZD,A)                                   
 000034   INREC  IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,C'AS'),                   
 000035                  PUSH=(51:4,4,61:SEQ=4))                   


********************************* TOP OF DATA **********************************
HH                                                                             
AS EMP0 HEADER                                    EMP0      0001               
JR 3 EMP0                                         EMP0      0002               
JR 4 EMP0                                         EMP0      0003               
JR 1 EMP0                                         EMP0      0004               
JR 2 EMP0                                         EMP0      0005               
AS EMP1 HEADER                                    EMP1      0001               
JR 1 EMP1                                         EMP1      0002               
JR 2 EMP1                                         EMP1      0003               
JR 3 EMP1                                         EMP1      0004               
AS EMP2 HEADER                                    EMP2      0001               
JR 1 EMP2                                         EMP2      0002               
JR 2 EMP2                                         EMP2      0003               
JR 3 EMP2                                         EMP2      0004               
JR 4 EMP2                                         EMP2      0005               
AS EMP5 HEADER                                    EMP5      0001               
JR 1 EMP5                                         EMP5      0002               
JR 2 EMP5                                         EMP5      0003               
JR 3 EMP5                                         EMP5      0004               
JR 4 EMP5                                         EMP5      0005               
TT                                                                             
******************************** BOTTOM OF DATA ********************************

Re: Detail record sorting

PostPosted: Fri Feb 17, 2012 4:51 pm
by Nik22Dec
Enrico,

Did you get a chance to look at my Sort Card. I am trying to understand why is it not working.