-2

I would like to know what the difference between these two lines of code :-

//STEP1.SYSIN DD * 

and

//STEP1.SYSIN and STEP1.SYSIN DD &SYSUID..COBOL(CBL0001),DISP=SHR

and if there are any differences.

cschneid
  • 10,237
  • 1
  • 28
  • 39
  • Please put the two lines of code in your question using a code block so that it will be easier to spot any differences. – Bryan Jun 19 '17 at 21:23

1 Answers1

2
//STEP1.SYSIN DD *

Will pass the data in the lines following the statement as instream-data to the SYSIN DD e.g.

//SYSIN DD *
fred
bert 
harry

Would result in the three lines being read when SYSIN is opened and read for input.

//STEP1.SYSIN DD DSN=&SYSUID..COBOL(CBL0001),DISP=SHR

Will allocate the PDS/PDSE member CBL0001 of the dataset user.COBOL (where user will be the userid (i.e. &SYSUID. resolves to the submitter's userid) of the user who submitted the job) to DD name SYSIN.

//STEP1.SYSIN

As used by both, is saying to override or add the SYSIN DD statement for the procedure step name STEP1 (the procedure itself would be defined in the preceding JCL).

The difference will be that the data read by SYSIN will be different (i.e. from a different source, it could be the same underlying data), the first will be the data that follows the JCL statement, the second will be the data held in member CBL001 (both would likely be a COBOL program).

With instream-data, the data will end if /* is coded or if a DD statement is coded or if nothing else follows(as shown above) e.g.

//STEP1.SYSIN DD *
fred
bert
harry
/*
...... more JCL here

or

//STEP1.SYSIN DD *
fred
bert
harry
//STEP1.OTHER DD .........

Instead of * DATA can be used e.g. (same result as above i.e. three lines)

//STEP1.SYSIN DD DATA
fred
bert
harry
/*

In both cases * or DATA you can specify the delimiter using DLM e.g.

//STEP1.SYSIN DD *,DLM="%%"
fred
bert
//harry
%%

( in which case the third line will be //harry)

cschneid
  • 10,237
  • 1
  • 28
  • 39
MikeT
  • 51,415
  • 16
  • 49
  • 68
  • Very close, but the //STEP1.SYSIN DD &SYSUID..COBOL(CBL0001),DISP=SHR is not allocating a file. the disposition is SHR meaning that it is trying to specify a file for use, and the program does not need exclusive use of the file. Other that good answer. – SaggingRufus Jun 20 '17 at 10:05
  • @SaggingRufus You are talking about allocating SPACE, there's a lite more. The whole process of associating a DATASET with a DDNAME to the stage where that DATASET can then be opened from within a program is frequently referred to as ALLOCATION. e.g. -Use the ALLOCATE command or the ALLOCATE subcommand of EDIT (the subcommand's function and syntax are identical to the ALLOCATE command) to allocate dynamically the... data sets required by a program that you intend to execute. - https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.1.0/com.ibm.zos.v2r1.ikjc500/dup0009.htm – MikeT Jun 20 '17 at 11:03
  • Perhaps a more unserstandable/definitive definition of allocation is _Allocation is the process by which the system assigns, or allocates, I/O resources to your job. An I/O resource is a **ddname-data set combination**, with any associated volumes and devices._ [An allocation overview](https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.1.0/com.ibm.zos.v2r1.ieaa800/allocov.htm) – MikeT Jun 20 '17 at 11:21
  • Just a bit of history trivia...way back when, physical cards were common, and in your JCL, you'd code //SYSIN DD UNIT=00E (or whatever device happened to be your card reader). Problem is, this meant your program started, opened SYSIN, then stopped until the operator loaded the cards in the reader, tying up resources all the while. So-called "spooled datasets" (SYSIN DD *) was the answer - this let all the cards get read when the job was submitted so that the SYSIN data was available on disk soon as the job started. – Valerie R Jul 06 '17 at 23:58
  • ...one other thing...the nature of spooled datasets is that they travel with the job. In an NJE (Networked Job Entry) environment, you might submit a job from one system for processing on another. The DD * datasets travel with the job, no matter where it runs. If a dataset reference were used (DD DSN=...), then that dataset would need to exist on the target system, and you'd get the contents of the dataset at the time the job runs, not at the time the job is submitted. Subtle differences, to be sure - but worth considering in large installations. – Valerie R Jul 07 '17 at 00:00