Question Traversing through log file from CIM

Cindy Umemoto

New Member
Hi I am new to Progress programming, I am just trying to read a CIM file error log file and getting the GroupIDs, Error Msgs, and ultimately I would like to get the data that was loaded for that group, and write it out to comma delimited file. If I wanted to go to specific line in file or find specific string in file to start looking for my data, what commands should I look at using?
for example, if file looks like this...

ErrorLog 11/19/2014 xxxxxxxxx xxxxxxxxxxxxxxxxxxxx : xxxxxxxxx:
Batch Data Load

xxxxxxxxxxxxx: xxxxxxxxxxxxxxxxxxxx:

GroupID: 1234 Error: this is the error message I want to capture

GroupID: 1235 Error: this is the error message I want to capture

I know it is a very basic question, but can anyone please help? Thank you
 

Pavan Yadav

Member
You can you Matches options while reading the file, to check for a particular string. And once you identified the line, then you can segregate the strings in that line by using Index and Substring Functions.

Code:
def var ic as char.
input from <Input file name>.
repeat:
   import unformatted ic.
   if ic matches "*GroupID:*" then
   do:
      <Evaluate you logic to segregate the required string by using Index and Substring>
      disp ic format "x(50)".
   end.
end.

Is this what you are looking for?
 
Top