MainframeMaster

JCL Tutorial

JCL Inline Data

Progress0 of 0 lessons

What is Inline Data?

Inline data in JCL refers to the practice of including input data directly within the JCL source code, rather than referencing an external dataset. This approach eliminates the need for maintaining separate input files for simple processing tasks, making your JCL more self-contained and easier to maintain.

Inline data is particularly useful for testing, small processing tasks, or when you need to ensure that specific input data is always available with the JCL regardless of the environment in which it runs.

Basic Syntax for Inline Data

Using DD * (DD Asterisk)

The most common way to include inline data is using the DD * syntax:

jcl
1
2
3
4
5
6
7
8
//jobname JOB parameters //stepname EXEC PGM=program //SYSIN DD * data line 1 data line 2 data line 3 /* //

The data is included directly after the DD * statement and terminated by a /* delimiter.

Using DD DATA

An alternative approach is using DD DATA, which allows JCL symbols to be resolved within the data stream:

jcl
1
2
3
4
5
6
7
8
//jobname JOB parameters //stepname EXEC PGM=program //SYSIN DD DATA data line 1 with &SYMBOL data line 2 data line 3 /* //

With DD DATA, JCL symbols (like &SYMBOL) are resolved before the data is passed to the program. With DD *, symbols are passed unresolved.

Using the DLM Parameter

You can specify a custom delimiter using the DLM parameter:

jcl
1
2
3
4
5
6
7
8
//jobname JOB parameters //stepname EXEC PGM=program //SYSIN DD *,DLM=AA data line 1 data line 2 data line 3 AA //

Here, "AA" is used as the delimiter instead of the default "/*".

Record Format for Inline Data

Inline data is treated as a sequential dataset. You can specify record format parameters using the DCB parameter on the DD statement.

jcl
1
2
3
4
//SYSIN DD *,DCB=(RECFM=FB,LRECL=80,BLKSIZE=800) data line 1 data line 2 /*

This specifies fixed-length, blocked records with a logical record length of 80 bytes.

If DCB parameters are not specified, the following defaults are typically used:

  • RECFM=F (Fixed-length records)
  • LRECL=80 (80-byte logical records)
  • BLKSIZE=80 (Block size equal to LRECL)

Common Use Cases for Inline Data

1. SORT Programs

Using inline data to provide sort control statements:

jcl
1
2
3
4
5
6
7
8
9
10
//SORT JOB (ACCT),'SORT JOB',CLASS=A //STEP1 EXEC PGM=SORT //SYSOUT DD SYSOUT=* //SORTIN DD DSN=INPUT.DATA,DISP=SHR //SORTOUT DD DSN=OUTPUT.DATA,DISP=(NEW,CATLG,DELETE), // SPACE=(CYL,(5,2)),DCB=(RECFM=FB,LRECL=80,BLKSIZE=27920) //SYSIN DD * SORT FIELDS=(1,10,CH,A,11,5,PD,D) INCLUDE COND=(21,2,CH,EQ,C'NY') /*

2. Database Utilities

Using inline data for DB2 utility control statements:

jcl
1
2
3
4
5
6
7
//DB2UTIL JOB (ACCT),'DB2 UTILITY',CLASS=A //STEP1 EXEC PGM=DSNUTILB,PARM='DB2P,UNLOAD' //SYSOUT DD SYSOUT=* //SYSIN DD * UNLOAD TABLESPACE DB2P.TSNAME FROM TABLE SCHEMA.TABLENAME /*

3. Creating Small Test Files

Using IEBGENER to create a test file from inline data:

jcl
1
2
3
4
5
6
7
8
9
10
11
//TESTDATA JOB (ACCT),'CREATE TEST DATA',CLASS=A //STEP1 EXEC PGM=IEBGENER //SYSPRINT DD SYSOUT=* //SYSIN DD DUMMY //SYSUT1 DD * Record 1 - Customer Information Record 2 - Order #12345 Record 3 - Ship Date: 2023-05-15 /* //SYSUT2 DD DSN=TEST.DATA,DISP=(NEW,CATLG,DELETE), // SPACE=(TRK,(1,1)),DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)

4. IDCAMS Commands

Using inline data for IDCAMS control statements:

jcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//IDCAMS JOB (ACCT),'IDCAMS JOB',CLASS=A //STEP1 EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * DELETE MY.VSAM.FILE CLUSTER PURGE IF LASTCC <= 8 THEN DO DEFINE CLUSTER (NAME(MY.VSAM.FILE) - CYLINDERS(10 5) - KEYS(15 0) - RECORDSIZE(100 100) - INDEXED - SHAREOPTIONS(2 3)) END /*

Advanced Inline Data Techniques

1. Including Special Characters

To include special JCL characters in your inline data, you need to double them:

jcl
1
2
3
4
5
//STEP1 EXEC PGM=PROGRAM //SYSIN DD * This line contains a single quote '' within the data This line contains an ampersand && symbol /*

Single quotes are doubled (''), and ampersands are doubled (&&) to ensure they're treated as literal characters.

2. Multiple Inline Data Sets

You can include multiple inline data sections in a single job:

jcl
1
2
3
4
5
6
7
8
9
10
//STEP1 EXEC PGM=PROGRAM //INPUT1 DD * data for input 1 /* //INPUT2 DD * data for input 2 /* //INPUT3 DD * data for input 3 /*

3. Concatenating Inline Data with Other Data Sets

You can concatenate inline data with existing data sets:

jcl
1
2
3
4
5
//STEP1 EXEC PGM=PROGRAM //INPUT DD DSN=EXISTING.DATA.SET,DISP=SHR // DD * additional inline data /*

This concatenates the inline data after the contents of EXISTING.DATA.SET.

4. Using PARM with INCLUDE

For extremely large inline data, you can use a parameter with the INCLUDE statement:

jcl
1
2
3
4
//STEP1 EXEC PGM=PROGRAM //SYSIN DD *,INCLUDE=MEMBER /* //MEMBER DD DSN=MY.PDS(INDATA),DISP=SHR

This technique allows you to include data from a partitioned dataset member as if it were inline data.

Best Practices for Inline Data

  • Keep it concise: Use inline data for small to moderate amounts of data. For large data sets, use external files.
  • Comment appropriately: Include comments explaining the purpose and format of inline data.
  • Use consistent delimitation: If using a custom delimiter with DLM, choose a unique sequence that won't appear in your data.
  • Consider environmental factors: Be aware that inline data increases JCL source size, which affects JES spool space.
  • Validate DCB parameters: Ensure DCB parameters match your program's expectations, especially for record format and length.
  • Remember column limitations: JCL inline data is subject to 80-character line length limitations.

Inline Data Exercises

Exercise 1: Basic Inline Data

Write JCL that uses IEBGENER to copy inline data to a new dataset called YOUR.NAME.DATA. Include at least 5 lines of text data.

Exercise 2: Custom Delimiter

Create JCL that uses a custom delimiter (XX) for inline data. Include data that contains the /* characters to demonstrate why a custom delimiter might be necessary.

Exercise 3: IDCAMS with Inline Control Statements

Write JCL that uses IDCAMS with inline control statements to list the catalog entries for datasets that start with YOUR.NAME.

Frequently Asked Questions

Test Your Knowledge

1. Which DD statement parameter indicates the start of inline data?

  • DATA=*
  • INLINE=YES
  • SYSDATA
  • DD *

2. What indicates the end of inline data in JCL?

  • END
  • ENDDATA
  • /*
  • //

3. Which of the following is NOT a valid way to include inline data in JCL?

  • //DD1 DD *
  • //DD1 DD DATA
  • //DD1 DD INLINE
  • //DD1 DD SYSDATA

4. When using DD DATA instead of DD *, what is the main difference?

  • DD DATA allows for larger records
  • DD DATA is more efficient for processing
  • DD DATA supports binary data
  • DD DATA allows JCL symbols in the data stream

5. What is the advantage of using DLM parameter with inline data?

  • It reduces the amount of storage needed
  • It allows you to specify a different delimiter than /* to end the data
  • It increases processing speed
  • It prevents data corruption