Ron, Assuming that the Emp-status field is on the first record for every Emp-no, the following DFSORT JCL will give you the desired results. I assumed that your LRECL=80 and RECFM=FB
//STEP0100 EXEC PGM=SORT //SYSOUT DD SYSOUT=* //SORTIN DD * 101 10001 T ABC 102 10001 PRS 103 10001 XYE 101 10002 T ABC 102 10002 PRS 103 10002 XYE 101 10003 A ABC 102 10003 PRS 103 10003 XYE //SORTOUT DD SYSOUT=* //SYSIN DD * OPTION COPY INREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(11,5),PUSH=(81:23,1)) OUTFIL BUILD=(1,80),INCLUDE=(81,1,CH,EQ,C'T') //* The output from this job is 101 10001 T ABC 102 10001 PRS 103 10001 XYE 101 10002 T ABC 102 10002 PRS 103 10002 XYE Thanks, Sri Hari Kolusu DFSORT Development IBM Corporation Email: [email protected] Phone: 408-463-2403 Tie Line 543-2403 IBM Mainframe Discussion List <[email protected]> wrote on 09/20/2012 10:54:53 AM: > From: Ron Thomas <[email protected]> > To: [email protected], > Date: 09/20/2012 10:55 AM > Subject: JCL Sort > Sent by: IBM Mainframe Discussion List <[email protected]> > > Hello Listeners, > > I have a input sequential file as below > > segno empno empstatus restofdetails > 101 10001 T ABC > 102 10001 PRS > 103 10001 XYE > 101 10002 T ABC > 102 10002 PRS > 103 10002 XYE > 101 10003 A ABC > 102 10003 PRS > 103 10003 XYE > > > Here in the above file i need to pull all of the records having > empstatus = 'T' using a sort > The issue is if the empstatus is "T'" i need to pull the related of > the empno to the outfile also > > sample o/p is below > > segno empno empstatus restofdetails > 101 10001 T ABC > 102 10001 PRS > 103 10001 XYE > 101 10002 T ABC > 102 10002 PRS > 103 10002 XYE > > Could someone in the list pls let me know how to do the extracation? > > > Regards > Ron T > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to [email protected] with the message: INFO IBM-MAIN > ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
