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
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.
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!
@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.
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.
@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:
We used the latter method, because we have packed decimals in the data files, which must be transferred in binary mode.
Much appreciate KurtBremser.
I just sent another version with your suggested method by adding EBCDIC and kept recfm=s.. It seems a success from my end but have to wait our vendor to check tomorrow morning.
Thanks again! I will keep you posted.
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!
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.
Ready to level-up your skills? Choose your own adventure.