Computing.Net > Forums > OpenVMS > f4search help in DCL Script

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

f4search help in DCL Script

Reply to Message Icon

Name: Rob
Date: December 4, 2003 at 13:39:32 Pacific
OS: VAX/VMS 6.X
CPU/Ram: MicroVAX
Comment:

I'm trying to pass a var into F$SEARCH.
What is wrong with this:

$ FILNAM = "INFOPLUS$ROOT:[SITE.RUNTEST]*.TST"
$ T_STR := "is testing"
$ T_SP := " "
$ SV_FSP :=
$LOOP_1$
$ FSP = F$SEARCH('FILNAM)
$ IF SV_FSP .EQS. "" THEN SV_FSP = FSP
$ IF FSP .EQS. SV_FSP THEN GOTO EXIT_LOOP_1
$ TYPE FSP
$ SV_FSP = FSP
$ GOTO LOOP_1
$EXIT_LOOP_1:




Sponsored Link
Ads by Google

Response Number 1
Name: ME
Date: December 6, 2003 at 06:54:52 Pacific
Reply:


The single quote in f$search is not necessary, so F$search(filespec) should be sufficient.


0

Response Number 2
Name: ME
Date: December 6, 2003 at 07:00:10 Pacific
Reply:

Two other minor changes :
- A label should end wit a semicolon, so the label loop_1$ should be loop_1:
- you can avoid the use of sv_fsp if you jump straight to the exit_loop_1 label. the loop will look like this :

$ FILNAM = "INFOPLUS$ROOT:[SITE.RUNTEST]*.TST"
$LOOP_1:
$ FSP = F$SEARCH(FILNAM)
$ IF FSP .EQS. "" THEN goto exit_loop_1
$ TYPE FSP
$ GOTO LOOP_1
$EXIT_LOOP_1:


0

Response Number 3
Name: lsk55
Date: January 2, 2004 at 19:36:15 Pacific
Reply:

Just because I'm a bit neurotic about such things, I'd prefer it to look like:

$ FILNAM = "INFOPLUS$ROOT:[SITE.RUNTEST]*.TST"
$LOOP_1:
$ FSP = F$SEARCH(FILNAM)
$ IF FSP .NES. ""
$ THEN
$ TYPE FSP
$ GOTO LOOP_1
$ ENDIF
$ ...

Of course, TYPE INFOPLUS$ROOT:[SITE.RUNTEST]*.TST will do the same thing. :-)


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to OpenVMS Forum Home


Sponsored links

Ads by Google


Results for: f4search help in DCL Script

dcl script help www.computing.net/answers/openvms/dcl-script-help/334.html

DCL script for F$GETQUI needed www.computing.net/answers/openvms/dcl-script-for-fgetqui-needed/310.html

DCL script to check for empty file www.computing.net/answers/openvms/dcl-script-to-check-for-empty-file/296.html