Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

how to write dcl to shell

sreereddy
Occasional Visitor

how to write dcl to shell

! cee_dir_command.com - SPECIAL for CEE:
$!
$ set term/width=132
$ DIR/Date=Created/nosize/noheader/ -
width=(filename=90,display=130)/ -
exc=(OLD_*.*,ORIG_*.*,CYCLE*.COM,CEE*.*,VCCL_*.*,VISUALEXPLOR*.*)/ -
output=cee.txt -
'p1'*.prg;0,*.com;0
$set term/width=80
$ write sys$output "-- output file created is named CEE.TXT"
$exit
Please translate the above script
4 REPLIES
labadie_1
Honored Contributor

Re: how to write dcl to shell

Hello

The dir command translates in a shell in a ls or in a find command, depending upon circumstances.

$ set term/wid=80 translates to stty col 80

and write sys$output translates to echo
Wim Van den Wyngaert
Honored Contributor

Re: how to write dcl to shell

The set term is not required when doing /out.
May be it is there to do debugging without the /out.

Wim
Wim
Hoff
Honored Contributor

Re: how to write dcl to shell

Porting off of OpenVMS, eh? OK.

Asking OpenVMS folks in an OpenVMS forum to write Unix shell code? That's likely not the most expedient course here.

There are forums around for folks that know Unix shell scripting; there are some folks here, but fewer. Best to use a Unix forum, and describe what you want done here; it looks like somebody's established a list of files they don't want to see in a directory listing.

The only command within that DCL procedure that matters here is the directory command. The "stuff" around it is likely intended to encourage the DIRECTORY command to display full-width filenames (sans wrapping) for what are undoubtedly long filenames used in the default directory.

As for the commands most likely used here over on Unix:

man ls
man grep

You'll likely be piping the output from ls into grep to remove the filenames you don't want to see; regular expressions. There are other ways (like find or such) to "nest" shell commands to act on individual files.

DCL and bash command comparison:

http://labs.hoffmanlabs.com/node/741

One wrinkle: there is no direct analog for the OpenVMS created date on various Unix boxes. Mac OS X, various BSD and some other Unix boxes do have a creation date.

http://labs.hoffmanlabs.com/node/138
Hein van den Heuvel
Honored Contributor

Re: how to write dcl to shell

Impossible!
That's the 'fun' answer because using file systems do NOT have a 'create time' attribute.

What problem are your really trying to solve?
Please provide a slightly larger context.
What is the crux of your question... the exclusions or the byte offsets for the columns of data or all?

My guess is that you need a file with directory information to be further processed by a next stage, maybe to drive an FTP or other job.

If you force Unix style commands to generate OpenVMS formatted output, than that next phase will have to be coded to un-ravel that.

It may be better to just accept the 'ls -l' output and enjoy the optional date ordering it offers, and post-filter it with GREP or AWK.
Something like:
ls -l | awk '!/^OLD/ && !/^ORIG/ && ... { print $8 }

Now for the exclusion please consider whether that list was driven due to the WEAKNESS of OpenVMS to specify inclusions. On OpenVMS you can only specify a wildcard character or range. On Unix you can specify specific values for example 200[89] to specify just the last 2 years. On OpenVMS that would be 200? and you would have to post-filter.

Personally I would look for a solution which would work on Unix as well as OpenVMS, for obvious test reasons.
For example some PERL similar to:

use Cwd;
for (<*.*>) {
next if /^old/i or/^orig/i or /^cycl*com$/;
printf "%-90s%s\n", cwd().$_, scalar localtime((stat)[9]);
}

Good luck!
Hein.