What options are needed to process (read, write) EBCDIC data on Windows and keep the data in EBCDIC format?
We have a need to download data from a mainframe and process it in SAS on windows while keeping it in EBCDIC format so it can be returned to the mainframe for additional processing.
I’ve tried several variations in a little test pgm and always come back with the error in the log (below). What am I missing ???
Note: we FTP the file using a BINARY transfer along with the options RECFM=F LRECL=80.
SASLOG follows
NOTE: PROCEDURE PRINTTO used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 20.09k
OS Memory 19280.00k
Timestamp 09/18/2017 01:16:43 PM
Step Count 376 Switch Count 0
SYMBOLGEN: Macro variable JOBPATH resolves to i:\APPL_DATA\OSYS065\RPTlib\zOAC0486\D2017-09-18_Mon_13-16-43
SYMBOLGEN: Some characters in the above value which were subject to macro quoting have been unquoted for printing.
SYMBOLGEN: Macro variable JOBSNAME resolves to S0001.
SYMBOLGEN: Macro variable JOBPGM resolves to zOAC0486f.
MPRINT(JOBEXEC): PROC PRINTTO PRINT="i:\APPL_DATA\OSYS065\RPTlib\zOAC0486\D2017-09-18_Mon_13-16-43\S0001.zOAC0486f.SASLIST.txt";
SYMBOLGEN: Macro variable DEBUG resolves to YES
SYMBOLGEN: Macro variable JOBPATH resolves to i:\APPL_DATA\OSYS065\RPTlib\zOAC0486\D2017-09-18_Mon_13-16-43
SYMBOLGEN: Some characters in the above value which were subject to macro quoting have been unquoted for printing.
SYMBOLGEN: Macro variable JOBSNAME resolves to S0001.
SYMBOLGEN: Macro variable JOBPGM resolves to zOAC0486f.
JOBexec INFO: SASLIST assigned to i:\APPL_DATA\OSYS065\RPTlib\zOAC0486\D2017-09-18_Mon_13-16-43\S0001.zOAC0486f.SASLIST.txt
SYMBOLGEN: Macro variable SOURCE resolves to MYSOURCE
SYMBOLGEN: Macro variable SOURCE resolves to MYSOURCE
SYMBOLGEN: Macro variable PGM resolves to zOAC0486f
NOTE: %INCLUDE (level 1) file MYSOURCE(zOAC0486f) is file D:\APPL\OSYS065\zoac0486f.sas.
2559 + FILENAME INFL01 'D:\APPL\OSYS065\For_FTP\TGLP.PERM.GLAT281.INPUT.SPPSU.DAT' RECFM=F LRECL=80;
MPRINT(JOBEXEC): FILENAME INFL01 'D:\APPL\OSYS065\For_FTP\TGLP.PERM.GLAT281.INPUT.SPPSU.DAT' RECFM=F LRECL=80;
2560 + FILENAME SPPSU 'D:\APPL\OSYS065\For_FTP\NEW.PERM.GLAT281.INPUT.SPPSU.DAT' RECFM=F LRECL=80;
MPRINT(JOBEXEC): FILENAME SPPSU 'D:\APPL\OSYS065\For_FTP\NEW.PERM.GLAT281.INPUT.SPPSU.DAT' RECFM=F LRECL=80;
2561 +
2562 +
2563 + /******************************************************************/
NOTE: PROCEDURE PRINTTO used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.01 seconds
memory 170.96k
OS Memory 19280.00k
Timestamp 09/18/2017 01:16:43 PM
Step Count 377 Switch Count 6
2564 + DATA ACTV;
MPRINT(JOBEXEC): DATA ACTV;
2565 +
2566 + INFILE INFL01 ENCODING='EBCDIC1047';
MPRINT(JOBEXEC): INFILE INFL01 ENCODING='EBCDIC1047';
2567 + INPUT @ 1 SPPSC $5.
52 The SAS System 13:16 Monday, September 18, 2017
2568 + @ 7 TOKEN $11.
2569 + @ 23 PSTATCD $2.
2570 + @ 26 PSTATTP $4.
2571 + @ 31 PUSED PD3.1
2572 + @ 35 NEW PD3.1;
MPRINT(JOBEXEC): INPUT @ 1 SPPSC $5. @ 7 TOKEN $11. @ 23 PSTATCD $2. @ 26 PSTATTP $4. @ 31 PUSED PD3.1 @ 35 NEW PD3.1;
2573 +
2574 +
2575 + PUSED = PUSED + 1;
MPRINT(JOBEXEC): PUSED = PUSED + 1;
2576 +
2577 +%JOBprint(UNIT=21);
MPRINT(JOBPRINT): OPTION NOMPRINT NOSYMBOLGEN
NOTE: The infile INFL01 is:
Filename=D:\APPL\OSYS065\For_FTP\TGLP.PERM.GLAT281.INPUT.SPPSU.DAT,
RECFM=F,LRECL=80,File Size (bytes)=37920,
Last Modified=18Sep2017:10:35:52,
Create Time=18Sep2017:10:42:44
FATAL: Wide character FILE/INFILE/FILENAME options have been specified. Wide character support is not currently enabled.
FATAL: Unrecoverable I/O error detected in the execution of the DATA step program. Aborted during the EXECUTION phase.
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.ACTV may be incomplete. When this step was stopped there were 0 observations and 6 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 421.90k
OS Memory 19280.00k
Timestamp 09/18/2017 01:16:43 PM
Step Count 378 Switch Count 8
JOBprint INFO: Printed output redirected to
i:\APPL_DATA\OSYS065\RPTlib\zOAC0486\D2017-09-18_Mon_13-16-43\S0001.zOAC0486f.FT21F001.txt
NOTE: PROCEDURE PRINTTO used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 54.12k
OS Memory 19280.00k
Timestamp 09/18/2017 01:16:43 PM
Step Count 379 Switch Count 12
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.01 seconds
memory 221.37k
OS Memory 19280.00k
Timestamp 09/18/2017 01:16:43 PM
Step Count 380 Switch Count 0
53 The SAS System 13:16 Monday, September 18, 2017
2578 +PROC PRINT DATA=ACTV;
2579 +
2580 + /******************************************************************/
NOTE: No observations in data set WORK.ACTV.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 308.43k
OS Memory 19280.00k
Timestamp 09/18/2017 01:16:43 PM
Step Count 381 Switch Count 0
2581 + DATA WRITFL;
2582 + SET ACTV;
2583 +
2584 + FILE SPPSU ENCODING='EBCDIC1047';
2585 + PUT @ 1 'NWREC'
2586 + @ 7 TOKEN $11.
2587 + @ 23 PSTATCD $2.
2588 + @ 26 PSTATTP $4.
2589 + @ 31 PUSED PD3.1
2590 + @ 35 NEW PD3.1;
2591 +/******************************************************************/
2592 +
2593 +%JOBprint(UNIT=22);
NOTE: The file SPPSU is:
Filename=D:\APPL\OSYS065\For_FTP\NEW.PERM.GLAT281.INPUT.SPPSU.DAT,
RECFM=F,LRECL=80,File Size (bytes)=0,
Last Modified=18Sep2017:13:16:43,
Create Time=18Sep2017:12:48:58
FATAL: Wide character FILE/INFILE/FILENAME options have been specified. Wide character support is not currently enabled.
FATAL: Unrecoverable I/O error detected in the execution of the DATA step program. Aborted during the EXECUTION phase.
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.WRITFL may be incomplete. When this step was stopped there were 0 observations and 6 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
user cpu time 0.01 seconds
system cpu time 0.00 seconds
memory 554.37k
OS Memory 19280.00k
Timestamp 09/18/2017 01:16:43 PM
Step Count 382 Switch Count 8
JOBprint INFO: Printed output redirected to
i:\APPL_DATA\OSYS065\RPTlib\zOAC0486\D2017-09-18_Mon_13-16-43\S0001.zOAC0486f.FT22F001.txt
NOTE: PROCEDURE PRINTTO used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 52.59k
OS Memory 19280.00k
54 The SAS System 13:16 Monday, September 18, 2017
Timestamp 09/18/2017 01:16:43 PM
Step Count 383 Switch Count 12
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 221.31k
OS Memory 19280.00k
Timestamp 09/18/2017 01:16:43 PM
Step Count 384 Switch Count 0
2594 +PROC PRINT DATA=WRITFL;
NOTE: %INCLUDE (level 1) ending.
NOTE: No observations in data set WORK.WRITFL.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 199.03k
OS Memory 19280.00k
Timestamp 09/18/2017 01:16:43 PM
Step Count 385 Switch Count 0
JOBexec INFO: SASLOG assigned to i:\APPL_DATA\OSYS065\RPTlib\zOAC0486\D2017-09-18_Mon_13-16-43\SASLOG.log
I have pursued the comment concerning specifying EBCDIC input and output formats. What I see now are SPACES or FILL columns in each record. On windows an ASCII blank is a hex 20 vs EBCDIC blank is a hex 40.
Any ideas on how to ensure when a blank is written to the output file are all hex 40 without having to specify each column in the PUT stmt ?
What type of characters do you have in the file?
You could probably drop the ENCODING option on the INFILE/FILE and just read/write the strings using $EBCDIC informat/formats.
You probably will also need to convert the numeric formats to the appropriate formats to read/write in packed decimal formats.
INPUT
@ 1 SPPSC $EBCDIC5.
@ 7 TOKEN $EBCDIC11.
@ 23 PSTATCD $EBCDIC2.
@ 26 PSTATTP $EBCDIC4.
@ 31 PUSED S3270PD3.1
@ 35 NEW S3270PD3.1
;
nwrec_str='NWREC';
PUT
@ 1 nwrec_str $EBCDIC5.
@ 7 TOKEN $EBCDIC11.
@ 23 PSTATCD $EBCDIC2.
@ 26 PSTATTP $EBCDIC4.
@ 31 PUSED S3270PD3.1
@ 35 NEW S3270PD3.1
;
I have pursued the comment concerning specifying EBCDIC input and output formats. What I see now are SPACES or FILL columns in each record. On windows an ASCII blank is a hex 20 vs EBCDIC blank is a hex 40.
Any ideas on how to ensure when a blank is written to the output file are all hex 40 without having to specify each column in the PUT stmt ?
@rstoffregen wrote:
I have pursued the comment concerning specifying EBCDIC input and output formats. What I see now are SPACES or FILL columns in each record. On windows an ASCII blank is a hex 20 vs EBCDIC blank is a hex 40.
Any ideas on how to ensure when a blank is written to the output file are all hex 40 without having to specify each column in the PUT stmt ?
Just write the blanks first.
length blanks $80 ;
put @1 blanks $ebcidic80. @;
put @1 ..... ;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.