openvmsvmsdcl

dcl assignment from a command


I am new to DCL.

I want to get the out put of a command in a variable and iterate result one by one.

filePath=dir /since="time_now" [.SUBDIR]*.PNG/noheader/notrail


Solution

  • That's just not how we roll with DCL.

    We don't do pipes, we do, but not really.

    DIR/SINCE=NOW ... will not give anything by definition, since nothing exists since now.

    Use /OUT to stick the directory output into a file, and then read ans parse (F$PARSE and/or F$ELEMENT and/or F$LOC)

    Check out HELP OPEN; HELP READ [/END]; HELP LEXICAL

    Google for examples.

    More advanced DCL scripts use F$PARSE, F$SEARCH and F$FILE(file,CDT) to avoid activating images and creating temp files: $ HELP LEXICAL

    Google for examples. Check out yesterday stack-exhange entry ?! : OpenVMS - DELETE Line if TEXT like x

    But if you are just starting... IMHO just skip DCL and stick to PERL

    $ perl -e "for (<[.SUBDIR]*.PNG>) { next unless -M > 0.123; print; ... }"

    Good luck! Hein