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

Addition of two records on 2 fields


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
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
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: 2455
Location: Hampshire, UK

PostPosted: Tue Oct 03, 2017 2:14 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Oct 03, 2017 2:46 pm
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
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
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

Senior Member


Joined: 29 Apr 2008
Posts: 2024
Location: USA

PostPosted: Wed Oct 04, 2017 12:24 am
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

Global Moderator


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

PostPosted: Wed Oct 04, 2017 7:51 am
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: 2455
Location: Hampshire, UK

PostPosted: Wed Oct 04, 2017 4:15 pm
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

Global Moderator


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

PostPosted: Wed Oct 04, 2017 6:02 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts To fetch records that has Ttamp value... DFSORT/ICETOOL 1
No new posts ICETOOL returns no records JCL & VSAM 1
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top