Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Sum the fields in particular format for matching multiple co

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Sum the fields in particular format for matching multiple co
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

Active User


Joined: 29 Apr 2008
Posts: 324
Location: Maryland

PostPosted: Fri Jan 05, 2018 2:46 am    Post subject:
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: 8697
Location: Back in jolly old England

PostPosted: Fri Jan 05, 2018 12:33 pm    Post subject:
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    Post subject: Reply to: Sum the fields in particular format for matching multiple co
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

Senior Member


Joined: 14 Mar 2007
Posts: 10487
Location: italy

PostPosted: Fri Jan 05, 2018 8:49 pm    Post subject: Reply to: Sum the fields in particular format for matching multiple co
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

Senior Member


Joined: 21 Sep 2010
Posts: 1939
Location: NY,USA

PostPosted: Mon Jan 08, 2018 8:38 pm    Post subject:
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: 2369
Location: @my desk

PostPosted: Wed Jan 10, 2018 7:43 pm    Post subject:
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

Senior Member


Joined: 21 Sep 2010
Posts: 1939
Location: NY,USA

PostPosted: Wed Jan 10, 2018 9:34 pm    Post subject:
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: 2369
Location: @my desk

PostPosted: Wed Jan 10, 2018 10:46 pm    Post subject:
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

Senior Member


Joined: 14 Mar 2007
Posts: 10487
Location: italy

PostPosted: Wed Jan 10, 2018 11:01 pm    Post subject: Reply to: Sum the fields in particular format for matching multiple co
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    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 Comparing Comp-3 fields with greater ... Prateeksichem1 DFSORT/ICETOOL 11 Fri Jul 13, 2018 8:45 am
No new posts KSDS file fields update by passing va... Anil Kumar Prajapati TSO/ISPF 5 Wed Jul 11, 2018 5:59 am
No new posts Query for fetching matching data in t... Poha Eater DB2 10 Mon Jul 09, 2018 6:06 pm
No new posts Splitting one row into multiple Rows ... Rajan Moorthy DFSORT/ICETOOL 9 Mon May 14, 2018 10:58 pm
No new posts Sort numeric fields with trailing spaces sancraig16 SYNCSORT 7 Tue Apr 03, 2018 1:21 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us