LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-23-2013, 08:53 AM   #1
OldSASguy
LQ Newbie
 
Registered: Oct 2013
Location: Columbus, OH
Posts: 4

Rep: Reputation: Disabled
Post Letting Linux control program process written in SAS


I cut my programming teeth on the IBM Mainframe using JCL/JES2. I am used to being able to determine whether a series of programs would continue (in SAS) based on conditional JCL statements - looking at return codes. If one of the programs errored-out, the JCL step would halt the program flow and notify the user of the problem.

Is there such a facility available in Linux?

Here is an example (all written in SAS): I have one program which in turn calls (includes) other programs. I want to be able to (1) halt the program flow if one of the programs bombs, (2) notify the user of the error and which program was at fault.
 
Old 10-23-2013, 09:14 AM   #2
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
Linux, and Unix in general, and in fact operating systems in general, all provide this facility ... through the notion of "scripting languages."

In the Unix environments, you typically have several such languages at your disposal: Bash-scripts; Perl; Python; Java; even PHP can be pressed into service. If you begin a file with #!language_processor_name, this tells the shell what language-processor to invoke to "run" the file when, having made the file "executable," you type-in its name. So, you can write it in any language you please, and It Just Works.™

Microsoft Windows finally came on-board with a halfway decent shell .. .. which they call PowerShell, and which of course is totally different. (Microsoft is like that...)

All of these facilities have the ability to "exec" another process as a child of itself, and to wait for that process to complete, collecting a return-code that is provided by the program when it exits. Just like MVS did. It's just a whole heck-of-a-lot more powerful and flexible than JCL ever was.

You could, for example, write a command which contains a list of SAS programs that are to be executed, and it cycles through that list, invoking sas program_name and waiting for that run to complete. If the return-code is zero, indicating success, it continues running through the list. If nonzero, your program would print an error-message of some kind and stop.
 
1 members found this post helpful.
Old 10-23-2013, 09:18 AM   #3
OldSASguy
LQ Newbie
 
Registered: Oct 2013
Location: Columbus, OH
Posts: 4

Original Poster
Rep: Reputation: Disabled
Outstanding and thanks
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I have written a C++ program in windows and it fails to work on linux Corps Linux - Newbie 4 08-10-2009 12:35 PM
have you ever written a program for linux? today53 General 33 12-05-2003 06:54 PM
Process or program to regain root control from chroot() hack? flailer Linux - General 2 09-09-2003 03:42 AM
Process or program to regain root control from chroot() hack? flailer Linux - Security 0 09-07-2003 04:47 PM
a c program written for linux will work in sco unix? cybercop12us Linux - General 3 04-25-2002 07:44 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration