scriptingopenvmsdcl

How to Edit a text from the output in DCL -- OpenVMS scripting


I wrote the below code, which will extract the directory name along with the file name and I will use purge command on that extracted Text.

$ sear VAXMANAGERS_ROOT:[PROC]TEMP.LIS LOG/out=VAXMANAGERS_ROOT:[DEV]FVLIM.TXT
$ OPEN IN VAXMANAGERS_ROOT:[DEV]FVLIM.TXT
$ LOOP:
$ READ/END_OF_FILE=ENDIT IN ABCD
$ GOTO LOOP
$ ENDIT:
$ close in
$ ERROR=F$EXTRACT(0,59,ABCD)
$ sh sym ERROR
$ purge/keep=1 'ERROR'

The output is as follows:

ERROR = "$1$DKC102:[PROD_LIVE.LOG]DP2017_TMP2.LIS;27392             "

Problem here is --- Every time the directory length varies (Length may be 59 or 40 or some other value, but the directory and filename length will not exceed 59 characters in my system). So in the above output, the system is also fetching the Version number of that file number. So I am not able to purge the file along with the version number.

%PURGE-E-PURGEVER, version numbers not permitted

Any suggestion -- How to eliminate the version number from the output ?

I cannot use the exact length of the directory, as directory length varies everytime.... :(


Solution

  • The answer with F$ELEMENT( 0, ";", ABCD ) should work, as confirmed. I might script something like this:

     $ ERROR = F$PARSE(";",ERROR) ! will return $1$DKC102:[PROD_LIVE.LOG]DP2017_TMP2.LIS;
     $ ERROR = ERROR - ";"
     $ PURGE/KEEP=1 'ERROR'
    

    Not sure why you have the read loop. What you will get is the last line in the file, but assuming that's what you want.