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
 
Addition of two records on 2 fields

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
View previous topic :: :: View next topic  
Author Message
amar143

New User


Joined: 11 Nov 2010
Posts: 4
Location: India

PostPosted: Tue Oct 03, 2017 11:14 am    Post subject: Addition of two records on 2 fields
Reply with quote

Hi,
My input file have records as shown below:
I want to add count and price for same SRNO and CDE.
SRNO -- length 6 bytes
CDE -- lenght 2 bytes
COUNT -- length 1 byte
PRICE -- length 4 bytes

Input file:
SRNO CDE COUNT PRICE
100001 10 2 1000
100001 10 2 1000
100001 20 4 3000
100001 20 2 1000
100002 20 2 5000
100002 20 2 1000

Output should be
100001 10 4 2000
100001 20 6 4000
100002 10 4 6000

can we achieve above addition of fields through JCL?
Thanks in advance for yor help!!
Back to top
View user's profile Send private message

Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2011
Location: UK

PostPosted: Tue Oct 03, 2017 2:14 pm    Post subject:
Reply with quote

Quote:
can we achieve above addition of fields through JCL?

No. JCL does not do data manipulation - it lets the OS know that you want to run a program and the resources required.

Also, please use the term 'data set' not 'file' - these are different things.
Another also, please use the code tags when presenting data and code and anything else requiring a fixed font.

Finally, have you looked at SUM?
Back to top
View user's profile Send private message
enrico-sorichetti

Moderator


Joined: 14 Mar 2007
Posts: 10472
Location: italy

PostPosted: Tue Oct 03, 2017 2:46 pm    Post subject: Reply to: Addition of two records on 2 fields
Reply with quote

for the average user hanging around
Anything not written in COBOL by the organisation they work for is classified as JCL

so trying to make them learn is a waste of time

quoting Bruce Schneier
Quote:
Anyone who says that the solution is to educate the users has never met an actual user.
Back to top
View user's profile Send private message
amar143

New User


Joined: 11 Nov 2010
Posts: 4
Location: India

PostPosted: Tue Oct 03, 2017 3:34 pm    Post subject:
Reply with quote

Thanks all for your help icon_smile.gif
Back to top
View user's profile Send private message
magesh23586

Active User


Joined: 06 Jul 2009
Posts: 213
Location: Chennai

PostPosted: Tue Oct 03, 2017 8:22 pm    Post subject: Reply to: Addition of two records on 2 fields
Reply with quote

Assuming the record is already sorted(1,9)

Code:

//STEP01 EXEC PGM=SORT                                     
//SORTIN DD *                                               
100001 10 2 1000                                           
100001 10 2 1000                                           
100001 20 4 3000                                           
100001 20 2 1000                                           
100002 20 2 5000                                           
100002 20 2 1000                                           
//SORTOUT DD SYSOUT=*                                       
//SYSOUT DD SYSOUT=*                                       
//SYSIN DD *                                               
//SYSIN DD *                                       
  OPTION COPY   
                                   
  OUTFIL NODETAIL,REMOVECC, 
                     
  SECTIONS=(1,09,                                 
            TRAILER3=(1,10,                       
                      TOT=(11,1,ZD,ZD,LENGTH=1),X,
                      TOT=(13,4,ZD,ZD,LENGTH=4)))                             
Back to top
View user's profile Send private message
sergeyken

Active User


Joined: 29 Apr 2008
Posts: 303
Location: Maryland

PostPosted: Wed Oct 04, 2017 12:24 am    Post subject: Re: Reply to: Addition of two records on 2 fields
Reply with quote

magesh23586 wrote:
Assuming the record is already sorted(1,9)


I believe, it's not good idea just to give ready solutions to the people who do not understand even the difference between JCL, utilities, COBOL, REXX, zOS, ... and everything else.

In this way we increase the number of dummy computer gamers in place of computer professionals.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


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

PostPosted: Wed Oct 04, 2017 7:51 am    Post subject:
Reply with quote

I concur, the beginners forum then should be of no use.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2011
Location: UK

PostPosted: Wed Oct 04, 2017 4:15 pm    Post subject:
Reply with quote

Quote:
the beginners forum then should be of no use.

unless there is a grammatical error in this quote the Beginners Forum should be MORE relevant. Topics like this shold be redirected there. Just because you are an ace in one area of mainframe does not give you a right to post ALL your queries in the Experts Forum. I posted all my srt queries in the Beginners Forum because, no matter how good I was at JCL, PL/1, Rexx etc, I was a dummy at DFSort.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


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

PostPosted: Wed Oct 04, 2017 6:02 pm    Post subject:
Reply with quote

That's right. But if no one is aware and making efforts to post over beginners forum that's where I question if its use.
But this instance have been discussed in past too but I don't recall any concrete solution derived ..
I mean , it's all right to give solutions right alway if a little efforts are seen from the TS otherwise no one would ever learn except us😊
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 -> SYNCSORT All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts MXG - Processing Compressed DB2 SMF r... vasanthz All Other Mainframe Topics 2 Thu May 10, 2018 12:47 am
No new posts Sort numeric fields with trailing spaces sancraig16 SYNCSORT 7 Tue Apr 03, 2018 1:21 am
No new posts Extract the records with a PD field's... sudhakar84 DFSORT/ICETOOL 11 Mon Apr 02, 2018 7:26 pm
No new posts Merge 2 records sancraig16 SYNCSORT 19 Tue Mar 27, 2018 8:17 pm
No new posts SORT 3 files,extract specific fields ... Kiransr DFSORT/ICETOOL 13 Fri Mar 23, 2018 10:54 am

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