Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Capture File Parsing. Need more help pulling out specific info. 1

Status
Not open for further replies.

dmelle

Technical User
Jan 26, 2002
14
US
Knob, Hankm3, Anyone,

I am once again trying to pull specific info out of one capture file and into another. The capture is successful, and I just want to get rid of unuseful data. The problem that i am having, is that the data is not always on the same line, or in the same place. It changes depending on the state of each item. Here is an example of the outputed data:



"California_Ring,LABEL=LSANCAJWHFQ,RINGID=California_Ring,NODEID=1,ERWTR=99,E
SWTR=99,WRWTR=99,WSWTR=99,PGSTATE=IDLE,LAST=SUCCESS,RMAP=1|2|3,ESWORKCOND=OK,ESP
ROTCOND=OK,ESSWTYPE=NR,ESLCKTYPE=NL,ESSWSTATUS=IDLE,WSWORKCOND=OK,WSPROTCOND=OK,
WSSWTYPE=NR,WSLCKTYPE=NL,WSSWSTATUS=IDLE,PST=IS-NR,SST=NA,,PUS=C-3-2A-3-1A-3-2C-
"California_Ring,LABEL=FRMTCAEDHKQ,RINGID=California_Ring,NODEID=2,ERWTR=99,E
SWTR=99,WRWTR=99,WSWTR=99,PGSTATE=IDLE,LAST=DENY,RMAP=2|3|1,ESWORKCOND=OK,ESPROT
COND=OK,ESSWTYPE=NR,ESLCKTYPE=NL,ESSWSTATUS=IDLE,WSWORKCOND=OK,WSPROTCOND=OK,WSS
WTYPE=NR,WSLCKTYPE=NL,WSSWSTATUS=IDLE,PST=IS-NR,SST=NA,,PUS=A-2-2C-2-2A-1-2C-1-2
"California_Ring,LABEL=SCRMCAWCHGF,RINGID=California_Ring,NODEID=3,ERWTR=99,E
SWTR=99,WRWTR=99,WSWTR=99,PGSTATE=IDLE,LAST=SUCCESS,RMAP=3|1|2,ESWORKCOND=OK,ESP
ROTCOND=OK,ESSWTYPE=NR,ESLCKTYPE=NL,ESSWSTATUS=IDLE,WSWORKCOND=OK,WSPROTCOND=OK,
WSSWTYPE=NR,WSLCKTYPE=NL,WSSWSTATUS=IDLE,PST=IS-NR,SST=NA,,PUS=A-2-2C-2-2A-1-2C-



What I am looking to get is the LABEL, PGSTATE, ESSWTYPE, ESSWSTATUS, WSSWTYPE, WSSWSTATUS. I have tried using the strsearch and strextract commands, and I could not make them work. I may have been using them incorrectly though. If anyone can help I would greatly appriciate it. Please let me know if I need to put anymore information in the post.

Thanks,
David Melle
 
David,

I made a copy of your output file and will see what I do. I really hate unstructured data files; but that's life. I'll play with it tonight.

Also I'll try your DMS Password Script today. I don'tuse CallTrk but I do use several other Toolsup Utilities.

Hank camphm@bellsouth.net
 
Thanks Hank. I hope you get some use out of the POD script.
 
I also have created an origtime calculator for when you are doing CDR searches. Here ya go......



string CdrOrigtime
integer CdrOrigtime1,Hour,Minute,Second,SecondsRemaining,Event,Leave
integer SecondsPerHour = 3600
integer SecondsPerMinute = 60

proc main

StartOver:
CreateDialogbox()
if Leave !=0
goto EndProg
endif
OrigtimeConverter()
goto StartOver
EndProg:

endproc


proc OrigtimeConverter

atoi CdrOrigtime CdrOrigtime1
hour = CdrOrigtime1/SecondsPerHour
SecondsRemaining = CdrOrigtime1%SecondsPerHour
Minute = SecondsRemaining/SecondsPerMinute
Second = SecondsRemaining%SecondsPerMinute




usermsg "ORIGAMPM: 0=AM 1=PM - Time Of Day Is : %02d:%02d:%02d" Hour Minute Second

endproc


proc CreateDialogbox

dialogbox 0 141 52 177 109 3 "ORIGTIME Converter"
editbox 16 67 34 78 11 CdrOrigtime
text 15 17 36 52 9 "ORIGTIME:" center
pushbutton 1 34 79 40 19 "OK" DEFAULT
groupbox 30 11 10 153 55
checkbox 27 91 82 42 11 "Exit" Leave
enddialog


while 1
dlgevent 0 Event ; Get dialog event.
switch Event ; Evaluate dialog event.
case 0 ; No event occurred.
endcase
case 1 ; Button was pressed.
exitwhile ; Exit the while loop.
endcase
endswitch
endwhile
dlgdestroy 0 CANCEL ; Destroy dialog box.

endproc
 
David,

I was looking over your Report and noticed that the Fields you're looking for Falls in the Middle of the Report. Is this Always the case or at times do your Fields get split into separate Lines ??

Hank camphm@bellsouth.net
 
David,

I put this together just for Kicks; but since the data may get split, it's not 100% foolproof. The DMELLE.TXT file is your Data.

Proc Main
string sLine
string sCL
strfmt sCL "%c%c" 13 10 ;string for CR & LF
fopen 1 "C:\FILES\DMELLE.TXT" Read text
fopen 2 "C:\FILES\FILE_1.TXT" Create Text
while not feof 1
fgets 1 sLine
if strfind sLine ","
strreplace sLine "," sCL
fputs 2 sLine
endif
endwhile
fclose 1
Rewind 2
fopen 3 "C:\FILES\DMELLE_OUT.TXT" Create Text
while not feof 2
fgets 2 sLine
if strfind sLine "LABEL"
fputs 3 sLine
endif
if strfind sLine "PGSTATE"
fputs 3 sLine
endif
if strfind sLine "ESSWTYPE"
fputs 3 sLine
endif
if strfind sLine "ESSWSTATUS"
fputs 3 sLine
endif
if strfind sLine "WSSWTYPE"
fputs 3 sLine
endif
if strfind sLine "WSSWSTATUS"
fputs 3 sLine
endif
endwhile
fclose 2
fclose 3
endproc

Hank camphm@bellsouth.net
 
Hank,

Worked like a charm. You are the man...
 
David,

After reviewing the Script, I found that if you remove the TEXT Parameter from the FOPEN 2 statement, you will not experience the Data Loss that I mentioned, also there won't be any Blank Lines in your DMELLE_OUT.TXT File.

Glad to help..

Hank camphm@bellsouth.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top