Can we create new GDGs on Mainframe by exporting files?
You certainly can with SAS in batch. With interactive SAS it depends on whether your site allows tape mounts for interactive users. With modern VTS systems there probably isn't a good reason not to allow that but many mainframe sites restrict interactive tape mounts to IT support personnel. Back in the day when tape mounts involved physically mounting actual tapes, such restrictions were probably warranted for sites with lots of "less than IT-savy" users.
Marty Rhodes
Can you please share a sample code for the same.
Thanks.
Since you said a new GDG, then I am assuming the GDG has not been defined yet. You can do this with a small batch job that does a step like this:
//GDGDEF EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
DEFINE GDG (NAME(MYGDG.DATA) -
LIMIT(20) NOEMPTY SCRATCH)
/*
Once your GDG has been defined to Z/OS, you can then use it with SAS. I will assume you are running SAS in batch but there are equivalent ways to do it with interactive SAS. Just add a DD to your SAS step that looks like this:
//GDGOUT DD UNIT=DISK,SPACE=(TRK,(howevermanytracks,howevermanymoretracks),RLSE),
// DISP=(,CATLG,DELETE),DSN=MYGDG.DATA(+1)
The "+1" adds a new generation to the GDG as generation 0. You may need to specify the DCB for your GDGOUT file depending on how you plan to write to it in SAS.
Now just refer to the fileref GDGOUT in you SAS code that outputs whatever you want to write to the GDG. For example to write to it in a DATA step you could use the SAS statement:
file gdgout old;
put "This will be writen to the GDG file 'MYGDG.DATA(0)' on Z/OS";
All of this assumes you have permission to do these things at your mainframe site. Does that help?
From What's New in SAS(R) 9.4
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.