Posted: Wed Jul 11, 2007 8:34 am Post subject: How can we add the horizontal values depend on condition
Hi,
I am having a FB file with length of 100.The first 10 are fixed and then there is an array of values(5).I want to add those array values on the basis of FIRST 2 BYTES and put them as a single array.
Kolusu,
Thank you!Both are fixed block with 100 length.I gave a sample i/p and o/p here so that I can modify it as per my requirement.
Thank you
Bprasanna _________________ ----------------
Thanks&Regards
Bprasanna
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
Posted: Wed Jul 11, 2007 9:25 am Post subject:
1. What if the combination of the numeric portions of 2 or more items with the same key is greater than 999?
2. assuming the Input area Pos 36 to Pos 100 is spaces, are the positions of unused items in the OUTPUT also to be spaces?
considering the nonsensical nature of this request, suggest you modify your item size to 6 and allow for a 4 char num (e.g. kk0999) which will never contain a value greater than 999. 5 items at 999 with same key would be 4995 - a 6 char item size. _________________ Dick Brenholtz
American living in Varel, Germany
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
Posted: Wed Jul 11, 2007 9:32 am Post subject:
Quote:
I am having a FB file with length of 100.The first 10 are fixed and then there is an array of values(5).I want to add those array values on the basis of FIRST 2 BYTES and put them as a single array.
saying 'put them as a single array' does not make sense.
do you mean:
consolidate the items within a record based on a key, the key being the first 2 char of each item.
also, will there always be 5 array items? If less, will the unused item areas always be spaces?
?
Just a question. Are you trying to avoid writing the table-logic in a program that is already updating something based on the first 10 char of each record? _________________ Dick Brenholtz
American living in Varel, Germany
Last edited by dbzTHEdinosauer on Wed Jul 11, 2007 9:35 am; edited 1 time in total
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
Posted: Wed Jul 11, 2007 9:38 am Post subject:
bprasanna,
Quote:
No chance,The max allowed field is of lengh 3 bytes only(999 max).
so that means, truncate on the left. e.g. to items AA777 and AA666. output is AA443, truncating the 1 from the actual total 1443. _________________ Dick Brenholtz
American living in Varel, Germany
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Wed Jul 11, 2007 10:00 am Post subject:
bprasanna,
There is a specific reason as to why I asked for the file layout , so that you would have less time to recode it and it makes a hell lot of difference if we are using comp and comp-3 fields. However since you did not provide me with the layout I only worked with the same data you have given.
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