r/mainframe • • May 14 '25

Doubts

Dear ones, good morning

I started working with JCL and I'm trying to learn I still have doubts about some basic things and would like other opinions besides chatgpt and my co-workers My question is, let's say a job fails due to lack of file, are there times when I can resume from the next step or create an empty file How do I know this? When to create a void or continue the job?

0 Upvotes

8 comments sorted by

7

u/Dyvanna May 14 '25

Unfortunately the answer is 'it depends '.

If the file is not used in future steps then yes you can continue with the next step. In practice I personally would not do this unless I had a deep understanding of the job. For example if all the other files are altered as part of the job meaning you can't subsequently go back and create the file.

Some jobs will be happy with and empty file, others might expect at minimum a header and trailer, so it depends.

4

u/Ok_Awareness2161 May 14 '25

Great answer, thank you very much I'm still in my first month of working on this and I feel like I have a negative IQ sometimes, but I'm going to stay focused Thanks for the answer

11

u/HonestPineapple4848 May 14 '25

Generally this is something for application team to decide. To make a proper decision you need to understand what's the purpose of that file, why it doesn't exist, what creates it, does the job have successors and do they use this file? You could make a mess by rerunning the job from the next step.

3

u/yankinwaoz May 14 '25

This is the correct answer.

The DD was put in the JCL because the program may need to access some data on a file, or write some data to a file. The fact that file is missing is a symptom of a problem. It isn't the problem. And it isn't the JCL's writer's job to "deal with it".

Now that being said, since you are new at this, your issue may be a simple a retention specification missmatch. Check your JCL and see if that file is created earlier in the job. Then look at the DISP value. Is it KEEP? PASS? DELETE?

It may be that you created the file, but failed to keep it around long enough for the step that needs it to use. For example, Step 3 creates the file. Step 5 reads it and deletes it, then step 7 also wants to read it. But step 5 already deleted it.

5

u/MaexW May 14 '25

Think the other way around: why start the job whem am essential file is missing ? If it's not there, you *can't* finish your work. So the first step in this case might be to check for the existance of the file.

Even better if you have a workload scheduler in your shop. In this case you could build a dependency from your fiel-reading job to the file-creating job. By this, your job would not be run if the other job didn't created the file and second, your job would be started instantely when the other job created the file. No checking, waiting, checking again. Your job might even be running earlier.

2

u/yankinwaoz May 14 '25

Many shops have tools that will scan the JCL for dataset names and verify the datasets exists before allowing the scheduler to submit the job for production.

JCL is designed to allow dataset names to be built dynamically, at run time. This way the same JCL can be used for different stages of testing. Develepment > QA > Pre-Production > Production. And even within a production environment, the same JCL can be used for different workloads by altering the variables that generate the dataset names.

Hence, a scanning tool is helpful in computing the actual dataset names that will be used in the runtime environment that the JCL will be executed. Then that will look for the files that are needed before the job runs.

Because scheduling tools like CA-7 can use dataset generation as triggers to start job, they need to know what files a job needs to consume. So they are monitoring the datasets that are being generated by the jobs. And they are also making sure that all of the other dependencies are satisfied before the job is started.

1

u/[deleted] May 15 '25

RESTART=stepname on the job card to start at a specific step. Normally fix the issue with the failed step and restart there. Just keep temp datasets in mind since they are probably gone if needed from a PASS.