Advertisement

11.15.2005 at 06:04AM PST, ID: 21631318
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.4

Parse text line in two formats within same document...

Asked by IOIT in Perl Programming Language

Tags: , , ,

Bad Title I know,

I have a perl script that does, among other things, parse some flat text segments (an edi document) and formats it into readable
text with a description of the order that is then mailed out.

The problem i am having is that there is one particular line that can come in two ways in the same document;

PO1*001*780*EA*39.97*LE*IN*004026605*UP*631656320015*VN*FOR00072000CA

or

PO1*001*780*EA*39.97*LE*IN*004026605*UP*631656320015*VN*FOR00072000CA***IZ*72


The code that parses this line is currently;

<begin>

 if (/PO1\*(\d+)\*(\d+)\*EA\*(.*?)\*LE\*IN\*(\d+)\*UP\*(\d+)\*VN\*(.*?)$/o) {
                if ((scalar $EDI_REF->{IEACLOSE}) == FALSE) {
                        $gnc_orders = join('',$gnc_orders,"\t", $6,"\n");
                        $nameprod = $6;
                        &{%dispatch->{CLEOLOG}}("ORDER#: $EDI_REF->{ORDER} They ordered $6");
                        }
        }

            if (/PO1\*(\d+)\*(\d+)\*EA\*(.*?)\*LE\*IN\*(\d+)\*UP\*(\d+)\*VN\*(.*?)\*\*\*IZ\*(.*?)$/o) {
                if ((scalar $EDI_REF->{IEACLOSE}) == FALSE) {
                        $gnc_orders = join('',$gnc_orders,"\t", $6,"\n");
                        $nameprod = $6;
                        &{%dispatch->{CLEOLOG}}("ORDER#: $EDI_REF->{ORDER} They ordered $6");
                }
        }

</end>


The problem is that the line can show up in both formats within the same document. I need this to be able to
parse the line, if it is a full line then pull the sixth variable and move on if it is not the full line then move on to the
second if statement but only pull one instance...
output of the log file shows that the script is grabbing both variables from the same line....this sucks :-((

2005-11-14 17:09:25 ORDER#: 850000002 They ordered SSGLU300000CA
2005-11-14 17:09:25 ORDER#: 850000002 They ordered SSGLU300000CA***IZ*300GM


Keep in mind, I am not a perl coder by any stretch, I inherited this script and although I can edit and fumble my way through basic
changes, outside of this, well, that's why i'm here :-))

Thanks for any help, Start Free Trial
 
 
Loading Advertisement...
 
[+][-]11.15.2005 at 08:24AM PST, ID: 15296551

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Perl Programming Language
Tags: parse, perl, line, text
Sign Up Now!
Solution Provided By: zby
Participating Experts: 2
Solution Grade: A
 
 
[+][-]11.15.2005 at 08:28AM PST, ID: 15296582

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.15.2005 at 08:37AM PST, ID: 15296657

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.15.2005 at 08:42AM PST, ID: 15296699

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.15.2005 at 08:43AM PST, ID: 15296723

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.15.2005 at 08:53AM PST, ID: 15296825

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-42 - Hierarchy