Avatar of labradorchik
labradorchik
Flag for United States of America asked on

VAX DCL code to UNIX shell script logicals conversion question

I am trying to convert some of VAX DCL code (.COM) to UNIX shell script and I am having a problem with logicals for files, datasets, and directories with files or datastes. My files in the .COM are SAS programs with SAS datastets.  

I have done some search for logical define for directory in script and that works fine. But still need to find out on how to define the logical for the specific dataset since many of logicals define in *.COM are SAS datasets.  

Since I do not have to much of a UNIX knowledge, then any comments or examples will be very helpfull.
Thank you!
Unix OSScripting LanguagesProgramming

Avatar of undefined
Last Comment
labradorchik

8/22/2022 - Mon
noci

Unix doesn't have logicals.

Now I don't know SAS on unix, chances are it can use Environment variables. [ Like DCL symbols ]. and use those as a reference to data sets.

Otherwise you most probably need to specify full pathnames.

This might help:
http://www.stat.washington.edu/~handcock/506/Lectures/lec12.pdf

Page 5 contains an example to open a dataset.
labradorchik

ASKER
Thank you for your comments!
I already found out how to access SAS datasets in Unix from .SAS programs, but my question is how can I access SAS datasets and other files that are already in Unix from the script? Before I had to call all these files (.SAS, SAS datasets, and other files...) in my VAX DCL code, but how can I do nowthe same thing in Unix? I thought I could used logicals for directories and filenames?
noci

That can be done using a shell-script (bash, ksh, csh , whatever is on your system).
Like a DCL script it's just a set of commands, and you can use conditionals etc. but they are a bit different from DCL. (these links might help)
http://www3.sympatico.ca/n.rieck/docs/vms_vs_unix.html
http://www.physnet.uni-hamburg.de/physnet/vms-unix-commands.html

In OpenVMS logicals are a kernel level private ("process"), or shared ("job", "group" or "system") wide set of namespaces which is orthogonal of the filesystems that can be mounted.

Unix has no such concept at all. It only has one tree structured filesystem namespace.
you can create some kind private space by using chroot, but that's most probably not where you want to go.

The only thing is using you shell's environment variables. (they look like OpenVMS's DCL symbols) they can be accessed by a program if needed but it needs active support by a program. Like i said before i don't know SAS but you may want to browse it's unix documentation for the use of "environment" variables.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
labradorchik

ASKER
Thank you very much for your ditailed explanations!!
So, to make sure I understand it correctly. I my bash shell script (UNIX), I can't introduce simular logicals as in the VAX DCL code, for example, this is what I have used in VAX DCL code before to define my directory and file:

$ DEFINE  logical1  mydirectory1:mysasdataset.sas7bdat

Open in new window


or another directory with a .TXT file
DEFINE/NOLOG  logical2  mydirectory6:mytextfile.txt 

Open in new window


There is no way to define this in the UNIX bash shell script??

Thank you!!
noci

indeed that cannot be done.
labradorchik

ASKER
Wow, that's too bad :(
So, how can I reference my directories and filenames in the Unix bash shell script?
I am sorry to ask so many questions, but I just can't find this information in Unix manuals/books. If you have any examples of referencing that would be really great.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
noci

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
labradorchik

ASKER
Great!!  I wil try to use in my Unix shell script these directories and files just like you advised. I will post a few more questions within the next a few days regarding the conversion of VAX DCL code to Unix shell script, please see if you can answer any of them.  
Thank you very much again!!