View previous topic :: View next topic |
Author |
Message |
radkrish82 Beginner
Joined: 19 Feb 2009 Posts: 50 Topics: 10
|
Posted: Wed Mar 09, 2011 1:29 am Post subject: Not exist file |
|
|
If a dataset(flat file) is not present or not created, using a cobol program, through file status code handling, we can write a message "Input file not created" to the output file. If it is present, we can execute necessary process.
Rqmt is to write the output dataset with "file not present" if input file not present.
Is it possible to do the similar logic in DFSORT/JCL just to avoid the program element. I understand we can do a check for file exist or not in IDCAMS. My shop production team trying to ignore/eleminate JCL's with IF ELSE ENDIF logics. |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Wed Mar 09, 2011 12:03 pm Post subject: |
|
|
radkrish82,
Use the following IDCAMS job which will give you the desired results. The OUT dataset will have the message depending on the return code.
Code: |
//STEP0100 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//IN DD *
FILE HAS AT LEAST 1 RECORD
EMPTY FILE
ERROR CONDITION RC = 8
FILE NOT PRESENT
//OUT DD SYSOUT=*
//SYSIN DD *
PRINT IDS('your file in question') CHARACTER COUNT(1)
IF LASTCC = 0 THEN DO
REPRO IFILE(IN) OFILE(OUT) COUNT(1)
END
ELSE IF LASTCC = 4 THEN DO
REPRO IFILE(IN) OFILE(OUT) COUNT(1) SKIP(1)
END
ELSE IF LASTCC = 8 THEN DO
REPRO IFILE(IN) OFILE(OUT) COUNT(1) SKIP(2)
END
ELSE IF LASTCC = 12 THEN DO
REPRO IFILE(IN) OFILE(OUT) COUNT(1) SKIP(3)
END
//* |
_________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
radkrish82 Beginner
Joined: 19 Feb 2009 Posts: 50 Topics: 10
|
Posted: Thu Mar 10, 2011 7:15 am Post subject: |
|
|
Thanks, Kolusu. It worked well.
In case of symbolic representation of the file name, how do we represent with in the same step. It requires manipulation in a seperate step. correct? Is it possible to substitute the symbolics with in the same step?
Code: | eg., set symb=test
File name : AAA.BBB.CCC.&symb |
|
|
Back to top |
|
 |
superk Advanced

Joined: 19 Dec 2002 Posts: 684 Topics: 5
|
Posted: Thu Mar 10, 2011 9:36 am Post subject: |
|
|
Take a few minutes to think about what you're asking and assess the situation. If you use a JCL symbolic for a portion of the dataset name, then you have to use that somewhere in the JCL. But where? If you code a DD statement for it, the JCL will fail because of the "dataset not found" problem. So, the only place you can use it without causing a failure is in a PARM=... statement. The issue here is that you'll have to supply the program to be used in that step, and define the process for it to follow to meet your requirements. |
|
Back to top |
|
 |
|
|