Regarding SORT

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
sriviji
Member
Posts: 3
Joined: Tue Feb 28, 2012 7:51 pm

Regarding SORT

Post by sriviji » Tue Feb 28, 2012 8:05 pm

Hi,

I need a sort card to get the desired output.
Below is my requirement:
I have an input file in the below format
D1 D2 VALUES
002 001 -000000000009562
002 001 -000000000009562
002 002 +000000000009566
002 002 +000000000009566
002 002 -000000000006500
003 004 +000000000006500
004 005 +000000000012271

and i need the output in the below format
D1 D2 VALUES COUNT
002 001 -000000000019124 02
002 002 +000000000012632 03
003 004 +000000000006500 01
004 005 +000000000012271 01

Here the Key fields are D1 and D2. Kindly throw some light on me.
Thanks in advance for the help.

Regards,
Viji

sriviji
Member
Posts: 3
Joined: Tue Feb 28, 2012 7:51 pm

Post by sriviji » Tue Feb 28, 2012 8:26 pm

Please somebody help me out.. It is very urgent

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Tue Feb 28, 2012 9:02 pm

Please somebody help me out.. It is very urgent
don't hold your breath

what is your sort product? DFSORT,Syncsort??
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

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

Post by Frank Yaeger » Tue Feb 28, 2012 11:51 pm

You can use a DFSORT job like the following to do what you asked for. I assumed your input records are already in sorted order by the key as implied by your example. If not, you'll need to add a SORT statement.

Code: Select all

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
002   001   -000000000009562
002   001   -000000000009562
002   002   +000000000009566
002   002   +000000000009566
002   002   -000000000006500
003   004   +000000000006500
004   005   +000000000012271
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  OPTION COPY
  OUTFIL REMOVECC,NODETAIL,
    SECTIONS=(1,3,7,3,
      TRAILER3=(1,12,
        TOT=(13,16,FS,EDIT=(STTTTTTTTTTTTTTT),SIGNS=(+,-)),
        31:COUNT=(EDIT=(TT))))
/*
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

sriviji
Member
Posts: 3
Joined: Tue Feb 28, 2012 7:51 pm

Post by sriviji » Wed Feb 29, 2012 8:44 am

It worked. Thanks so much Frank. you are the Master :D

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