Select Data Coding Help!

Concordedly

New Member
Hello CF. I've got a new query today. I need some help coding something in HTML, Javascript, Excel, or some other method to do the following:

User copies and pastes the following data:
12345600001234567000
00065432100076543210
00042500635001324750

Then, based off of the location of the character, we output:

Field 1: 123456
Field 2: 12345670
Field 3: 65432100

Just the same data, arranged in a way someone can clearly understand what those fields mean and represent. It seems to me that this should be relatively easy coding, but I cannot for the life of me think of a single function in Excel or any sort of HTML that I used back in the day to create something that does this when it is all copied and pasted as one whole unit. The ways I can think of would already require the user to know which parts to copy and paste, which for this particular data and the lack of training availablity is impossible where I'm at trying to implement this.

Let me know whatcha got CF!!!
Timmeh
 
So you mean that a user will paste that random stuff in a website and you need to pull it out and make it into three strings? can you give more details?
 
A webpage would work the easiest, or excel format but yes, exactly what you said. They take info from the mainframe screen that looks horrible, paste it into a form or webpage and the page automatically searches for the info based on its location in the block of data, and outputs the same information but in a ways that normal people can understand. I assume that means a string but I do not know for sure :P

So basically, I copy 123456
Paste 123456

And what I want to happen is this:
Field1: 123
Field2: 456

But on a level of data more similar to my first example in my original post, but you are right on track as usual :P


The reason is at the insurance company I work for, we have everything in a Mainframe system and no sort of pretty system. So the block of text is actually basically important policy information that people at my work send requests for to have it broken down. If we could avoid that step, we could save money and time with profitablity.

So I would want to be able to name the fields too:

Dwelling Coverage: 123456
Deductbile: 654321

Multiple fields, based on a single copy and paste of raw data.
 
Last edited:
This can be easily accomplished with a shell script, and you could use php or something similar to invoke shell or use php to code it, but I am not sure exactly what strings you want to pull and insert into fields, and by fields do you mean tables in a database?
 
Well, I'll have to learn a bit about PHP. Basically, I want it as simple as possible. Just a paste data in and output.

For the 'fields' I guess that is a bad term to use. I just mean I want to name like each coverage... So for example:

All you input is this:
32132132132564232321321321

And then it outputs:
Liability Coverage: 564

You see? Just selecting a certain portion of that data, based on where it is located amongst the other numbers.
 
Last edited:
OK, but is the data always constantly going to be in the same place in the same string? Like, will it always be the 4th thru 8th numbers as an example?
 
Yes and here is an example of the actual data we'll be pasting:

30611020100001000001301100400103500701001194500000
00000099019887200008797441101250606397062009009900
02020000000000000000000000000000000000000000000000
00


Basically, follow with me... It's kind of complicated

1st Line information:
30 - Means this was a change, not new business
61102 - Nothing Relevent
010 - County Code
0001 - Fire District
0000 - Nothing Relevent
013 - Territory Code
011 - Zone
004 - Protection Class
0 - Nothing
01 - Policy Type
03 - Policy Form
50 - Deductible Type
07 - Deductible Size
01 - Nothing Relevent
001 - Number of Families in Dwelling
1945 - Construction Year


That's just the first line. So you get what I mean now?
 
Do you want all of that to be chopped up in that format, and is it always the same? I can probably write a shell script to do this.
 
Yes, this format is pretty much it and it is always the same. The data locations are always the same. However, I only gave you the first line's information. Let me get you the rest of the information I need pulled on Monday. Also, is there anyway that we can avoid the non-relevant information from being output?
 
OK I can do this in shell, but you would have to run it in Linux or Unix or perhaps try powershell on Windows but I don't think the syntax is the same.

Are these files plain text files? Are they going to be all located in the same folder?

So for example, if we were to hard code this string you gave me:

30611020100001000001301100400103500701001194500000
00000099019887200008797441101250606397062009009900
02020000000000000000000000000000000000000000000000
00

Into a shell script it could organize the data, here is some example code:
Code:
#!/bin/bash

# pull strings out of parent string for data entry

string="30611020100001000001301100400103500701001194500000
00000099019887200008797441101250606397062009009900
02020000000000000000000000000000000000000000000000
00"

# now create variables for fields of data

change=$( echo $string | cut -c1-c2)
country=$( echo $string | cut -c8-c10)
firedistrict=$( echo $string | cut -c11-c15)

# once we input all our variables write them to a file 

/bin/echo "$change, $country, $firedistrict," >> /path/to/myfile.txt

exit 0

That will generate a list of comma delimited variables which you could then import in excel by importing plain text. Set the delimiter to comma and it would separate them all out and you could import them how you wanted to.

Does this need to be one file, or like many files? - assuming you have tons of this info that needs to be organized.
 
Actually, I was hoping for a more real-time solution. Not going to be any text files at all. This information is readily and freely available to all of the users of our mainframe sessions just by inputting a policy number. So that's where I was hoping for more of a copy-paste scenario. Could I host this on a server that supports linux/unix and then have just the input and output portions on a webpage accessible to the user?

Basically, when a policy goes historical, we have to submit a request to pull the policy information from a micro-fiche system. However, these blocks of data are always available if the policy is still in the system. So we could simply copy the block and paste it in this form and then with the coding you help with, it would output to a webpage or some other more immediate system, if possible. But the code you've provided does look like what I'm looking for, I just need it to pull from what the user pastes.
 
Basically, when a policy of ours goes historical, we no longer have access to policy information in a nice easy-to-read format. Instead, all we have are the blocks of data shown above. If we could simply copy and paste it into perhaps, a web form of some kind and have it output in the same webpage, that would be ideal. I'm not sure how the company would feel connecting to another server or if they would implement it if we could not run it locally. As far as input goes, it would have to be copy/paste or at the most saved as a text file because this information is on a per policy level and would not be freely available unless you have access to the policy, and can copy the information from the mainframe session.
 
Yes it can be automated. What is your desired output, I thought you wanted it in a spread sheet? Are there more than one text file?

You haven't given me enough details, and I don't know how the data is even being delivered.
 
In terms of output. I would like it to be an immediate output on a webpage format. HTML/Javascript would be best or if it had to be a txt file, then one text file per paste that outputs all of the data, so to speak.

I mean, just like the reply box of this forum if you want to look at it that way. I type it in, click Post Reply, and my information appears on the next page. That's what I'm looking for in terms of output, just instead of it saying Post Reply, it could say whatever lol.
 
In terms of output. I would like it to be an immediate output on a webpage format. HTML/Javascript would be best or if it had to be a txt file, then one text file per paste that outputs all of the data, so to speak.

I mean, just like the reply box of this forum if you want to look at it that way. I type it in, click Post Reply, and my information appears on the next page. That's what I'm looking for in terms of output, just instead of it saying Post Reply, it could say whatever lol.

That is going to require a database. Even this site runs off a database, and the web front end is just PHP code with a WYSIWYG interaction box. You say these files are on a mainframe? Well, that means your server admin could export all of them to a plain text file. My script can parse the data and delimit it by comma. Then you can import that data into a database and build a web front end around it to search it, organize it and so forth.

For example, on my website all the content I put into it, is stored in the database. The web code is just the front end of that database. Anything I input on a user level will be stored in that database. Anything that I code web development wise, is just how the database is presented to the end user.

Then again, if your server admin for your mainframe and export the data you want, you probably won't need to run my script. As he can probably export it in many different ways, and if it is an open source database like MySQL they could just give you a copy of the whole database.
 
I see. So this is similar to the tables and information used to create forums through MYSQL and to make it into a webpage is just building a pretty front.

My server admin will not provide me with a bulk way to do this for all policies, and in essence that is creating more work than what we need. We only need it for the policies folks call in about and need to be able to answer them real-time only for the policies that have gone historical. Otherwise, the information is well presented through a PDF format.

My company will not host this sort of program until I can prove the efficiency of it. If I host my own version of this on my server, could you help me with the coding and making a web-front? I'm not sure how to tie the two together. Do you think it would be possible to create a web-form similar to a user registration field that would transfer this data to the php script and then output into the same webpage the information?

Basically I gotta make it work before the company will take another one of my plots seriously, lol.
 
I see. So this is similar to the tables and information used to create forums through MYSQL and to make it into a webpage is just building a pretty front.

Exactly, all the data on this site is really in the database, the web front end is a pretty way of viewing it.

My server admin will not provide me with a bulk way to do this for all policies, and in essence that is creating more work than what we need. We only need it for the policies folks call in about and need to be able to answer them real-time only for the policies that have gone historical. Otherwise, the information is well presented through a PDF format.

So he won't export everything into a text file for you? That sounds rather strange, but I guess I don't know all the details.

My company will not host this sort of program until I can prove the efficiency of it. If I host my own version of this on my server, could you help me with the coding and making a web-front? I'm not sure how to tie the two together. Do you think it would be possible to create a web-form similar to a user registration field that would transfer this data to the php script and then output into the same webpage the information?

Well, going open source and web based would be efficient and cut down costs of software. Then you could set access and users to the site who can connect and read/write data into it. You will have to learn web development if you want this done. You can code it in PHP or you can delimit it with my code and then create tables in a database and import it that way. I think though that your server admin could probably do this a whole lot easier since they have access to the original database.
 
Well of course it would be easier for the system admins and the entire IT department to come up with this, but in my industry they don't have time to brainstorm new ideas, only implement the ones that others come up with. So that's where I come into play, with the ideas but without as much technical proficiency.

I can set up a MYSQL database on my server and I think it would be best to code into PHP and find a way to code it into a web front-end rather than do Shell since I know nothing about it. Can you give me some information on the PHP portion of it? I think I understand enough about porting it to a webpage if the PHP is there from my work doing php based forums.
 
Back
Top