Focal Point
[SOLVED] String searches

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/5981063403

October 28, 2008, 01:01 PM
kgl442
[SOLVED] String searches
I am looking for someone to help me out on string searches. I am looking to pull strings out of a log file where I could have multiple key text of 'Quality Code:'. I need to find and extract all the text for each Quality Code. I can find the first one easy enough with a POSIT function but if there are more in the log how do I find them or where they begin.

Here is a same of what is in the log:

[Quality Code entered by Cole, Lisa at 02/06/08 10:42 Quality Code: Incomplete/Inaccurate Detail Comments: TTS/AMC did not have enough Details in Description to know what issue is. They did not know what Webform Team workgroup - informed CSC-Wobform and assigned to them. ---------------------------------------------------------------------------------------------------- Quality Code entered by Rutkowski, David at 02/06/08 09:52 Quality Code: Incorrect Escalation Comments: correction... Informed that this should go to CSC Incident ---------------------------------------------------------------------------------------------------- Quality Code entered by Rutkowski, David at 02/06/08 08:54 Quality Code: Incorrect Escalation Comments: This appears to be mis-directed. It is not a TSS GTS issue. It is a "TSS/AMC Support" issue. ---------------------------------------------------------------------------------------------------- ]


Any ideas would be great.

This message has been edited. Last edited by: Kerry,


Kevin
October 28, 2008, 01:43 PM
Darin Lee
Given this sample of your log, what would your report look like?


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
October 28, 2008, 01:50 PM
kgl442
I would want to get:
Rec Quality
ID Code
__ __________________________________________
1 Quality Code: Incomplete/Inaccurate Detail
1 Quality Code: Incorrect Escalation
1 Quality Code: Incorrect Escalation

So this record was Quality Coded 3 times.

Any help is greatly appreciated.


Kevin
October 28, 2008, 02:21 PM
GinnyJakes
Look up the PARAG subroutine. That would allow you to break up the entry into multiple lines.

Another technique which would work better in Dialogue Manager would be to use POSIT and SUBSTR, then cut off the stuff you've already processed, move the unprocessed stuff to column 1 and start your loop again at the beginning.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
October 28, 2008, 02:58 PM
Darin Lee
Is this log record all one line or is it a multiline text file? I have a couple of ideas to add to Ginny's but it would very much depend on the answer to this question.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
October 28, 2008, 03:22 PM
kgl442
All in one field.


Kevin
October 29, 2008, 10:40 AM
kgl442
OK so I think I figured some things out. Each Quality code that is added is diliminated by 100 dashes. How do I created a for next loop to extract all the text between the 100 dashes.

Thanks for all your advice.


Kevin
October 29, 2008, 10:59 AM
GinnyJakes
OK, Kevin.

First of all, you have to update your profile signature with your products, releases, and platforms so that we know what you are running.

Secondly, while I could write the code for you, you wouldn't learn anything. So what I would suggest is that you read the Developing Reporting Application manual, chapter 5 in the 7.6 version of the manual, on Dialogue Manager.

You are not going to be able to do the loop in a DEFINE. You are going to have to do a -READ against the log file and parse the snot out of it.

BTW, have you looked at the PARAG subrountine? Wouldn't that help you at all?


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
October 29, 2008, 12:10 PM
Darin Lee
One more thing to look at - it appears that you are trying to create multiple lines of output from a single record. This is the classic case for use of the Macguyver technique. It's a little advanced, but it is described in detail and numerous variations here on the forum and in tech support if you do a search.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
October 30, 2008, 10:04 AM
PBrightwell
quote:
parse the snot out of it.


Ginny, This may be way too technical!


Pat
WF 7.6.8, AIX, AS400, NT
AS400 FOCUS, AIX FOCUS,
Oracle, DB2, JDE, Lotus Notes
October 30, 2008, 10:10 AM
GinnyJakes
I've been hanging around a woman from Arkansas and I guess I've been picking up some of her 'colorful' phrases. Music


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
October 31, 2008, 11:33 AM
PBrightwell
In that case, don't be surprised when you hear that someone "don't have the sense that God gave a goose!" I think that was my mom's favorite.


Pat
WF 7.6.8, AIX, AS400, NT
AS400 FOCUS, AIX FOCUS,
Oracle, DB2, JDE, Lotus Notes
October 31, 2008, 01:14 PM
<JG>
You have a file with a totally unknown record length that you cannot read with WebFocus
that you cannot put into DM variables because they will blow all possible limits.

Read the file one character at a time and as Ginny says

quote:
parse the snot out of it.


After all you just need 31 lines of code (and a new master to read the output with WebFocus

FILEDEF LONGPARSE DISK c:\IBI\APPS\BASEAPP\LONGPARSE.FTM (LRECL 1 RECFM F
FILEDEF NEWFILE DISK c:\IBI\APPS\BASEAPP\NEWFILE.FTM (APPEND
-RUN
-SET &LABEL1='';
-REPEAT END1 999999999 TIMES
-READ LONGPARSE NOCLOSE &CHAR.A1.
-IF &IORETURN NE 0 GOTO EXIT;
-SET &TEXT='';
-SET &LABEL2='';
-SET &LABEL1= '&LABEL1.EVAL' | '&CHAR.EVAL';
-SET &LABEL1=IF &LABEL1.LENGTH EQ 14 THEN EDIT('&LABEL1.EVAL','$9999999999999') ELSE '&LABEL1.EVAL';
-IF '&LABEL1.EVAL' EQ 'Quality Code:' GOTO GETTEXT;
-GOTO END1
-GETTEXT
-REPEAT END2 999999999 TIMES
-READ LONGPARSE NOCLOSE &CHAR.A1.
-IF &IORETURN NE 0 GOTO EXIT;
-SET &LABEL2= '&LABEL2.EVAL' | '&CHAR.EVAL';
-SET &TEXT = '&TEXT.EVAL' | '&CHAR.EVAL';
-SET &LABEL2=IF &LABEL2.LENGTH EQ 10 THEN EDIT('&LABEL2.EVAL','$999999999') ELSE '&LABEL2.EVAL';
-IF '&LABEL2.EVAL' EQ 'Comments:' GOTO GOTTEXT;
-GOTO END2
-END2
-GOTTEXT
-SET &TIN=&TEXT.LENGTH;
-SET &TOUT=&TEXT.LENGTH -9 ;
-SET &NEWTEXT= SUBSTR(&TIN.EVAL, '&TEXT.EVAL', 1, &TOUT.EVAL, &TOUT.EVAL, 'A&TOUT.EVAL');
-WRITE NEWFILE &NEWTEXT
-END1
-EXIT
October 31, 2008, 02:38 PM
Darin Lee
quote:
parse the snot out of it


Ginny,

I think that should go on a T-shirt for next year's Summit.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat