DATA Step, Macro, Functions and more

Creating Mainframe GDG from SAS

Reply
Occasional Contributor
Posts: 5

Creating Mainframe GDG from SAS

 

Can we create new GDGs on Mainframe by exporting files?

New Contributor
Posts: 3

Re: Creating Mainframe GDG from SAS

Posted in reply to SASUSER21

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 

Occasional Contributor
Posts: 5

Re: Creating Mainframe GDG from SAS

Posted in reply to Marty_Rhodes

Can you please share a sample code for the same.

Thanks.

New Contributor
Posts: 3

Re: Creating Mainframe GDG from SAS

Posted in reply to SASUSER21

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?

 

 

 

 

Respected Advisor
Posts: 4,173

Re: Creating Mainframe GDG from SAS

[ Edited ]
Posted in reply to SASUSER21

 

From What's New in SAS(R) 9.4

http://support.sas.com/documentation/cdl/en/whatsnew/64788/HTML/default/viewer.htm#n14c8glgh3j7hxn1b...

 

The fourth maintenance release for SAS 9.4 has these new features:
  • The .spds9 file extension is supported.
  • FILE/INFILE statement processing supports the BUFNO= SAS system option.
  • SAS added support for the IBM z/OS V2R2 Extended Format Generation Data Group (GDG), which allows up to 999 generation data sets to be associated with the GDG.
For more information, see SAS Companion for z/OS 
 
And here the details in the SAS® 9.4 Companion for z/OS, Sixth Edition
 
 
Ask a Question
Discussion stats
  • 4 replies
  • 196 views
  • 0 likes
  • 3 in conversation