Question How to know whether input file (coming from by running another mainframe job) is empty or not in cobol.Here mainframe runs job and that output is a file. That file is input for this cobol. and again this file is usedin another main frame job.if its not empty i want run that mainframe job otherwise i want to stop that job there itself. so plz help me in this .
Answer Since you say 'mainframe' I assume you mean IBM MVS. There is no way to test a file for being 'empty' in JCL. However, you can achieve the same end by having the creating program test the output record count. If not zero (there is data) then end with RC=0, otherwise 'Move 4 to return-code, stop run.' You can then check the return code in the JCL for either 0 meaning use the file or 4 and bypass the step(s) you don't want.
I specialize in IBM z/OS COBOL and MicroFocus OCDS and Server Express
non-OOP. Design, coding and performance oriented questions. Also linking to
IBM Assembler from COBOL. Because the rules change with version, please
state language level, version and platform environment. See CICS for questions about CICS.
Experience
Over 35 years working with COBOL on multiple platforms and OS.
Education/Credentials Graduate, New York School of Computer Technology.
Past/Present Clients Major Financial Institutions, State of NC (DHHS), Manufacturing, Financial services, Warehousing, Software developer and others.