There are two steps in a JCl, the first one generates a
report while the second step send an email saying the
report has been generated, but the second steps should only
be executed when the report file is non-empty. How can it
be acheived. We may include steps in between.

Answers were Sorted based on User's Feedback



There are two steps in a JCl, the first one generates a report while the second step send an email..

Answer / abhijit18in2002

Insert a IDCAMS step between the two step here is the Eg


//STEP01 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSUT1 DD DSN=MY.SORT.FILE1,DISP=SHR
//SYSUT2 DD DSN=MY.SORT.FILE2,DISP=SHR
//SYSIN DD DUMMY
//*

//* Checking the File for any data
//*

//CHEKEMTY EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//MYFILE DD DSN=MY.SORT.FILE2,DISP=SHR
//SYSIN DD *
PRINT INFILE(MYFILE) CHARACTER COUNT(1)
//*

//* If above step gives RC=04 it means file1 is empty
//* so STEP02 would only execute if step CHEKEMTY has
//* RC Not equal to 04.

//STEP02 EXEC PGM=SASSTRLR,
// PARM='INACT',COND=(04,EQ,CHEKEMTY)
//SYSOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSIN DD *
DEMAND ABCXYZ
//*

Is This Answer Correct ?    25 Yes 0 No

There are two steps in a JCl, the first one generates a report while the second step send an email..

Answer / squid

Just my thought -
You can set a code in your cobol program that writes the
report file to set a certain "return code" in the RETURN-
CODE field before exiting the program.
Depending on that return code from the program, you can
code IF END IF in your JCL.
Please let me know if that is wrong.

Is This Answer Correct ?    6 Yes 2 No

There are two steps in a JCl, the first one generates a report while the second step send an email..

Answer / madhan

Use IEBPTPCH utility to verify the records in the input
file. if you get other than zero return code (2 or 4), then
there is no records in the input file(input file is empty).
based on the return code from the step1, step2 will execute
otherwise skip step2.

Is This Answer Correct ?    1 Yes 3 No

Post New Answer

More JCL Interview Questions

Suppose I have a file with three fields with data in the following format 1. empid - S9(4) COMP 2. empname - X(20) 3. empsal - S9(5)V(2) COMP-3 If I view this file, it will not be in a readable format. How to display the empid and empsal fields in a readable format without using COBOL program? What kind of SORT card will have to be coded?

4 Answers  


How to override a dsn that is contained in a proc called by another proc? I need to do the override in the calling jcl?

0 Answers  


How to use COND Parameter in jcl

4 Answers   NIIT, Wipro,


In sms datasets, what is the function of the dd avgrec keyword?

0 Answers  


How to read records in reverse order in flat file?

1 Answers  






wht do u mean by internal reader in jcl ? wht is the use of internal reader ?

1 Answers   Syntel,


How to copy one PS file to multiple PS files with same data?

1 Answers  


what is the default region size if I dont specify region parametre in my job card ( I know that if I specify region=0k or 0M, then the job will occupy all he available resources at the time of job execution), but I want to know the defult value for "region" paramatre.

5 Answers   BirlaSoft, Infosys,


Explain dd statement in jcl?

0 Answers  


My JCL has 4 steps that execute PROC’s P1, P2, P3 and P4 as shown below //P1 EXEC PROC=P1 //P2 EXEC PROC=P2 //P3 EXEC PROC=P3 //P4 EXEC PROC=P4 There are four steps S1, S2, S3 and S4 in each PROC’s (i.e. P1, P2, P3 and P4) I want to execute only step S2 of PROC P2 and no other steps or PROC’s. How do you achieve this?

4 Answers   IMS,


can any one plzzzzzz tell the jcl code for creating ps using idcams

2 Answers   Fiserv,


What is the function of a dd statement?

0 Answers  


Categories