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

QUESTION ON CONTROL CHARACTER

Status
Not open for further replies.

IncredibleVolk

Technical User
Apr 2, 2004
67
US
This isn't necessarily aspect specific but I was hoping someone here might know. I direct output from a terminal to a file and the header row contains a control character. I think I can strip it out if I know how to identify it. It appears as a straight line in the file but it's actually a little square. Is that a TAB? Either way I tried strcmp and strfind on DEBTOR and it's not working.

DEBTOR........ CLIENT#... ST CD


I was wondering if anyone knows what the character is so I could remove it from the file.


 
I tried deleting the first character if it's beyond an ascii value and I'm not having any luck.

if fopen 0 sPath READWRITE
while Counter != 100000
fgets 0 sLine
strlen sLine iLen
substr sCrap sLine 0 1
strgetc sCrap iCount iVal
if (iVal > 128)
strdelete sLine 0 1
fseek 0 (-lLen) 1
else
strlen sLine iLen
lLen = iLen
if iLen < 20
fseek 0 (-lLen) 1
fdelblock 0 iLen
ftell 0 lLen
fclose 0
endif
endif

fopen 0 sPath READWRITE
fseek 0 lLen 0
Counter ++
endwhile
fclose 0
endif
endproc
 
OK. I'm a bit closer. The problem is that the line I'm attempting to delete (contains CLIENT) isn't being recognized as a new line so I end up deleting one line of date as well.

if fopen 0 sPath READWRITE
while Counter != 100000
fgets 0 sLine
strlen sLine iLen
lLen = iLen
if strfind sLine "CLIENT"
fseek 0 (-lLen) 1
fdelblock 0 iLen
else
strlen sLine iLen
lLen = iLen
if iLen < 30
fseek 0 (-lLen) 1
fdelblock 0 iLen
ftell 0 lLen
fclose 0
fopen 0 sPath READWRITE
fseek 0 lLen 0
endif
endif
Counter ++
endwhile
fclose 0
endif
endproc
 
Are you using a capture file to save the data or another method? If you are using a capture file, check your capture settings (Options | Data Options | Setup Files menu item) and make sure you are using Write text as it appears on screen. If you do this, no control characters or escape sequences should make it into your capture file.

 
I was using a capture file but that limited me to a 132 characters on the terminal screen. By directing the output straight to file I can include more fields in the report. The problem is that the header info displayed every few pages doesn't contain a new line character. When I grab that line it includes the previous line of data. I tried using substring to parse out and delete that portion of the line but it didn't work with any kind of consistency.
 
You'll need to use Procomm's Monitor Window to identify the control character, below is some information on that feature that I copied from my site:

Procomm's Monitor Window can be used to view the incoming and outgoing data, in both hex and ASCII format. To activate this window, select the Data | Monitor Window menu item. Resize the Monitor Window so that you can view the entire width of the window, then click back in the Procomm Plus window so that the Monitor Window does not have focus. Incoming text is displayed in red, while text you send is colored blue. The Monitor Window can be handy for viewing incoming escape sequences (to determine if Procomm Plus is responding properly to them) or to verify that the program is sending the data you think it should be.

 
I'll give that a try. I decided to scrap the report for now due to a different reason. It appears that DDE starts to fail when you exceed a certain amount of columns and/or records in Excel. I added a few columns to the report and the data became sporadic as though it couldn't hold enough memory. Is there a means to clear a string? Do I need to insert pauses into ddepoke? Either way I'll give your suggestions a try.
 
Just adding a few columns to the spreadsheet shouldn't cause any performance issues. If possible, I would try to write a test script for just those new columns and see if you can repeat the problem.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top