Previous Page | Next Page

Examples Using Compute Services

Example 6: Using MP CONNECT with Piping


Purpose

In this program, the MP CONNECT piping facility uses ports rather than disk devices for data I/O. The first process writes a data set to PIPE1. The second process reads the data set from PIPE1, performs a calculation, and directs final output to a disk device. The P1 and P2 processes execute asynchronously.


Program

/* -----------  DATA Step - Process P1  ----- */
signon p1 sascmd='!sascmd';
rsubmit p1  wait=no;

libname outLib sasesock ":pipe1"; 

/* create data set - and write to pipe */
data outLib.Intermediate;
   do i=1 to 5;
       put 'Writing row ' i;            
       output;
   end;
run;
endrsubmit;
rdisplay p1;

/* -----------  DATA Step - Process P2  ----- */

signon p2 sascmd='!sascmd';
rsubmit p2  wait=no;

libname inLib sasesock ":pipe1";
libname outLib "d:\temp"; 

data outLib.Final;
set inLib.Intermediate; 
   do j=1 to 5;
        put 'Adding data ' j;	         
        n2 = j*2; 
        output;
   end;
run;
endrsubmit;
rdisplay p2;
/* -------------------------------------------- */

Previous Page | Next Page | Top of Page