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

Senior Member


Joined: 15 Aug 2015
Posts: 1335
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

Senior Member


Joined: 15 Aug 2015
Posts: 1335
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: 2454
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 How to identify the transaction categ... IMS DB/DC 3
No new posts Identify Program Insert DB2 7
No new posts Amount of days between two dates PL/I & Assembler 8
No new posts Adding a trailer with record count an... JCL & VSAM 4
No new posts Identify unused (junk) REXX scripts TSO/ISPF 30
Search our Forums:

Back to Top