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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pattern matching with Aspect

Status
Not open for further replies.

hankm3

Programmer
Jan 27, 2002
284
US
Hello,

Have to develope a Script using Ascpect to obtain Multiple Records from a Database. Each Record may vary depending on the Type of Telephone Service that is in the Datbase. I need to search each Record and create a "Ticket" with Just the Information on that Line. A Telephone Number will have the Following: TN LEN LCC CP Field But could have a TP and MISC Field. So the Script has to check each Record and Create a "Ticket" with only the Information Present. Sort of a Case Statement.

Thanks

Hank
 
Is this a text based database, or some binary format? Procomm Aspect's optimal use is for handling "flat" text files. If this is a binary database (ie: Access) the macros or scripting associated with that program will be easier to use. Robert Harris
Communications Advantage
 
Robert,

Yes this is a Text based output from the Database. Each record Starts with a Line String indicating that the Record follows and when the Record Finishes anouther Line String comes out Indicating that the Record has Finished.

Example:

##### Inq Started #####
TN: 954-777-0120

(More Info)

##### Inq Completed ######

I need to extract Specific Fields between the Start and End of the Query Record.

Thanks

Hank

####
 
I have done similar scripts with different types of reports where I needed to perform certain actions (add to a specific file, parse differently, etc.) based on the title of the report.

In your case, if the "##### Inq Completed ######" characters appear at the end of every record, you could use that line as a end flag using the "if, elseif" commands. Something like this:
Code:
Proc Main
String DBRECS = "RECORDS.TXT" ; Name of the database file
String TEMPFILE = "temp.txt"  ; For processing records
String Line1

Fopen 0 DBRECS read text
While not feof 0
  fgets 0 LINE1 ;GRabs a line form the file
  if strfind LINE1 "##### Inq Started #####"
    fopen 1 TEMPFILE readwrite text
    While not feof 0
      fgets 0 LINE1 ; Collects the next line from DBRECS
      If strfind LINE1 "##### Inq Completed ######"
        Exitwhile; Exits collection prcess
      Else
        Fputs 1 LINE1 ; Puts string info into TEMPFILE
      Endif
    Endwhile
    fclose 1
  Endif
  Rename TEMPFILE "Myticket.txt"
Endwhile
Endproc
Robert Harris
Communications Advantage
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top