Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

i need following using JCL --SORT UTILITY.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
ravikumarreddy
Warnings : 1

New User


Joined: 29 Jul 2005
Posts: 23

PostPosted: Fri Mar 10, 2006 12:16 pm    Post subject: i need following using JCL --SORT UTILITY.
Reply with quote

HI,
here i have a question which is suppose to answer thru JCL.

MY FILE LIKE FOLLOWING:

Code:

 PRC-NB     COUNT
  101         20
  101         30
  102         40
  102         50
  103         60
  103         70

--------------------------------------------------------------
OUT PUT NEEDS LIKE FOLLOWING

Code:

 PRC-NB     COUNT
  101         50
  102         90
  103        130

******************************************
I NEED ABOVE THRU JCL.....
Back to top
View user's profile Send private message

rajesh_1183

Active User


Joined: 24 Nov 2005
Posts: 121
Location: Tadepalligudem

PostPosted: Fri Mar 10, 2006 3:56 pm    Post subject:
Reply with quote

HI,

Code:

//JOB CARD...
//STEP1 EXEC PGM=SORT
//SORTIN      DD DSN=INPUT FILE
//SORTXSUM DD DSN=OUTPUT FILE
//SYSIN DD *
 SORTFIELDS=(1,3,CH,A)
 SUMFIELDS=(5,2,CH)
/*
//


CORRECTIONS WELCOMED

Thanks,
Rajesh
Back to top
View user's profile Send private message
fixdoubts

New User


Joined: 21 Oct 2005
Posts: 54

PostPosted: Fri Mar 10, 2006 5:23 pm    Post subject:
Reply with quote

Hi,

The about jcl is correct but i doubt about
Quote:
SUMFIELDS=(5,2,CH)

I think the the SUM FIELDS needs to be numeric

should be
Code:
SUMFIELDS=(5,2,ZD)


This will do i hope..

Regards,
Back to top
View user's profile Send private message
Mane Sagar

New User


Joined: 12 Jul 2005
Posts: 41
Location: mumbai

PostPosted: Fri Mar 10, 2006 6:53 pm    Post subject:
Reply with quote

Hi,

fixdoubts is very right.

It has to be
Code:
SUM FIELDS=(5,2,ZD)

Regards,
Sagar.
Back to top
View user's profile Send private message
manyone

New User


Joined: 09 Mar 2006
Posts: 9

PostPosted: Fri Mar 10, 2006 10:21 pm    Post subject:
Reply with quote

however the sum will be truncated if it's 100 or over because it's too short. to fix it, you need

INREC FIELDS=(1,3,X,C'0000',5,2)
SORT FIELDS=(1,3,CH,A)
SUM FIELDS=(5,6,ZD)

if you want record count too (here, i made it packed) , try this

INREC FIELDS=(1,3,X,X'00001C',X,C'0000',5,2)
SORT FIELDS=(1,3,CH,A)
SUM FIELDS=(5,PD,9,6,ZD)
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Mar 10, 2006 10:48 pm    Post subject:
Reply with quote

Since your records are already in sorted order, you can avoid a sort, and use copy or merge which are more efficient.

Here are two ways to do this with DFSORT:

Method 1: COPY with SECTIONS and TRAILER1

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
  101         20
  101         30
  102         40
  102         50
  103         60
  103         70
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  OUTFIL REMOVECC,NODETAIL,
    SECTIONS=(3,3,
      TRAILER3=(1,11,TOT=(12,5,FS,TO=FS,LENGTH=5)))
/*


Method 2: MERGE with SUM

Code:

//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN01 DD *
  101         20
  101         30
  102         40
  102         50
  103         60
  103         70
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION ZDPRINT
  MERGE FIELDS=(3,3,CH,A)
  SUM FIELDS=(12,5,ZD)
/*
Back to top
View user's profile Send private message
vin78dotcom
Warnings : 2

New User


Joined: 06 Dec 2005
Posts: 7
Location: pune

PostPosted: Tue Nov 20, 2007 4:02 pm    Post subject: Reply to: i need following using JCL --SORT UTILITY.
Reply with quote

hello,
thanks for the different methods of sort and sums..
it worked for me ...but can you please let me know how to remove leading zeroes from the output summations.
e.g my output sum is coming as:000001
and i wanted just: 1 where zeroes should be replaced by spaces.
I used the COPY with SECTIONS and TRAILER1 techniques.

thnks
vinay
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Tue Nov 20, 2007 9:28 pm    Post subject:
Reply with quote

With DFSORT, TO=FS does remove the leading zeros. The output would be:

Code:

  101         50
  102         90
  103        130


Perhaps you're not using DFSORT. Check the //SYSOUT messages. If they start with ICE (e.g. ICE000I), then you're using DFSORT. If you are using DFSORT, then post your control statements and //SYSOUT messages and the output you're getting. If you're not using DFSORT, then I can't help you.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts TAPE VERIFY utility?? MrExtraordinare JCL & VSAM 3 Fri Dec 09, 2016 10:57 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us