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

Identify the value if the SUM of the amount is not zero


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
PORYES

New User


Joined: 04 Apr 2007
Posts: 38
Location: Chennai

PostPosted: Sun May 10, 2020 12:46 am
Reply with quote

Hi -

My input file hasthe below values.
----+----1----+----2
********************
ID AMT
1020 +10
1020 -10
1021 +5
1021 -5
1021 -8
1021 -1
1035 -5
1035 +5
1035 -2
1035 +2

My requirement is to check which ID values are NOT net Zero.

Eg: If we check the ID: 1020 and sum the amount the value should be zero.

For ID: 1021, Sum of the amounts are not Zero.
If the values are not zero, then display the ID.

Can anyone please help.
Back to top
View user's profile Send private message
Joerg.Findeisen

Active User


Joined: 15 Aug 2015
Posts: 383
Location: Bamberg, Germany

PostPosted: Sun May 10, 2020 12:51 am
Reply with quote

Help yourself and use code tags when providing data/code. icon_exclaim.gif
Back to top
View user's profile Send private message
Joerg.Findeisen

Active User


Joined: 15 Aug 2015
Posts: 383
Location: Bamberg, Germany

PostPosted: Sun May 10, 2020 1:15 am
Reply with quote

Code:
//EXPERT   EXEC PGM=SORT                       
//SORTIN   DD *                               
1020 +10                                       
1020 -10                                       
1021 +5                                       
1021 -5                                       
1021 -8                                       
1021 -1                                       
1035 -5                                       
1035 +5                                       
1035 -2                                       
1035 +2                                       
/*                                             
//SYSOUT   DD SYSOUT=*                         
//SORTOUT  DD SYSOUT=*                         
//SYSIN    DD *                               
  INREC IFTHEN=(WHEN=INIT,                     
    OVERLAY=(41:6,8,SFF,TO=ZD,LENGTH=8))       
  SORT FIELDS=(1,4,ZD,A)                       
  SUM FIELDS=(41,8,ZD)                         
  OUTFIL FNAMES=(SORTOUT),                     
    INCLUDE=(41,8,ZD,NE,+0),                   
    REMOVECC,                                 
    BUILD=(1,4,X,41,8,ZD,M25,SIGNS=(+,-),LENGTH=9)         
  END                                         
/*

Output:
Code:
1021        -9
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2448
Location: Hampshire, UK

PostPosted: Sun May 10, 2020 1:23 am
Reply with quote

You have been asked on several occasionsto use the code tags and consistently fail to do so. This is disrespectful to those who help and also to other browsing the forum for information. Please use the code tags in future.
Back to top
View user's profile Send private message
PORYES

New User


Joined: 04 Apr 2007
Posts: 38
Location: Chennai

PostPosted: Sun May 10, 2020 7:13 pm
Reply with quote

Thank you so much Joerg.

I Apologize and will make sure to add code tags for future posts.
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 Identify the count from two diffrent ... DFSORT/ICETOOL 19
No new posts Identify who, from where, sign on CIC... CICS 1
No new posts REXX identify the last/latest created... CLIST & REXX 7
No new posts Formating of Amount field in CLIST be... CLIST & REXX 9
No new posts how to add the amount for duplicate r... COBOL Programming 9
Search our Forums:

Back to Top