The file is 80 bytes length and a record can contain 10 digit phone number . All we have to do is to add the international calling code +XX before the phone #. The 10 digit phone # can come in any position between 1 73.
Is there a way to accomplish this in sort/icetool.
Our installation uses ICE201I G version of sort.
I thought of using parse with a combination of numeric check..but not sure how to implement the solution.
Is the phone number the only field in this record? How do you identify where the phone number starts? Simply the first non-blank,non-numeric , or what? Is it always 3 characters you want to prefix? What do you want to do if the number starts in pos 71, 72 or 73 - extend the record length?
The input file will have spaces between 73-80 column.. The output file can utilize this vacant space when adding (+XX) before the phone number. to be more precise, the output file can be have non blank characters between 73-80 cloumns
After looking at the data and based on the business rules, there will be only 10 digit phone numbers in this data stream..
After looking at the data for the last 2 years, I could not find a case
where a record has 10+ digit numbers.Also there is a leading and trailing space between the phone numbers.Please note that there can be 4 digit or 5 digit numbers in this stream
sorry when I typed the second input record in my earlier post, the leading space is missing
While we are at it, do you have a dataset for each country? If not, where are you going to get the Country from and how are you going to look-up the specific code?
I marvel at what DFSORT/ICETOOL can do, but this requirement is complex, and perhaps more complex than you know.
How are you going to be using the data? Presumably the Country is in the address (you are up the creek there if not, someone will have to guess the Country from the City/postal code). The International Code for that country is "static", as would be the Timezone, useful for anyone who wants to make use of the data for calling.
If this is going into some application for someone to use, why don't you ensure the Country is in the data (and recognizable programmatically) and then provide the International Code and Timezone when displaying the data? Else you are making things complicated by adding "redundant" data to your existing data.
Even the "simple" case of replacing bddddddddddb (b=blank, d=0-9) anywhere it appears in a record with b(+91)ddddddddddb is quite complex. I can't think of a practical way to do that with DFSORT's built-in functions. I'd suggest you write a program or exit with the appropriate logic.