Solved

VAX DCL code to UNIX shell script logicals conversion question

Posted on 2012-03-16
8
593 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 40

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 40

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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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
 
LVL 40

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 40

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

749 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