want to check a file is empty or not in a JCL
Moderators: Frank Yaeger, DikDude, Moderator Group
want to check a file is empty or not in a JCL
Hi all ,
I want to check a file is empty or not in a JCL in first step
and in secod step:
If its not emty
I will take some action
else
I will take some other action.
can u pls tel me the how to do this in Jcl. Thanks.
Regards,
Venky.
I want to check a file is empty or not in a JCL in first step
and in secod step:
If its not emty
I will take some action
else
I will take some other action.
can u pls tel me the how to do this in Jcl. Thanks.
Regards,
Venky.
In our shop we use SYNCSORT with a NULLOUT parameter, i.e.:
Code: Select all
//STEP EXEC PGM=SORT,PARM='NULLOUT=RC4'
//SORTIN DD DSN=DSN to check
//SORTOUT DD SYSOUT=*
...
-
- Moderator
- Posts: 1625
- Joined: Sat Aug 09, 2008 9:02 am
- Location: Mumbai, India
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
So if any of those four (static?) values appear in your data at the 4th position, you want to have a non-zero return code?
Which Sort product do you have? Can you show the full sysout from a Sort step?
You've seen that an RC can be set when an output file contains no data. So they key is to not write data to a (dummy) output file if one of those keys (at least) exists. Do you have a "trailer" on your file?
Which Sort product do you have? Can you show the full sysout from a Sort step?
You've seen that an RC can be set when an output file contains no data. So they key is to not write data to a (dummy) output file if one of those keys (at least) exists. Do you have a "trailer" on your file?
William,
Yes, If it contains data in 4th position which are not static then I need to get non-zero return code, but the data will be always from 0 to 9 in 4th position with length 1( the data will be 0 or 1 or 2 or 3 or 4 or 5 and so on upto 9 in 4th position).
I am using the Sort utility. Please see the below JCL.
JCL for empty input file: I am getting return code is maxcc=4
//Job card
//Step01 exec pgm=sort,parm='nullout=RC4'
//sysprint dd sysout=*
//sysout dd sysout=*
//Sortin dd dsn='input file',disp=shr
//sortout dd sysout=*
//sysin dd dummy
JCL for input file having records: for the below JCL I need to get non-zero return code?
//Job card
//Step01 exec pgm=sort
//sysprint dd sysout=*
//sysout dd sysout=*
//Sortin dd dsn='input file',disp=shr
//sortout dd sysout=*
//sysin dd dummy
I am not having "trailer" in the file. I have number of records in the file which look like below and in 4th position it can 0 or 1 or 2 upto 9 which are static.
012345678
112345678
212345678
312345678
412345678
512345678
612345678
712345678
812345678
912345678
Regards,
Venky.
Yes, If it contains data in 4th position which are not static then I need to get non-zero return code, but the data will be always from 0 to 9 in 4th position with length 1( the data will be 0 or 1 or 2 or 3 or 4 or 5 and so on upto 9 in 4th position).
I am using the Sort utility. Please see the below JCL.
JCL for empty input file: I am getting return code is maxcc=4
//Job card
//Step01 exec pgm=sort,parm='nullout=RC4'
//sysprint dd sysout=*
//sysout dd sysout=*
//Sortin dd dsn='input file',disp=shr
//sortout dd sysout=*
//sysin dd dummy
JCL for input file having records: for the below JCL I need to get non-zero return code?
//Job card
//Step01 exec pgm=sort
//sysprint dd sysout=*
//sysout dd sysout=*
//Sortin dd dsn='input file',disp=shr
//sortout dd sysout=*
//sysin dd dummy
I am not having "trailer" in the file. I have number of records in the file which look like below and in 4th position it can 0 or 1 or 2 upto 9 which are static.
012345678
112345678
212345678
312345678
412345678
512345678
612345678
712345678
812345678
912345678
Regards,
Venky.
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page