kbang
kbang

Reputation: 704

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

Upvotes: 0

Views: 603

Answers (2)

kbang
kbang

Reputation: 704

top:

  file = f$search("[.subdir]*.PNG")
  if (file .eqs. "")then goto cont
  mtime=f$file_attribute(file,"RDT")
  if mtime.ges.build_start_time then -
      name=f>parse(file,,,"NAME")
      call CHECK "''name'"
  goto top

cont:

@Hein please review this code and suggest changes

Upvotes: 0

Hein
Hein

Reputation: 1463

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

Upvotes: 2

Related Questions