SYSIN and In-stream Data

Purpose

SYSIN and in-stream data allow you to include input data directly within your JCL job stream. This is particularly useful for providing control statements, commands, or small amounts of data to programs without requiring separate external data sets.

Syntax

Basic Format (DD * Form)

jcl
1
2
3
4
5
6
//ddname DD * data line 1 data line 2 ... data line n /*

Alternate Format (DD DATA Form)

jcl
1
2
3
4
5
6
//ddname DD DATA data line 1 data line 2 ... data line n /*

With Delimiter Option

jcl
1
2
3
4
5
6
//ddname DD *,DLM=XX data line 1 data line 2 ... data line n XX

DD * vs. DD DATA

FeatureDD *DD DATA
JCL StatementsTreats //-prefixed lines as JCL statements (not data)Treats all lines as data (including //-prefixed lines)
UsageMost common form - use when data doesn't contain JCL-like statementsUse when data might contain lines that start with //
Example Use CaseGeneral program input dataScript data or control statements that might contain JCL-like syntax

Key Concepts

The SYSIN DD Name

While any DD name can be used for in-stream data, many IBM utilities and programs expect their primary input on a DD statement named SYSIN. This is a convention, not a requirement. Always check the program documentation for the expected DD name.

DLM (Delimiter) Parameter

  • Allows you to specify a custom delimiter to mark the end of in-stream data
  • Useful when the data itself contains /* characters
  • The delimiter must be two characters
  • Example: DD *,DLM=XX uses XX as the delimiter instead of /*
  • The delimiter must appear on a line by itself starting in column 1

Data Format Considerations

  • In-stream data is treated as 80-byte card images (historical card punch format)
  • Only columns 1-71 are typically used for data; column 72 is sometimes used for continuation
  • Data beyond column 71 might be truncated or ignored by some programs
  • The default DCB attributes are typically RECFM=F, LRECL=80

DCB Override

You can override the default DCB attributes for in-stream data if needed:

jcl
1
2
3
//INDATA DD *,DCB=(RECFM=FB,LRECL=80,BLKSIZE=800) data records /*

Common Use Cases

Utility Control Statements

jcl
1
2
3
4
5
6
7
8
9
//STEP1 EXEC PGM=IDCAMS //SYSIN DD * DELETE USER.FILE1 SET MAXCC=0 DEFINE CLUSTER (NAME(USER.FILE2) - VOLUMES(DISK01) - RECORDSIZE(80 80) - TRACKS(10 5)) /*

Providing IDCAMS utility commands via in-stream data

Input Data for a Program

jcl
1
2
3
4
5
6
//STEP1 EXEC PGM=MYPROG //SYSIN DD * 1001,JOHN,SMITH,ACCOUNTING,50000 1002,JANE,DOE,MARKETING,55000 1003,ROBERT,JONES,SALES,52000 /*

Providing simple data records to a program

DFSORT Control Statements

jcl
1
2
3
4
5
6
7
8
9
//STEP1 EXEC PGM=SORT //SORTIN DD DSN=INPUT.FILE,DISP=SHR //SORTOUT DD DSN=OUTPUT.FILE,DISP=(NEW,CATLG,DELETE), // SPACE=(CYL,(5,2)),UNIT=SYSDA //SYSIN DD * SORT FIELDS=(1,5,CH,A,20,10,CH,D) INCLUDE COND=(30,2,CH,EQ,C'NY') OUTFIL OUTREC=(1,20,30,15) /*

Providing sort control statements to DFSORT

SQL Statements for DB2

jcl
1
2
3
4
5
6
7
8
9
10
11
12
13
//STEP1 EXEC PGM=IKJEFT01 //SYSTSIN DD * DSN SYSTEM(DB2P) RUN PROGRAM(DSNTEP2) PLAN(DSNTEP12) - LIB('DSN1210.RUNLIB.LOAD') END /* //SYSIN DD * SELECT EMPNO, FIRSTNAME, LASTNAME, JOB_TITLE FROM EMPLOYEE WHERE DEPT = 'MARKETING' ORDER BY LASTNAME; /*

Running SQL statements through the DB2 batch interface

Using Custom Delimiters

jcl
1
2
3
4
5
6
7
8
9
//STEP1 EXEC PGM=ADRDSSU //SYSPRINT DD SYSOUT=* //SYSIN DD *,DLM=## DUMP DATASET(INCLUDE(USER.DATA./*)) - OUTDDNAME(TAPE) - COMPRESS ## //TAPE DD DSN=BACKUP.DATA,DISP=(NEW,CATLG,DELETE), // UNIT=TAPE

Using a custom delimiter (##) because the data contains /* characters

Multiple In-stream Data Sets

jcl
1
2
3
4
5
6
7
//STEP1 EXEC PGM=MYPROG //SYSIN DD * First set of data /* // DD * Second set of data /*

Concatenating multiple in-stream data sets - the program will see all data as a single stream

DD DATA Example

jcl
1
2
3
4
5
6
//STEP1 EXEC PGM=MYPROG //SYSIN DD DATA This data contains lines that look like JCL: //DUMMY JOB This would be treated as JCL with DD * But with DD DATA, it's treated as regular data /*

Best Practices

  1. Use in-stream data only for reasonable amounts of data - large volumes should be in separate data sets
  2. Consider using DD DATA when your data might contain lines beginning with //
  3. Use custom delimiters when your data contains /* sequences
  4. Keep column limitations in mind - avoid data beyond column 71
  5. Document any special requirements for data formatting in comments
  6. For frequently used data, consider storing in a permanent data set rather than inline

Related Concepts