Posted: Thu Nov 20, 2014 5:11 pm Post subject: Sum the amount based on credit/debit indicator
Hi All,
My input file is VB, LRECL=227
In the following sort step I am able to do the following things.
I want to add the amount in the column 76 if the account number is 235120 or 235010 and the credit/debit indicator is "C" (C- credit, D- Debit) at column 75.
I want to subtract the amount in the column 76 if the account number is 235120 or 235010 and the credit/debit indicator is "D" (C- credit, D- Debit) at column 75.
I want to add one more condition to the include/IFTHEN statement as follows (This is exactly opposite to the above conditions)
I want to add the amount in the column 76 if the account number is 235020 and the credit/debit indicator is "D" (C- credit, D- Debit) at column 75.
I want to subtract the amount in the column 76 if the account number is 235020 and the credit/debit indicator is "C" (C- credit, D- Debit) at column 75.
You are specifying DCB info on your SORTOUT. Not necessary, SORT will handle it, and may at some point in the future if the LRECL changes, you have two places to change it. If the RECFM changes, you have two places.
Are you SORTing just to allow the use of SUM? If the file is already in sequence, that is a waste and it can be done another way.
William - I will remove the DCB statement from my SORTOUT statement. The records are not in sorting order in my example I am showing in sorting order for simplicity.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum