Instream Data
Part of the Batch Jobs with JCL section of Coddy's COBOL Programming journey. Lesson 4 of 19.
In IBM's COBOL, ACCEPT reads the next line of the DD named SYSIN. A job can carry that data itself, as instream data:
//ADD EXEC PGM=ADDUP
//SYSIN DD *
00125
00300
/*DD * says the data follows. A data line holds anything except // or /* in columns 1 and 2, and /* ends the data. Each ACCEPT reads the next line.
Any DD can be instream. A program that reads a file ASSIGN TO TXNIN gets each data line as one record:
//TXNIN DD *
RENT 01200
FOOD 00350
/*The /* may be left out when a JCL statement follows: the next // line ends the data too.
Challenge
EasyADDUP accepts two amounts and prints their total. Give its step a SYSIN DD with the instream lines 00125 and 00300, so it prints TOTAL 425.
Try it yourself
//ADDJOB JOB (ACCT),'CODDY',CLASS=A,MSGCLASS=X
//ADD EXEC PGM=ADDUP
//* Add the SYSIN DD and its data here
//SYSOUT DD SYSOUT=*
This lesson includes a short quiz. Start the lesson to answer it and track your progress.