Dealing with weird data types

Generation data sets

When working with a mainframe system, you might’ve stumbled upon something called a generation data set.
It would have a notation of
//SYSUT1 DD DSN=MVS1.SMF.RECODS(0),DISP=SHR
Suppose you have the same job that will need to run every day. this job creates a sequential data set with the transactions for that day. It also needs to be stored for a minimum of 20 days. Usually you would not be able to run this job daily, because you’d be creating data sets that already exist.

The way around this problem is to define a data set that accepts different versions or generations under the name. This is possible with generation data sets.
For now all you need to know is that to reference a data set like that you can code the relative generation number of the file in parentheses after the name (see example above) In that case, coding 0 would reference the latest generation of the file. To reference the previous one you would specify -1, -2 and so on.

If you want to create a new generation of a data set, you'd specify 1 or +1 as the generation value

Temporary data sets

The data sets discussed before were all permanent, held until they are either deleted manually by the operator, or automatically ( for example when they reach their expiry date)

But sometimes you might need a temporary data set for when you want to sort or in some other way manipulate data, or have data copied from somewhere just for testing.

To create a temporary data set, you would use && followed by a name of your choosing (up to eight characters, the specifics might be dictated by your organisation)
For example
//SCDSIN DD DSN=&&XASCDS,DISP=OLD
Will create a temporary file XASCDS for exclusive access.

The name you give to the file will be a part of the actual full name for the temporary file.
This file will be deleted automatically after the job is completed.

Another way of creating a temporary data set is to not code a DSN parameter at all. In this situation the system will name the data set on its own. this is useful if you don't need to refer back to this file later on.

In stream data

The data that your program references does not actually need to be a part of a data set. You are allowed to simply supply it as in-stream data raw in the JCL.

To let the system know that what follows is raw data you should use the syntax like this
//NAME DD * with the raw data following on the next line.

The system will start looking for the raw data after the * and will keep interpreting stuff as the raw data until it finds a delimiter (/*) or a new JCL statement (//) (or when there is no other data afterwards)

When supplying data raw you do not need the // at the start of the line.

In case the data you want to send in raw contains the /* or // characters at the start of the lines, you can use the DLM parameter of the DD statement.
It allows you to specify what delimiter you want to replace the default ones.