DATA Step, Macro, Functions and more

SAS Programs Migration

Reply
Occasional Contributor
Posts: 12

SAS Programs Migration

Hi,

 

I need to migrate SAS programs of 9.1 from mainframes to Linux (SAS version 9.4). Is there any easy way to migrate all the programs in one go instead of FTPying one by one from Mianframes to Local and then from Local to Linux?

 

Can PROC CPORT and CIMPORT acheive this?

 

Thanks,

Vijayanand.

Contributor
Posts: 33

Re: SAS Programs Migration

You find the documentation of proc cport there: https://support.sas.com/documentation/cdl/en/movefile/59598/HTML/default/viewer.htm#a002576217.htm

 

Afaik no tool exists to convert programs.

Super User
Super User
Posts: 7,401

Re: SAS Programs Migration

What do you mean by migration in this sense?  If it is just moving the files from one system to another then compress (7-zip or some similar) all the files up, then FTP that one zip across and unpack.  If you mean there are changes to the code, or there are binary files within then you will need a migration plan.  Datasets could be converted to XPT, same with catalogs - however bear in mind that if you are moving from a 32bit system onto a 64bit system catalogs will not work - there is no migration path for those - you will need to re-compile - take this as one very good reason to never use proprietary compiled formats! 

Super User
Posts: 6,938

Re: SAS Programs Migration

Program files are text files. This means that you need a tool that converts mainframe text (which uses EBCDIC) to ASCI text (taking care of the codepages used). The simplest tool for that is FTP, as it dows such converision on the fly when asci or text mode is used during the transfer.

 

You can do a bulk transfer in FTP, depending on how your SAS codes are stored on the mainframe.

 

If your MF people followed typical MF convention, your SAS codes are stored in a mainframe partitioned dataset named something like PROD.SOURCE.SAS.

SAS code X1234567 would then be adressed in the mainframe catalog as PROD.SOURCE.SAS(X1234567).

 

When you FTP to the MF, you can change directory (which actually moves you through the levels of the catalog) to PROD.SOURCE.SAS, then do "prompt" (which disables a yes/no prompt for each individual entry), and then use "mget *" to transfer all memebers of PROD.SOURCE.SAS in one step. Do this FTP directly from the UNIX server.

You will then have to take care of adding the proper .sas extension (and probably converting the filenames to lowercase) on the UNIX side.

 

This all only transfers the codes as such. Adapting the codes to your new environment will require human intervention.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Valued Guide
Posts: 505

Re: SAS Programs Migration

see
https://goo.gl/kNyge9
http://mainframewizard.com/content/jcl-unload-all-members-pds-ps-flat-file

If you want more control:

You have some good advice, but beware I have gad issues with some of these not converting to ascii. "|" and  "^". You can do the entire process interactively in TSO using SAS. I always thy to use '!!' instead pf '|' and 'NOT' instead of '^'.

This macro will put all the member names of a PDS into a SAS datastep.

%macro pdsmemb(ddname,file=work.members);

  %* find the members of a pds
     by Paul Shipley, Melbourne, Australia
  %* ;

  data &file.;
    keep dsn member;
    infile &ddname recfm=u blksize=256 lrecl=256
                 jfcb=jfcb eov=eov eof=eof;
    do while (1);   /* do forever, eof will exit */
      eov = 0; col = 3; lastmem = 0;
      input count pib2. @;
      dsn=substr(jfcb,1,44);
      do while(eov = 0);
        if lastmem = 0 then do;
          input @col member $8. +3 ind pib1. @;
          if member =< '99999999' then do;
            col = col + 12 + 2*mod(ind,32);
            if col > count then do; /* if end of input, fetch next rec*/
              input; input count pib2. @; col = 3;
            end;
            output;
          end;
          else do; /* if member hi-values, set flag */
            lastmem = 1;
          end;
        end;
        else do; /* if lastmem flag set skip until eov */
          input; input @;
        end;
      end; /* end while (eov=0) */
    end; /* end while (1) */
    return;

    eof:
     stop; /* end of file, stop processing */
  run;

%mend pdsmemb;

You can then write a macro to read each member, convert to ascii and fix the 

something like

%macro onetxt(member);
   data_null_;
      infile ddname(&member);
      input;
      * fix '|' to '!!' and '^' +;
      _infile_=put(_infile_,$ascii80.);
      file ddname mod;
      put _infile_;
  run;quit;
%mend onetxt;

You can also use 



Ask a Question
Discussion stats
  • 4 replies
  • 307 views
  • 0 likes
  • 5 in conversation