IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Sum the fields in particular format for matching multiple co


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sharana64

New User


Joined: 30 Dec 2017
Posts: 2
Location: USA

PostPosted: Fri Jan 05, 2018 1:11 am
Reply with quote

I have input file with below records,

Input File:

Code:
CICSA   11/1/2017    1   16:45:18
CICSA   11/1/2017    2   16:45:18
CICSA   11/1/2017   10   16:45:18
CICSA   11/1/2017   12   16:45:18
CICSA   11/2/2017   13   19:00:00
CICSA   11/2/2017   14   19:00:00
CICSA   11/2/2017   65   19:00:00
CICSB   11/1/2017   13   16:45:18
CICSB   11/1/2017   14   16:45:18
CICSB   11/1/2017   65   16:45:18
CICSB   11/1/2017   13   16:45:18
CICSB   11/2/2017   14   19:00:00
CICSB   11/2/2017   65   19:00:00
CICSB   11/2/2017   12   19:00:00
CICSC   11/1/2017   14   19:00:00
CICSC   11/2/2017   65   19:00:00
CICSC   11/2/2017   13   19:00:00


Need assistance in getting the output file in the format showed in example( if there are multiple records for the same date then add up 3rd column, display sum in 3rd column)
Ex: CICSA got multiple record for the date( 11/1/2017) then sum(1 +2+10+12 = 25),

CICSA 11/1/2017 25 16:45:18

Output File:

Code:
CICSA   11/1/2017    25   16:45:18
CICSA   11/2/2017    92   19:00:00
CICSB   11/1/2017   105   16:45:18
CICSB   11/2/2017    91   19:00:00
CICSC   11/1/2017    14   19:00:00
CICSC   11/2/2017    78   19:00:00



CODE' d
right aligned the numeric fields
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2018
Location: USA

PostPosted: Fri Jan 05, 2018 2:46 am
Reply with quote

Hum-m-m-
Quote:
Occupation: IT Manager
Mainframe Skills: JCL COBOL VSAM

Quick test:
2 * 2 = 4 ?
True, or false?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Jan 05, 2018 12:33 pm
Reply with quote

So what have you tried and what were the results ?

and dare I ask if the data layout is as dynamic as shown.
RECFM, LRECL, field positions and data types are all required if you want any help.
Back to top
View user's profile Send private message
sharana64

New User


Joined: 30 Dec 2017
Posts: 2
Location: USA

PostPosted: Fri Jan 05, 2018 7:55 pm
Reply with quote

Thank you Expat for the reply.

the file is not dynamic, looks misplaced during copy.

Code:
Organization  . . . : PS   
Record format . . . : FB   
Record length . . . : 80   
Block size  . . . . : 27920


Tried below logic:
Code:
//SYSIN        DD   *                     
  INCLUDE COND=(1,4,CH,EQ,C'CICSA')     
 SORT FIELDS=(1,4,CH,A)                   
 SUM FIELDS=(68,8,ZD)                     
/*                                         
//       


O/P
Code:
CICSA 11/01/2017  16:45:18                       25


CODE' d AGAIN
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Jan 05, 2018 8:49 pm
Reply with quote

I wonder why people are not able to describe the requirement without changing it while the work is in progress (*) icon_eek.gif

in the starting post the TS asked to sum over the <full timestamp ( date and time )>

and the solution which seemed to satisfy him/her/it sums only over the first 4 bytes of the cics-id icon_confused.gif

(*) probably because it is one of the required skills of an
Quote:
Occupation: IT Manager

icon_cool.gif
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Mon Jan 08, 2018 8:38 pm
Reply with quote

Quote:
the file is not dynamic, looks misplaced during copy.
What do you mean misplaced , explain better what you need here?
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Jan 10, 2018 7:43 pm
Reply with quote

Quote:
What do you mean misplaced
Obviously the data was not aligned properly in the OP's post and someone code'd it later for him/her.

Quote:
in the starting post the TS asked to sum over the <full timestamp ( date and time )>
moving targets....

sharana64 - Your last 'solution' seem to be inconsistent with your original requirement of summing on keys that include date and time, as enrico has rightly pointed out above.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Wed Jan 10, 2018 9:34 pm
Reply with quote

Quote:
Obviously the data was not aligned properly in the OP's post and someone code'd it later for him/her
Of course but you overlooked the offsets used, that's how OP will get it unless use Builds, So misplaced is poor term used one has to be knowing what is going around the control cards.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Jan 10, 2018 10:46 pm
Reply with quote

I was trying to suggest someone cleaned up the OP's post, and that the 'misplacing' may not have anything to do with his/her requirement. I will try to clean up this topic (including my posts). Thank you.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Jan 10, 2018 11:01 pm
Reply with quote

the topic should be locked and the IT manager invited to start a new one with COMPLETE and CONGRUENT DATA

the control cards for the second result he/she/it got do not even agree with the data layout of the initial post
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Need to convert date format DFSORT/ICETOOL 20
Search our Forums:

Back to Top