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.
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
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
Pjoe,
This "may be" easily (compared to dfsort) done in Cobol. Here is a 5 digit phone number solution. If that works for you, it can be extended for 10 digit phone number solution.
I am afraid this may or may not be efficient solution and I am not sure what Frank or Kolusu's reaction going to be...
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
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
A Lodon telephone number - 020 8123 1234, where 020 is the "area code" and you drop the zero to call from outside the UK, so
+44 20 8123 1234. Are you storing with or without the leading zero?
A Lisbon telephone number - 211 111 111. No area codes in Portugal.
You have 1 digit, 2 digit, 3 digit and 4 digit international codes.
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
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.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
PJoe,
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.