MainframeSupports
tip week 12/2003:

I hope a lot of you will call this tip an obsolete one, because this is something everybody should know. As I have mentioned earlier this is not always the case and then I write the tip anyway. Concatenation on DD-names allocated as //DDNAME DD * has to my best knowledge always been possible, but I have only seen it used on rare occations.

Let me start with an example cut from a TSO batch job:

//SYSTSIN DD *
  DSN SYSTEM(DB2)
/*
// DD DISP=SHR,DSN=MY.DB2.PROGRAM
// DD *
  END
/*

If dataset MY.DB2.PROGRAM is FB 80 and contains only one record with the contens "  RUN PROGRAM(MYPROG)" then the final result of records read from SYSTSIN will be the same as if your batch job looked like this:

//SYSTSIN DD *
  DSN SYSTEM(DB2)
  RUN PROGRAM(MYPROG)
  END
/*

In this way you can use the same job to execute different programs on the same DB2 subsystem. The possibilities in this mixture of DD * and real datasets are quite amazing. Only your imagination sets the limits. There is a rule to obey, though. The record length of the first dataset in the concatenation will be used as record length of all subsequent datasets. DD * datasets always has FB 80. I have had some funny experiences where I forgot about this rule. Either I lost some data at the end because some of my concatenated datasets had a larger record length or I ended up with data that weren't supposed to be there because my concatenated datasets had a smaller record length. In the latter case you must imagine starting off with LRECL=80 filled with numerics. Then you read other numerics from a dataset with LRECL=40. The result is that the last 40 bytes contains what was read from the last record with LRECL=80 and that is certainly not what you want.

Previous tip in english        Sidste danske tip        Tip list