I'm trying to create a csv file from query results and it's too big for disk. Is it possible to write to mainframe tape? If so, how?
This is my pathetic attempt from all information I can find so far:
ODS LISTING CLOSE;
FILENAME MYFILE "SYS2.NFCPLEX.TAPE" VOL=504977 UNIT=TAPE LABEL=(1,SL);
ODS CSV BODY=MYFILE RS=NONE;
PROC SQL;
SELECT ACCOUNT,
DSNAME,
CRETM,
DDSCSIZE,
DDSUSIZE,
DSEXPDT,
DSVOLSER
FROM PDB.CTLTDSN
WHERE DACTIVE='A' OR TODAY()<INTNX('DAYS',DSEXPDT,120);
QUIT;
ODS CSV CLOSE;
Don't use ods csv, use a data step, or at least proc export with dbms=csv.
If you have trouble with the code, please post the log. Use the </> button for posting logs.
Proc export is not available on z/OS. So data step, ODS logic, either way I am still dealing with writing to tape.
1 ODS LISTING CLOSE; 2 FILENAME MYFILE "SYS2.NFCPLEX.TAPE" VOL=504977 UNIT=TAPE LABEL=(1,SL) ______ ______ ______ 24 24 24 ERROR: ERROR IN THE FILENAME STATEMENT. ERROR: ERROR IN THE FILENAME STATEMENT. ERROR: ERROR IN THE FILENAME STATEMENT. ERROR 24-2: INVALID VALUE FOR THE VOL OPTION. ERROR 24-2: INVALID VALUE FOR THE VOL OPTION. ERROR 24-2: INVALID VALUE FOR THE VOL OPTION. 3 ODS CSV BODY=MYFILE RS=NONE; NOTE: WRITING CSV BODY FILE: MYFILE ERROR: NO LOGICAL ASSIGN FOR FILENAME MYFILE. ERROR: NO LOGICAL ASSIGN FOR FILENAME MYFILE. ERROR: NO LOGICAL ASSIGN FOR FILENAME MYFILE. WARNING: NO BODY FILE. CSV OUTPUT WILL NOT BE CREATED.
It has been a long time since I worked with tape.
A couple of suggestions:
1) subset the data before generating the output
2) You might try Proc Export to the tape instead.
3) Has anyone actually mounted a tape to the tape drive for writing? That was always a hold up, someone actually had to mount tapes for reading/writing. So jobs often got queued until the operator had time to mount them.
I would suggest talking to your admins about why you don't have enough disk space. When you need the data later you will have to make sure the proper tape is available and reading it may take a long time (relatively).
It has been a long time. Physical tape does not exist anymore. We are all virtual now, which makes it harder tricking z/OS.
1. I'm not sure what subsetting data is. I'm not a very strong SAS programmer. I'll try and look it up.
2. PROC EXPORT does not exist on the mainframe. Unless I'm missing something.
3. There is no physical tape so no wait time, except for maybe a unit.
It complains about the volume designator, so you should check with your z/OS admins about that.
I strongly advise to use a data step instead of ods csv; I have participated in a thread here on the communities where ods csv with a proc print was outperformed by a data step by several orders of magnitude.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.