BookmarkSubscribeRSS Feed
ssbbmm
Calcite | Level 5

I need to FTP a Pipeline delimited Text file from SAS server to our Mainframe Server then to outside vendor. Since on the mainframe it got set up to receive Binary file so I have the following program:

 


filename Mov "/apps/sas/datasets/data142/Reports/MOVEMENT_3M_&FiscaL_Period._&Rundate..txt";

filename pmggdg ftp  "'PBCSECDI.EDIPH925.HOLD(+1)'" debug binary
           user="KS*****" host="********" pass="*******"
        lrecl=62  RCMD='SITE lrecl=62 recfm=s';


data _null_;
  infile Mov lrecl=62;
  file pmggdg  lrecl=62 ;
  input; put _infile_ ;
run;

filename Mov clear;
filename pmggdg clear;

 

The file was successfully sent to the vendor but it lost the original format which is pipe delimited and was changed to Tab delimited.

 

What should I do when I FTP in Binary and not losing the original format?

 

Thanks so much,

 

SSBBmm

7 REPLIES 7
ChrisNZ
Tourmaline | Level 20

Is the source server a mainframe?

If not, a binary transfer will send ASCII characters to a EBCDIC host, where they will be unintelligible.

 

Or maybe the FTP server performs a translation? In that case, its translation table may be the culprit.

ssbbmm
Calcite | Level 5

Thanks ChrisNZ for your response. My SAS server (Source) is Unix Server. Unfortunately I don't have a lot know knowledge on Mainframe. Can Mainframe accept the file in ASCII?

 

Thanks again!

Kurt_Bremser
Super User

@ssbbmm wrote:

Thanks ChrisNZ for your response. My SAS server (Source) is Unix Server. Unfortunately I don't have a lot know knowledge on Mainframe. Can Mainframe accept the file in ASCII?

 

Thanks again!


ASCII files are illegible binary blobs on the mainframe. The need to be treated as such in further actions.

Try this:

data _null_;
  infile Mov lrecl=62;
  file pmggdg  lrecl=62 ;
  input; put _infile_ $ebcdic62.;
run;

and then have the file inspected on the mainframe with the developer (PDF) tools. In further transport, text mode should be used.

ssbbmm
Calcite | Level 5

Thanks

One clarification I wanted to make is that - the text file was created in SAS EG on Unix SAS with following code:

 

DATA _null_;                                                                   
SET movement;
FORMAT EVENT_DT    YYMMDD10.;
                                        
File "&OUT/MOVEMENT_3M_&FiscaL_Period._&Rundate..txt" lrecl=150;

If _N_=1  then Do;                                                             
H1    =    'Fiscal Period';
H2    =    'Employee ID';
h3    =    'Date';
h4    =    'Type';
h5    =    'Action';

                            
Put     %OUTPUT_HEADER(COUNT=4) H5;
End;   
 
Put     FiscaL_Period    +(-1) '|'
        EMPLID        +(-1) '|'
        EVENT_DT     +(-1) '|'
        EVENT_TYPE    +(-1) '|'
        ACTION
;  
Run;

 

I was assuming the file created was ASCII.

Kurt_Bremser
Super User

@ssbbmm wrote:

 

I was assuming the file created was ASCII.


And you are absolutely right. That is why I suggested to convert it to the mainframe EBCDIC encoding during the FTP.

When we did FTP's with the mainframe, we mostly had fixed (FB) format files, and used recfm=f on the SAS side in the filename statements.

 

After further thinking about it, I propose two different methods:

  • a fully text-based method, where you use recfm=v on the SAS side and similar on the MF side, so that all conversions are done in the FTP transport layer
  • a binary method, where FTP is prevented from converting (use recfm=f or s on the SAS side), and explicitly using EBCDIC and other MF formats.

We used the latter method, because we have packed decimals in the data files, which must be transferred in binary mode.

ssbbmm
Calcite | Level 5

Much appreciate 

 

 

 

ChrisNZ
Tourmaline | Level 20
If the program that will use the file is told that this is n ASCII file then you can do it this way. Is it going to be used by SAS?

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 1780 views
  • 0 likes
  • 3 in conversation