Solved

VAX DCL code to UNIX shell script logicals conversion question

Posted on 2012-03-16
8
587 Views
Last Modified: 2012-03-19
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!
0
Comment
Question by:labradorchik
  • 4
  • 4
8 Comments
 
LVL 39

Expert Comment

by:noci
ID: 37732746
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.
0
 

Author Comment

by:labradorchik
ID: 37733504
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?
0
 
LVL 39

Expert Comment

by:noci
ID: 37734746
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.
0
 

Author Comment

by:labradorchik
ID: 37738053
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!!
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 39

Expert Comment

by:noci
ID: 37739274
indeed that cannot be done.
0
 

Author Comment

by:labradorchik
ID: 37739500
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.
0
 
LVL 39

Accepted Solution

by:
noci earned 500 total points
ID: 37739792
Usume you have some directories with datasets below that: (/data/mysasdata/dataset1/whatever, /data/mysasdata/dataset2/whatever )

you can chdir to some directory (say /data/mysasdata/)
And then reference the datasets with:

dataset1/whatever will access your first dataset
and
dataset2/whatever will access the 2nd one.

Or use full specs:
/data/mysasdata/dataset1/whetever etc.
0
 

Author Comment

by:labradorchik
ID: 37739904
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!!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
This is an explanation of a simple data model to help parse a JSON feed
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now