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
 

 

help with SORT/ICETOOL

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

New User


Joined: 16 Jan 2015
Posts: 7
Location: USA

PostPosted: Tue Nov 10, 2015 7:10 am    Post subject: help with SORT/ICETOOL
Reply with quote

Hi,

I need help with the below scenario.

I have a VB file with different array elements (say 10 subscript) of fixed size

e.g:

Code:
DEPT - X(3)
FILLER - X(10)
AMt -   S9(3)V99.


Code:
Dept(1)   Amt(1)   Dept(2)   Amt(2).....   Dept(10)   Amt(10)
----------------------------------------------------------------------      
100          200.00   433         980.09   566   700.22
200          -22.00   455       -189.99           220   99.00
220          -2344.02   300        700.22           900   200.00
300          2356.01   220        99.00           922   -22.00


Now, I want to sum the amount of all the Dept using Sort JCL

in the above e.g - Dept 220 - sum Amt (-2146.02)

Please help me with this regard,

Thanks.

Code'd
Back to top
View user's profile Send private message

RahulG31

Active User


Joined: 20 Dec 2014
Posts: 331
Location: USA

PostPosted: Tue Nov 10, 2015 7:39 am    Post subject: Reply to: help with SORT/ICETOOL
Reply with quote

I believe some things are easier done than said.

You can use RESIZE in Icetool or Outfil '/' operator to break the records such that you get records containing 1 row for each Dept and Amt. Then, it would be easier to SUM the amount fields for each/specific Dept.

.
Back to top
View user's profile Send private message
anand1204

New User


Joined: 16 Jan 2015
Posts: 7
Location: USA

PostPosted: Tue Nov 10, 2015 7:43 am    Post subject:
Reply with quote

Thanks Rahul.

It would be great if you can send me an example or I can look up online.
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 331
Location: USA

PostPosted: Tue Nov 10, 2015 8:02 am    Post subject: Reply to: help with SORT/ICETOOL
Reply with quote

Okay. As you said that the amount field is S9(3), you can't have amount in thousands. Also, you need to specify the location of the sign field and Do you have 0s in front if the amount field is less than 3 digits and You can't have decimal in the data if it is an assumed decimal field (V99) i.e.

is it
Code:
200   -22.00   455   -189.99   220   99.00

Or
Code:
200   -22.00   455   -189.99   220   +99.00

Or
Code:
200   -022.00   455   -189.99   220   +099.00

Or
Code:
200   -02200   455   -18999   220   +09900


Use code tags to preserve spacing (in case of filler) and provide the accurate data.

.
Back to top
View user's profile Send private message
anand1204

New User


Joined: 16 Jan 2015
Posts: 7
Location: USA

PostPosted: Tue Nov 10, 2015 8:14 am    Post subject:
Reply with quote

Hi Raghu..

Sorry for the confusion. here is my example data


DEPT(1) AMT(1) DEPT(2) AMT(2) DEPT(10) AMT(10)
---------------------------------------------------
100 20000 433 98009 566 70022
200 -02200 455 -18999 220 09900
220 -34402 300 70022 900 20000
300 35601 220 09900 922 -02200
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 331
Location: USA

PostPosted: Tue Nov 10, 2015 9:21 am    Post subject: Reply to: help with SORT/ICETOOL
Reply with quote

So, If your input is:
Code:
//IN1      DD *
100  20000 433  98009 566  70022
200 -02200 455 -18999 220  09900
220 -34402 300  70022 900  20000
300  35601 220  09900 922 -02200

You can use:
Code:
//TOOLIN DD *
 RESIZE FROM(IN1) TO(TEMP) TOLEN(11)
 COPY FROM(TEMP) TO(OUT) USING(CTL1)
/*
//CTL1CNTL DD *
 OMIT COND=(1,3,CH,EQ,C'   ')
 SORT FIELDS=(1,3,CH,A)
 OUTFIL REMOVECC,NODETAIL,
     SECTIONS=(1,3,
      TRAILER3=(1,4,TOT=(5,6,FS,EDIT=(STTTTT),SIGNS=(,-))))

Your output will look:
Code:
100  20000
200 -02200
220 -14602
300  05623
433  98009
455 -18999
566  70022
900  20000
922 -02200


.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Tue Nov 10, 2015 12:21 pm    Post subject: Reply to: help with SORT/ICETOOL
Reply with quote

You can't RESIZE variable-length records.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Tue Nov 10, 2015 12:47 pm    Post subject: Reply to: help with SORT/ICETOOL
Reply with quote

You need two passes of the data to do it entirely with SORT Control Cards.

If this needs to be with SORT Control Cards (the use of the word JCL is irrelevant, and has nothing with SORT) because you have an existing SORT, consider writing an EXIT, which can be in COBOL.

If you are doing it in SORT just because someone says so (often, stupidly, less paperwork) then is the OCCURS the last thing in the record, or does it always contain 10 elements? You're heading towards Rahul's other suggestion, to use the slash operator (/) to output multiple records from on record, and then a second simple step to do the totalling.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1712
Location: UK

PostPosted: Tue Nov 10, 2015 3:10 pm    Post subject:
Reply with quote

Moved to the correct part of the forum.
Please do not post images - a simple cut'n'paste is adequate, quicker and takes fewer resources.
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 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
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


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