Category Archives: Batch

Integrating WPS and Skype

One of the things I like to do in programming is integrating other tools with WPS. I don’t know why I find that so fun to do, but I just find it rewarding for some reason. Every once in a while, I stumble across a problem to be solved and it just seems like it should be something that is easy, simply because it’s so useful. That is rarely the case as we all know.

I always wanted to have some way for an interactive WPS job or a WPS batch job to notify me of an error when it reaches completion or to notify me that it has reached a certain point in the job process. One of the main requirements is that the notification be sent by text message so that I could be notified if I wasn’t sitting directly in front of the monitor of the machine that the code was submitted on.

We have been able to send text messages for years (see “Sending SMS Text via WPS”) but that was kind of clumsy because as far as I could tell, it would only send the message to my cell phone. I want more! Give me more!

Skype is the logical choice for me because I sit in front of a PC most of the day that has Skype running. I also have Skype installed on Skype is the logical choice for me because I sit in front of a PC most of the day that has Skype running. I also have Skype installed on mobile Apple and Android devices so I can receive messages through those devices pretty easily.

All I needed to do is install Skype on a Windows Server. The Server I installed it on is running Windows Essentials 2012 R2. Getting Skype on that platform can be a chore but it can be done. I ended up installing the Windows 8 version of Skype on the server and after getting it to run properly (i.e. sending and receiving messages) I installed the classic Skype for Desktop on the machine. If you are running a previous version of Windows Server… well good luck on getting it to install.

Usage

%WPS2Skype(SkypeID=minequest_llc,

                         category=-U,

                         SkypeMsgTxt = “Your job reached the halfway point you awesome guy!”);

 

Where

SkypeID is the ID of the recipient of the message

Category = -U or –CC

SkypeMsgTxt =”Your message text here.”

 

If you are a WPS programmer or are familiar with the macro language, then the above should be self-explanatory with the exception of Category. Category can take one of two options, either –U or –CC. If we want to send the message to an individual user than we use –U. If we want to send the message to a list of contacts then we use –CC. A contact list is somewhat similar to a group and you should read up on what a contact list is and how it can be created in the Skype documentation.

Running the following code:

%WPS2Skype(SkypeID=xxxxxxxxxx,

                         category=-U,

                         SkypeMsgTxt = “Your job reached the halfway point you awesome guy!”);

 

We see in the WPS log the output when the message was sent:

 

2         %WPS2Skype(SkypeID=xxxxxxxxxx,

3         category=-U,

4         SkypeMsgTxt=”Your job reached the halfway point you awesome guy!”);

 

NOTE: WPS2Skype returned execution to WPS.

 

And what I see in the Skype message window on my workstation is:

 

 

 

clip_image001

 

 

Of course, this will show up on all the devices that I have logged in to Skype using my Skype ID.

 

I also extended the Skype interface into the RunWPS.CMD file. The RunWPS.CMD is a Windows command file that allows you to run WPS as a batch job. With the integration of Skype with RunWPS.CMD, I catch all return codes from WPS and send out a Skype message if the return code is greater than zero. This is easily modified but I’m not personally interested in getting messages when jobs complete properly. I’m only interested when jobs terminate abnormally.

 

The WPS2SKYPE utility will be available in our next release. There are a few more utilities that I want to add to the package and I still have documentation that needs to either be written or cleaned up.

 

About the author: Phil Rack is President of MineQuest Business Analytics, LLC located in Grand Rapids, Michigan. Phil has been a SAS language developer for more than 25 years. MineQuest provides WPS and SAS consulting and contract programming services and is a authorized reseller of WPS in North America.

Adventures in Porting

We’ve been busy porting the new version of the Bridge 2 R over to both the Mac and Linux platforms from Windows. The Windows release of the Bridge always allowed for the use of the Bridge from within the Eclipse Workbench. WPS didn’t have the Workbench as the GUI on the Max or Linux until version 3 which is the latest release. So, here’s what I found porting a large program that has to talk to different operating platforms (i.e. calls to the OS) for such things as delete files, move files, copy files, read directories, etc… and still interface with R.

The mundane part of porting was converting a lot of “\” to “/” throughout the code. In retrospect, we could have done a better job writing the Bridge in the first place to accommodate these conventions, but we didn’t have the intention of porting code back then either.

Here’s a couple of the gotcha’s that we experienced. When you read a directory on Linux or OS X, the structure is slightly different between the two and you have to accommodate that issue. The other BIG issue is that the pathnames are much longer on Linux and OS X when reading and writing to the WPS work folders. We ended up resizing our string variables to handle that specific difference.

The above might sound trivial but one think we discovered is that when you restart your server on OS X and Linux, the new work folder is contained inside the previous folder. For example, your original folder, let’s call it work1 is now hosting work2, your new folder. Now the path name is /work1/work2. But in reality, the names of the work folders are not work1 or work2 but long strings that can be hundreds of characters long. If you have a user who likes to restart their WPS Server, you can eat up a lot of string space quickly.

Since we store a lot of metadata for the Bridge 2 R inside the work folder, R has to be able to cope with very long filenames and I’m not convinced that it really copes all that well. Speaking of file names, here’s another anomaly between Windows and Linux/OS X systems. if you have a filename such as “myfile.txt ” (note the blank space at the end of .txt) Windows handles that just fine. Windows will interpret that as meaning you wanted “myfile.txt” However, if you write such a file or try to read a file with that name under Linux or OS X, then those two names are distinctly different. On Ubuntu or Fedora, that name shows up as “myfile.txt\” when you list the files from the terminal.

It took us about three days to port the Linux version of the Bridge over from Windows. Much of that time was spent dealing with the issues in the previous paragraph. We then took the ported Linux code and tested it on OS X. It took about 20 minutes to modify the section dealing with the difference in reading directories between the two platforms, and we then had a new version of the Bridge to R running on OS X.

In retrospect, porting the code over to Unix/Linux systems was worth the effort. It took a few days for us to do the porting and much of that was due to being naive about the new ported destinations. I will talk soon about the new enhancements (and a programming change users will have to make) in the Bridge to R in my next post.

About the author: Phil Rack is President of MineQuest, LLC. and has been a SAS language developer for more than 25 years. MineQuest provides WPS and SAS consulting and contract programming services and a reseller of WPS in North America.

Using Windows Task Scheduler to Automate WPS Jobs on a Windows Server Platform

Some companies and organizations want to be able to run WPS in a batch environment using a Windows Task Scheduler. MineQuest just put together a short document that is a step-to-step illustrated guide to running WPS on the Windows Task Scheduler. The document is titled Using Windows Task Scheduler to Automate WPS Jobs on a Windows Server Platform and can be downloaded in PDF format.

Basically, you will need the RUNWPS.CMD file (you can read about that program here) and you can also download the zip file containing the command file from our website at:

http://www.minequest.com/downloads/RunWps.zip

We will update this guide if necessary or as changes in WPS dictates.

About the author: Phil Rack is President of MineQuest, LLC. and has been a SAS language developer for more than 25 years. MineQuest provides WPS and SAS consulting and contract programming services and a reseller of WPS in North America.

Add a Submit Batch Menu to Windows Explorer

One of the things that I find fascinating as a consultant is how different consultants and software developers design and implement their work environments. For the most part, when I go onsite, I almost always keep their vanilla setup just as they have implemented it. For my notebook and personal workstations, I customize them quite heavily.

I think customization of workstations/desktops (and workplace environments too) is fairly common for most hard-core programmers and “Rock-Star” developers. These folks tend to develop tools so they can gain efficiencies in their day-to-day tasks. Over the years, I’ve seen some amazing customizations and I try to borrow their ideas just as much as possible.

A hallmark of a great WPS/SAS developer in my mind is to be able to manage multiple tasks. Some of us can multi-task three or four projects at a time where as some others can only multi-task sequentially. I always liked that phrase and have waited years to use it in a blog! But it’s true! The easier it is to perform some task, the easier it is to automate it and gain efficiencies by running multiple tasks or jobs at the same time.

Today, I want to focus on WPS. In a WPS environment using the Eclipse Workbench, you can view logs and listings and edit multiple WPS programs while a program is running, but you are limited to running a single program at a time from within the Workbench. I know many developers, and count me in as one of these folks, who like to run tasks in the background such as a long running WPS program while I’m doing some editing in the Workbench.

In the SAS environment on the Windows Desktop, you can run a SAS program in batch by right clicking on a .SAS program and selecting “Run SAS Batch” or something similar to that. That’s something I’ve liked and unfortunately, it’s missing in the current WPS environment. So, I’ve put together some simple instructions that shows you how you can do the same thing.

In a previous blog post, I provided a windows CMD file that ran WPS in batch. I slightly modified this CMD file and named it “Submit WPS Batch.CMD” and you can find a link to it at the bottom of this post. This CMD file will run a WPS program in batch and you can easily add a Windows Explorer menu item so that when you right click on a program that has the .SAS extension, you can run this program in batch mode.

Below is the Windows Explorer Window with the Submit WPS Batch menu item added.

image

The first thing you have to do to get this working is to download the submitbatch.zip file and unzip it to a file folder such as c:\temp or some other folder.

Step 2 is to go to a folder that has an existing WPS program and right click on a file that has the .SAS extension and select “properties” from the context menu. Click on “properties” and then select the “Change” button. The “Open With” selection box will open.

clip_image002

Click on “Browse” and navigate to the folder that you saved the Submit WPS Batch.CMD file and select that program and then click OK. You will see that the properties box for the program will have the following attributes. Type of file: SAS File (.sas) and Opens with: Submit WPS Batch.

clip_image002[10]

The only other modification you need to do is edit the Submit WPS Batch.cmd. Make sure line 12

SET wpsloc=c:\Program Files\World Programming WPS 2

points to the proper folder where WPSI.EXE is located.

That’s all there is to adding a menu item to Windows Explorer so that you can submit a WPS program to run in batch in the background and have the log and lst files be placed in the folder where the submitted program resides.

Link: Submit_WPS_Batch.zip (1,488 bytes)

About the author: Phil Rack is President of MineQuest, LLC. and has been a SAS language developer for more than 25 years. MineQuest provides WPS and SAS consulting and contract programming services and a reseller of WPS in North America.

Running WPS in Batch Mode

When you install your copy of WPS on your Windows PC or Windows server, there’s a number of PDF files that describe the use of WPS. If you go to the help system and type in “batch” in the search box, you will see a link that explains how to setup a windows command file to run WPS in batch mode.

I have a command file that I use on a pretty regular basis that does a provides some additional information on the WPS job that you’re executing and it’s called RunWPS.CMD. RunWPS adds two things to the batch program that I personally like to see. First, it writes out to the screen if there’s an error or if the job executed correctly. If there’s an error, it tells you the type of error based on the ErrorLevel value returned by WPS. The other aspect the batch file RunWps.CMD adds is it gives you the start time, stop time and elapsed time that the job took to execute.

 cmdwindow  Click to view image

You run the batch program by simply typing:

RunWPS myprogram.sas

If you want to run your WPS program in a different priority than NORMAL, you can do that too. For example, if you want to run your program in the background in low priority, you can type:

Start /Low /B RunWPS myprogram.sas

or in high priority by using the command:

Start /High /B RunWPS myprogram.sas

After you download the program, you will have to change line 10 in RunWps.CMD to reflect the location of where WPSI.EXE is installed. On Vista 64 and Windows 7 64 bit, WPS installed by default to:

c:\Program Files (x86)\World Programming WPS 2

So you will want to modify line 10 of the RunWPS.cmd to be –

SET wpsloc=c:\Program Files (x86)\World Programming WPS 2

If you are running a 32 bit operating system, the default location that WPS was installed to is c:\Program Files\World Programming WPS 2

In that case, change line 10 of RunWPS.CMD to be –

SET wpsloc=c:\Program Files\World Programming WPS 2

You can download the 2kb zip file at: http://www.minequest.com/downloads/RunWps.zip

The program is fairly well documented and you can easily change the format of the start, stop and elapsed time from hh:mm:ss to hh:mm:ss:ms. Most of the program deals with calculating elapsed time so don’t be scared by all the statements dealing with time! Finally, one caveat and that is the program will not properly report the elapsed time if it is more than 24 hours.

About the author: Phil Rack is President of MineQuest, LLC. and has been a SAS language developer for more than 25 years. MineQuest provides WPS and SAS consulting and contract programming services and a reseller of WPS in North America.

Technorati Tags: ,,,

A Bridge to R for Linux

After a number of starts and stops, I finally got the Bridge to R running on Linux. For those who don’t know what the Bridge to R is all about, it’s an interface that allows a WPS or SAS programmer to invoke the Open Source application R from within WPS or SAS. Not only does the Bridge automate the passing of WPS or SAS data to R, it also provides for you the ability to return the R log and list file back into either WPS or SAS.

The Bridge at this time only works with WPS and should work with other Unix versions of WPS such as SUN SOLARIS as well as z/Linux and AIX on the PowerPC on the source level. Although WPS is 32 bit on all the platforms at

the moment, you can run WPS on a 64-bit OS and since R can run as a 64-bit application, you should be able to run large scale analytics with this if you have the appropriate memory available.

In a previous blog posting, I mentioned Ultraedit. I don’t think I could have done this without using UltraEdit for Linux. I’m a Windows person and before that, a mainframer with ISPF and XEDIT experience. UEX definitely cut down my learning curve with a new editor. As a matter of fact, I suggest that you download the trial of UltraEdit for Linux and give it a spin. It’s available on a fair number of platforms including Ubuntu, Fedora, OpenSUSE and Red Hat. You can also download a universal .tar package for other platforms. The Ultraedit website also points out that there is a Macintosh version coming soon.

The Bridge to R for Linux works exactly the same from a WPS or SAS programmers perspective. The Bridge allows you to use some of the features of the SAS language macro processor and the calls to invoke the Bridge2R are identical between Windows and Linux versions. The code that you write and execute should be highly portable across all platforms.

I want to continue to do some testing of the application. One thing that is different is this is a batch environment and I’m being forced into thinking in batch mode. I’m not used to that at the moment.

The other aspect is that I need to update the documentation to the Bridge to reflect that it runs on Linux. I’ll probably just create a copy of the Windows document and update the parts that are specific to the installation and release it as the Bridge to R for Linux.

The Bridge to R for Linux will be available from MineQuest at the same pricing as the Windows version. If you license WPS for Linux x86 from MineQuest, we will include the Bridge as part of the license. If you purchase your license from World Programming directly or from another vendor, the pricing we offer can be found on our website.

About the author: Phil Rack is President of MineQuest, LLC. and has been a SAS language developer for more than 25 years. MineQuest provides WPS and SAS consulting and contract programming services and a reseller of WPS in North America.

 

Random Thoughts for a Friday

Well today’s a Friday and of course, I’m a happy camper. I have some observations and experiences this week that have been piling up and  I thought they might be worth sharing before Alzheimer’s disease kicks in full blast. If you’ve come here looking for some bleeding edge WPS tech today to go with your morning Qwiki-mart Egg-a-muffin, you’re a little out of luck.

VirtualBox

If you do a lot of WPS/SAS development and are jumping between computers and operating systems, do yourself a favor and download a copy of VirtualBox. I’ve now replaced my VMware infrastructure on my desktops and notebooks with VirtualBox. I find VirtualBox is much faster than VMware’s Workstation product or it’s stripped down cousin, VMPlayer. I’ve had exactly one problem with VirtualBox since I started using it and that’s an issue of trying to run a webcam inside a VM. Other than that one problem, it’s been a great ride.

I use Windows 7 and Vista 64 in native mode and also use these 64-bit platforms as hosts for the virtual machines. I use VirtualBox for testing and developing my Linux and XP based software that runs as clients. VirtualBox has what is called seamless mode which allows you to integrate your client with your host session. It’s almost as if you were running one operating system. Oh, and did I mention it’s free?

I was looking at the notes for the 3.1 Beta release of VirtualBox and it’s pretty exciting. With this beta, you can do teleportation… really. Beam me up Scotty!

UltraEdit for Linux

I downloaded and installed a copy of UltraEdit for Linux on Wednesday. I’m still getting my chops with this whole Linux/Unix thing and the editors I’ve had to use so far are pretty anemic. UEX just came out of beta and this editor is pretty darn good! If you’ve used UltraEdit on Windows, you will be comfortable and cranking out code in no time with UEX.

uex

I’m using UEX for my WPS development on Fedora (see screen shot above – click to enlarge) and this is what I’m going to use from here on out as my Linux editor. At least until something better comes along. The price is only $50 and it’s paid for itself the first day I had it. I’ll write more on UEX and WPS at a later date, but I just wanted some of the Unix zealots to know what is available and that I won’t be torturing myself having to learn vim, vi, Emacs or some other crippled software that they like to use.

Remote Desktop Connection

We used to run Microsoft’s Small Business Server here at the office. It’s a lot of bang for the buck, but for the type of work we do here, it was overkill. It seemed like there was always an issue on connectivity or security because of the firewall/proxy/router. I’ll just say that there was a significant investment of time to keep it going.

We dropped SBS and decided to just go with a workgroup setup. We removed the SBS client software from the workstations and flattened the domain. That was easy enough. We then allowed the router to supply DHCP addresses and installed Windows Server 2003 on the former SBS box.

Everything seemed to work fine and all the workstations could talk to each other. Heck, we could even use Windows Live Messenger and get video and sound across it! That’s something we couldn’t do before because of the proxy server. However, one problem that just bugged the hell out of me was not being able to RDC into our analytics server running Win2003. No longer could we use the servers name to RDC into and we could not find a reason for this. The analytics server is running Windows 2003 EE and we have a database server running Windows 2000. Confusingly, I could RDC into the database server without issue. The analytics server was proving to be impossible. Finally, I was told by a colleague that the only way I’ll ever be able to RDC into the analytics server is by using the IP address instead of the computer name. Even with a fixed/static IP, the name resolution would never work. So, I typed in the servers IP address and chanted “Nancy Pelosi is the devil” three times for good luck and pressed enter. Voila! Instant connection.

And that’s the real reason I’m a happy camper on this Friday. Now I don’t need to get up from my chair and walk down the hall to administer that server!

About the author: Phil Rack is President of MineQuest, LLC. and has been a SAS language developer for more than 25 years. MineQuest provides WPS and SAS consulting and contract programming services and a reseller of WPS in North America.

Batch Schedulers for WPS

I’ve been thinking about the last blog post on running WPS in batch mode and it occurred to me that it might be a nice thing to have a batch scheduler that is tuned to running WPS in a client/server environment. Of course, there are batch schedulers out there that are commercial and tend to be pricey. You can get a list of these products by checking out: http://en.wikipedia.org/wiki/Job_scheduler

I’m particularly interested in products that are either open source or are very inexpensive. From a quick glance, that leaves Sun’s Grid Engine, Open Source – Job Scheduler, Torque Resource Manager and GnuBatch. After looking over the four choices, I think the Open Source – Job Scheduler is the most applicable scheduler. It supports all the platforms that WPS executes on (Windows 2000/2003/XP/Vista, and in the future Linux, Sparc Solaris and Solaris x86, and AIX) with the exception of z/OS. The scheduler also has a web interface as well as email capability. The email capability would be nice so that the system can notify you of errors in a job.

One of the features of the Open Source Job Scheduler that I like is that it can run jobs in parallel and can handle chains and dependencies. The batch language is XML so it would be easy to change and it also has a GUI. About the only thing it doesn’t have is the ability to submit code directly to the server for immediate execution by use of drag-n-drop. It does have the concept of hot folders so that maybe something that can be used in conjunction with a little programming.

One other factor of note is that you can purchase support from SOS GmbH Software that includes a ramp-up service.

So I am curious what others are using for batch scheduling in production systems now days. Is the concept of scheduling for end users something that is foreign or just so uncommon that it’s rarely considered?

About the author: Phil Rack is President of MineQuest, LLC. and has been a SAS language developer for more than 25 years. MineQuest provides WPS and SAS consulting and contract programming services and a reseller of WPS in North America.

Links:

SOS GmbH Software: http://jobscheduler.sourceforge.net/osource_scheduler_introduction_en.htm

Sun Grid Engine: http://gridengine.sunsource.net/

Torque Resource Manager: http://www.clusterresources.com/products/torque-resource-manager.php

GnuBatch: http://www.gnu.org/software/gnubatch/

World Programming Company: http://www.teamwpc.co.uk/home

Batch Processing in WPS

As customers continue to push the envelope and run ever larger programs with WPS (and I’ve noticed some really large and long running programs out there) the desire to run WPS in batch mode is becoming more prevalent. Batch mode in Windows is pretty easy once you get the hang of it, and has many advantages too.

So why run WPS in batch? There are numerous reasons but just a few of them include being able to run jobs unattended, use of a batch scheduler or Windows Task Scheduler, and to limit the amount of resources used to execute a program by using the Priority and/or Affinity commands. WPS comes with some information on running from a command line (see the WPS Workbench Users Guide, pp 43 – Running Scripts) and some sample code that you can use to get started. What I want to show is a Windows Command file that you can use and modify to run your WPS programs in batch mode.

The command file, WPS.CMD allows you to run a WPS program by simply typing:

WPS myWPSpgm.sas

where :

WPS is the name of the command file, and myWPSPgm.sas is the name of the WPS program that you want to run.

This command file has a few advantages though. It tells you the start and stop time that the program was run and also lists out the DOS Return Code that tells you if the WPS program ran successfully or not.

clip_image002

 

There are seven return codes that are captured from WPS. The table below contains the code, the severity level and a short description.

Return Code

Severity Level

Description

0

Success

Job completed successfully

1

Warning

Job completed with warnings

2

Error

Job did not complete, programming error

3

Informational

User issued ABORT Statement encountered

4

Fatal

User issued ABORT RETURN encountered

5

Fatal

User issued ABORT ABEND encountered

6

Informational

WPS internal error

 

Below is the contents of the WPS.CMD file.

   1: @echo off

   2: CLS

   3: REM ======= Execute the WPS program with the filename extension ====

   4: REM Call as: WPS myjobname.sas

   5: REM Common command line parms: /Start /Low /B myjobname.sas

   6:  

   7: rem wpsloc is where the wpsi executable is located.

   8: set wpsloc=c:\Program Files (x86)\World Programming WPS 2

   9: set starttm=%time:~0,8%

  10:  

  11: echo WPS JOB - %~f1 execution initialized at: %starttm%...

  12:  

  13: "%wpsloc%\bin\wpsi.exe" "%~f1" >; "%~d1%~p1%~n1.log"

  14:  

  15: SET ERRORLEV=%ERRORLEVEL%

  16: set stoptm=%time:~0,8%

  17:  

  18: REM Report on the WPS Error Codes

  19: IF %ERRORLEV% == 0 echo WPS JOB %~f1 Completed Successfully. RC = %ERRORLEV%. Start Time: %starttm% End Time: %stoptm%

  20: IF %ERRORLEV% == 1 echo WPS JOB - %~f1 WARNING: Job Completed with Warnings. RC = %ERRORLEV%. Start Time: %starttm% End Time: %stoptm%

  21: IF %ERRORLEV% == 2 echo WPS JOB - %~f1 ERROR: Job Did NOT Complete. RC = %ERRORLEV%. Start Time: %starttm% End Time: %stoptm%

  22: IF %ERRORLEV% == 3 echo WPS JOB - %~f1 INFORMATIONAL: ABORT Statement. RC = %ERRORLEV%. Start Time: %starttm% End Time: %stoptm%

  23: IF %ERRORLEV% == 4 echo WPS JOB - %~f1 FATAL ERROR: ABORT RETURN Statement. RC = %ERRORLEV%. Start Time: %starttm% End Time: %stoptm%

  24: IF %ERRORLEV% == 5 echo WPS JOB - %~f1 FATAL ERROR: ABORT ABEND Statement. RC = %ERRORLEV%. Start Time: %starttm% End Time: %stoptm%

  25: IF %ERRORLEV% == 6 echo WPS JOB - %~f1 INFORMATIONAL: WPS Internal Error. RC = %ERRORLEV%. Start Time: %starttm% End Time: %stoptm%

  26:  

  27: rem

  28: rem ======================= END CMD File ====================

  29:  

 

You can simply “copy and paste” the code above but make sure that your lines don’t wrap when you paste it into your editor.  One thing to be aware of is that the location of the WPS system will probably be different for your installation if you are not running Vista 64. If you are running a 32 bit version of Vista or XP, you will probably have to change the location in line 8 from above to something like:

set wpsloc=c:\Program Files\World Programming WPS 2

Setting Priorities

At the beginning of this article, I mentioned running in batch is useful to conserve resources. You can run your WPS program in batch in LOW priority by executing the WPS command file like:

     Start /Low WPS myWPSpgm.sas

This will cause your program to run in the background (Low priority) allowing you to run other tasks without a lot of drag on your system. Other values that you might want to experiment with include:

    Start /Normal WPS myWPSpgm.sas 

    Start /High WPS myWPSpgm.sas

Finally, I’ve included a short WPS program that you can use to test for detecting different error levels and conditions. All you have to do is remove the asterisk to create the error that you want to examine and test how well the WPS.CMD file catches the error.

 

   1: /* Test program to demonstrate throwing return codes */

   2: /* running batch using WPS on Windows XP and Vista. */

   3:  

   4: data one;

   5:   do ii=1 to 500000;

   6:     a=rannor(0); b=ranuni(0); 

   7:     c=rannor(0); d=ranuni(0);

   8:     e=rannor(0); f=ranuni(0); 

   9:     g=rannor(0); h=ranuni(0);

  10:     i=rannor(0); j=ranuni(0);

  11:     output;

  12: 

  13: *  if ii = 200 then abort;        *--> Throw Fatal Error #3;

  14: *  if ii = 200 then abort return; *--> Throw Fatal Error #4;

  15: *  if ii = 200 then abort abend;  *--> Throw Fatal Error #5;

  16:  

  17:  end;

  18: run;

  19:  

  20: Proc corr data=one; 

  21: where ii < 500;

  22: run;

  23:  

  24: /* StdErr throws a warning #1 */

  25: *  proc means data=one n nmiss min max stderr ; 

  26: *  run;

  27:  

  28:  

  29: /* StdErr throws a warning #2 */

  30: *   proc means data=onex n nmiss min max ; 

  31: *   run;

In my opinion, this is the easiest way to run WPS jobs in batch. It provides some basic information and gives you the values of the return codes that can be useful for when using other job entry systems.

Update: I uploaded a zip file that contains the WPS.CMD batch program and the test1.sas program. You can downloaded it from by clicking here.

About the author: Phil Rack is President of MineQuest, LLC. and has been a SAS language developer for more than 25 years. MineQuest provides WPS and SAS consulting and contract programming services and a reseller of WPS in North America.