Can you have signs at different positions for the same person? For example from your sample input, Tom record in input has a sign at 9th position but the last Tom record has sign at 11th position. Is it possible? If yes where do you want sign in your expected output?
What is the LRECL/RECFM of the input file?
Also please use code tags when providing sample data to keep formatting as is.
First of thanks a lot for your quick response Enrico and sqlcode...
@Enrico: thanks man.. your logic is superb...... that will do whatever i want....
@sqlcode: The position of the sign will be always fixed in Input file and RECFM=FB....
Well, I'm not really sure what you want the output to look like for various cases, such as with three non-zero digits or one non-zero digit, but be aware that you can include embedded blanks in the EDIT mask by enclosing the pattern in apostrophes. For example:
If you used that in the code in your first post, SORTOUT would have:
Hi Frank...Thanks for your valuable input...
Let me explain my requirement....
i have to find sum of one field which have a fixed length including sign, say 5. Here the sign will be always in 1st column. and the numbers will be right aligned. When i add these numbers using the code posted by me its will keep sign just to the left of number.... but i have to keep sign in exact position as its in the input file... see the example below..
MEERA + 2 IBM
MANJU + 24 CGI
MEERA + 98 IBM
MANJU - 22 CGI
SWATH + 23 IBM
Output should be
MEERA +100 IBM
MANJU + 2 CGI
SWATH + 23 IBM
I think your code will always embed one space in the output
thank you Frank.... that logic is good one.....
@Kolusu.. your code(Section,Trailer) is completely new to me... anyway i will try that also and will let you know....
@Enrico: your understanding was also correct... that code also will work
This is my first post in this forum.... thanks for your overwhelming support..... i didn't expect such talented quick responses from a public forum.... but this one is really superb..... thanks a lot..... is this owned by IBM?