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: 1932
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10375
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: 211
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: 233
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: 1827
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: 1932
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: 1827
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 SORT BUT RETAIN HIGHEST VALUE ON NON-... leondan22 DFSORT/ICETOOL 2 Thu Dec 14, 2017 8:13 pm
No new posts Inefficient BUILD - VB records paddin... Daniel Prosser SYNCSORT 6 Thu Dec 14, 2017 3:52 pm
No new posts ISSUE IN copying Sequential file reco... thesumitk JCL & VSAM 2 Wed Dec 13, 2017 3:07 pm
No new posts Merging 2 records at multiple rows wi... Bijesh DFSORT/ICETOOL 2 Wed Dec 06, 2017 1:50 am
No new posts Increment number for every group of r... srajendran2 DFSORT/ICETOOL 7 Thu Nov 09, 2017 10:31 pm

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