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

Capturing data strings

Status
Not open for further replies.

milo63

Technical User
Jul 3, 2002
17
US
I am new to Aspect and I hope someone can get me started in the right direction. I am trying to capture several data strings and assign them to string variables. I will be getting the data from a Sun (Unix) server and need to know the best way to collect the data. Here is an example of what I want to do:
Open the file "/vol/pat/peers.cfg"
Search for all lines with "node ="
this should output something like "node = host1 " and "node = host2 " (without quotes)
Search for all lines with "port ="
this should output something like "port = 104 " and "port = 4004 "
I need to strip trailing spaces and assign them to string variables. The string lengths will vary also.
My 4 variable stings values should be host1 host2 104 and 4004
Print out string variables values.

Should I use unix grep and fgrep commands to filter down to the data string I am looking for and then do a screen capture or go right to the file and do a string capture? Any help is appreciated.
 
the srtfmt command - that was just a typo. I have it correct in my script. However it is not running correctly. It compiles ok but it never actually runs. Is this the way it should be?

proc main
string sLine
string hTok1
string nTok1
string pTok1
string gTok1
string dTok1
string Output
string Command_Line
string szName = "D_peers_data.cap"

clear
set capture overwrite on
set capture query off
set capture file szName

transmit "^M"
waitfor "]"
clear
transmit "cat /vol/patients_db/dicom/dicompeers.cfg |egrep '%|node|port|called|calling' |fgrep -v #^M"
Capture on
waitfor "]"
Capture off

fopen 1 "C:\program files\procomm plus\capture\D_peers_data.cap" READ TEXT
while not feof 1
fgets 1 sLine
if strfind sLine "%"
strtok hTok1 sLine "%" 1
endif

if strfind sLine "node = "
strtok nTok1 sLine " = " 2
endif

if strfind sLine "port = "
strtok pTok1 sLine "port = " 1
endif

if strfind sLine "callingAEtitle = "
strtok gTok1 sLine " = " 2
endif

if strfind sLine "calledAEtitle = "
strtok dTok1 sLine " = " 2
strfmt Output "%s,%s,%s,%s,%s" hTok1 nTok1 pTok1 gTok1 dTok1
Termwrites Output
Termwrites "`n`r"
endif
endwhile
strfmt Command_Line "dicom_echo -c %s -t %s -v %s %s" dTok1, gTok1, nTok1, pTok1
fclose 1
endproc

Nothing ever echos on the screen for the strfmt Command_Line.... line. Any ideas why?

 
You need to add a transmit Command_Line statement to your script, just after the strfmt command, to send the command line to the remote computer. You will probably need to add a ^M to the very end of the string so that the command is executed automatically.
 
That worked good. Here's my screen output (below). When I run my dicom_echo command it only uses the last entry (in this case it is ALI_Broker). Is there an easy modification which will allow me to test any 1 of these 6 entries (ALI_PACS, Adac_RTP, PACS_cube, etc...) Maybe have a user prompt to select which one to test (using the dicom_echo command)?

SUPERUSER@adac:#[20] ALI_PACS,s,4000,LI_STOR,DICOM_SCP
Adac_RTP,a,104,D,DICOM_SCP
PACS_cube,pacscub,4006,D,RIM
mitra_RIS,br,3320,D,BROK
ToshibaNM,ultra1,104,D,DICOM_SCP
ALI_Broker,alibr,3320,brok,DICOM_SCP

Here's the dicom_echo line again:
srtfmt Command_Line "dicom_echo -c %s -t %s -v %s %s" dTok1, gTok1, nTok1, pTok1

 
A Test Like this might Help:

If dTok1 = "ALI_Broker"
;* Execute Command_Line ** Use Run or Execute **
endif

Just an Idea

Hank
 
You would need to move the strfmt command inside your while loop if you want to run the command line with each group of data. If you are back at a command prompt when you are reading from your capture file, then this should work for you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top