BookmarkSubscribeRSS Feed
vijayanand
Obsidian | Level 7

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.

4 REPLIES 4
error_prone
Barite | Level 11

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.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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! 

Kurt_Bremser
Super User

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.

rogerjdeangelis
Barite | Level 11
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 



sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1050 views
  • 0 likes
  • 5 in conversation