Sort jcl

In this Mainframe Forum - You can post your queries on JCL, OS/390 JCL, MVS JCL, z/OS JCL, JES2 & JES3

Moderators: Frank Yaeger, DikDude, Moderator Group

Post Reply
Nanda Kishore
Member
Posts: 5
Joined: Mon Dec 10, 2007 7:48 pm

Sort jcl

Post by Nanda Kishore » Tue Dec 11, 2007 1:36 pm

Hi,

Can we sort in such a manner that out put file contains the records which have only those starting 'WN' using inrec fields


example:


Input file:

Code: Select all

ORIG     COPE     LSYS     PSB        SEP        
PSBNAME  PSBNAME  NAME     DESCRIP    REGN IND   
-------- -------- -------- ---------- --------   
WNADV    C0581082 IMSM69   ADDED PSB  Y 
WcARC    C0394782 *ALL*    ONLINE PSB   
WdAWH    C0473834 *ALL*    ONLINE PSB   
WcBKT    C0393790 *ALL*    ONLINE PSB   
WfBLD    C0394783 *ALL*    ONLINE PSB   
WdBLT    C0393791 *ALL*    ONLINE PSB   
WfBTF    C0393485 *ALL*    ONLINE PSB   
WcBTL    C0449354 *ALL*    ONLINE PSB Y 
WNBTL    C0501818 IMSM00   ADDED PSB  Y 
WNBTL    C0501841 IMSM01   ADDED PSB  Y 
WNBTL    C0501819 IMSM02   ADDED PSB  Y 
out put file

Code: Select all

ORIG     COPE   
PSBNAME  PSBNAM 
------------------------------ 
WNADV    C0581082 
WNBTL    C0501818 
WNcst    C0501841 
WNckv    C0501819 
Regards,
Kishore

User avatar
Krishna
Site Admin
Posts: 1052
Joined: Fri Jan 27, 2006 7:50 am

SORT JCL USING INCLUDE COND

Post by Krishna » Tue Dec 11, 2007 2:22 pm

Try Following

Code: Select all

//SYSIN    DD * 
    SORT FIELDS=COPY 
     INCLUDE COND=(1,2,CH,EQ,C'WN') 
/* 


Nanda Kishore
Member
Posts: 5
Joined: Mon Dec 10, 2007 7:48 pm

Post by Nanda Kishore » Wed Dec 12, 2007 9:42 am

Hi Krishna,

Thanks for the reply.

But i think your sort card will not be able to retrive my requirement.It will retrive only WN.But I need those which are starting with "WN".

Kindly please check and let me know

Many Thanks ,in advance.

With Best Regards,
Kishore.

User avatar
Krishna
Site Admin
Posts: 1052
Joined: Fri Jan 27, 2006 7:50 am

Post by Krishna » Wed Dec 12, 2007 11:18 am

Please execute this card and reply.
As i know, it work for your requirement. It will fetch all records
which contain WN in 1st and 2nd position.

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Wed Dec 12, 2007 9:14 pm

Kishore,

It's difficult to tell what you want considering that your output doesn't match your input (you show WNcst and WNckv in the output, but they're not in the input).

However, reading between the lines, I believe this DFSORT job will give you what you want:

Code: Select all

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
  OPTION COPY
  INCLUDE COND=(1,2,CH,EQ,C'WN')
  OUTREC BUILD=(1,17)
/*
SORTOUT would have:

Code: Select all

WNADV    C0581082  
WNBTL    C0501818  
WNBTL    C0501841  
WNBTL    C0501819  
If that's not what you want, then you need to do a better job of explaining what you do want.
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

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others