Define: insert_resource: GL_LOCK / res_type: R / amount: 1
On each job: resources: (GL_LOCK, QUANTITY=1, FREE=A)
Only one job holds the unit; the other waits in RESWAIT.
FREE=Y (default) returns the unit on success only. After a failure it's held until released manually.
FREE=A always returns it. FREE=N never does automatically.
A job waiting in RESWAIT also blocks lower-priority jobs that ask for the same resource.
✦ Definition~90s read
What is AutoSys Resources?
A virtual resource is a named pool of units in AutoSys. A renewable resource (res_type: R) is borrowed: a job takes units when it starts and gives them back when it ends. With one unit and two jobs asking for it, only one can run; the other waits in RESWAIT. The job's FREE setting decides when units are returned.
★
It's the single key to a shared room.
Plain-English First
It's the single key to a shared room. Whoever has the key goes in; the other waits outside. FREE=Y means you only hand the key back if things went well. If you fail, you walk off with it.
Two jobs must never update the same ledger at once. A resource with one unit makes that rule part of the schedule. The trap is what happens to the unit when a job fails.
Define the Resource
A renewable resource with amount 1 acts as a lock.
resource.jilJIL
1
2
3
insert_resource: GL_LOCK
res_type: R
amount: 1
🎯 Key Takeaway
res_type: R, amount: 1.
Ask for It in Each Job
Each job requests one unit. The first takes it; the next waits in RESWAIT until it comes back.
FREE=Y returns units when the job succeeds (the default). FREE=A returns them whatever the outcome. FREE=N never returns them automatically. For a lock, use A.
free.txtTEXT
1
2
3
FREE=Y release on success only (default)
FREE=A always release
FREE=N never release automatically
⚠ Held units
With FREE=Y, a failed job keeps its units until they're released manually.
🎯 Key Takeaway
FREE=A for locks.
● Production incidentPOST-MORTEMseverity: high
The Failed Job That Kept the Lock
Symptom
autorep showed GL_POST_US in FA and GL_POST_EU in RW for hours.
Assumption
The team thought the resource was released when the first job ended.
Root cause
Both jobs used resources: (GL_LOCK, QUANTITY=1, FREE=Y). FREE=Y releases on success only; the failed job kept the unit.
Fix
Released the unit, then changed both jobs to FREE=A.
Key lesson
FREE=Y holds units after failure.
Use FREE=A for locks.
Alert on long RESWAIT.
Production debug guideWhy is it waiting?2 entries
Symptom · 01
Job in RESWAIT
→
Fix
Find which job holds the resource's units; check whether it failed with FREE=Y.
Symptom · 02
Several jobs waiting
→
Fix
A waiting job blocks lower-priority jobs asking for the same resource.
⚙ Quick Reference
3 commands from this guide
File
Command / Code
Purpose
resource.jil
insert_resource: GL_LOCK
Define the Resource
jobs.jil
update_job: GL_POST_US
Ask for It in Each Job
free.txt
FREE=Y release on success only (default)
FREE=Y, A, N
Key takeaways
1
Renewable resource, amount 1 = lock.
2
Waiting job shows RESWAIT.
3
FREE=Y holds after failure.
4
Use FREE=A.
Common mistakes to avoid
2 patterns
×
FREE=Y on a lock
Symptom
One failure blocks the other job all night.
Fix
FREE=A.
×
Depletable instead of renewable
Symptom
Units are used up permanently.
Fix
res_type: R for locks.
INTERVIEW PREP · PRACTICE MODE
Interview Questions on This Topic
Q01SENIOR
How do you stop two AutoSys jobs running at the same time?
Q02JUNIOR
What is RESWAIT?
Q01 of 02SENIOR
How do you stop two AutoSys jobs running at the same time?
ANSWER
A renewable resource with one unit, requested by both jobs.
Q02 of 02JUNIOR
What is RESWAIT?
ANSWER
The job is waiting for resource units to become available.
01
How do you stop two AutoSys jobs running at the same time?
SENIOR
02
What is RESWAIT?
JUNIOR
FAQ · 2 QUESTIONS
Frequently Asked Questions
01
How do I use a resource to run only one of two AutoSys jobs?
insert_resource with res_type: R and amount: 1, then resources: (NAME, QUANTITY=1, FREE=A) on both jobs.
Was this helpful?
02
Why is my AutoSys job stuck in RESWAIT?
Another job holds the units. If it failed with FREE=Y, it still holds them.