Login
Register
Search
Home
Forums
Jobs
LawsonGuru
LawsonGuru Letter
LawsonGuru Blog
Worthwhile Reading
Infor Lawson News Feed
Store
Store FAQs
About
Forums
Integration / Customization
S3 Customization/Development
How to force an abend in a batch program?
Home
Forums
Jobs
LawsonGuru
LawsonGuru Letter
LawsonGuru Blog
Worthwhile Reading
Infor Lawson News Feed
Store
Store FAQs
About
Who's On?
Membership:
Latest:
Starr
Past 24 Hours:
2
Prev. 24 Hours:
0
Overall:
5327
People Online:
Visitors:
372
Members:
0
Total:
372
Online Now:
New Topics
Lawson Add-Ins for Microsoft Office
Lawson Add-in
9/30/2025 6:51 PM
I am looking for a Lawson Add-ins query to add new
Lawson S3 Procurement
Anyone getting PO 0000 not found for company error in PO23?
9/30/2025 2:45 AM
Anyone getting PO 0000 not found for company error
Lawson Add-Ins for Microsoft Office
PO20 - Cancel PO via Add-in
9/25/2025 8:03 PM
Is it possible to cancel PO's using add-ins? I
S3 Systems Administration
S3 Payroll - PayStubs
9/18/2025 6:58 PM
Looking for a reliable solution to streamline the
S3 Systems Administration
Quick Access report
8/25/2025 7:17 PM
Looking for a good way to see who has access Lawso
S3 Customization/Development
LP01 hiding a PTO plan from the list
8/13/2025 4:44 PM
Hi all. is there a way to hide a specific PTO&n
Lawson Business Intelligence/Reporting/Crystal
GLTrans - PO Line/MAInvdtl
8/6/2025 6:13 PM
Hello, we have an existing tabular model for fina
IPA/ProcessFlow
Retrieving GUID from InforOS
7/25/2025 2:22 AM
Hello everyone, I was wondering if there is a way
IPA/ProcessFlow
IPA for forwarding cost messages (MA64/MA66.3)
7/23/2025 6:07 PM
When a buyer has an invoice cost message where the
Lawson Portal
Lawson ESS customization
6/23/2025 10:28 AM
I want to add new links and customize the ESS (sel
Top Forum Posters
Name
Points
Greg Moeller
4184
David Williams
3349
JonA
3293
Kat V
2984
Woozy
1973
Jimmy Chiu
1883
Kwane McNeal
1437
Ragu Raghavan
1377
Roger French
1315
mark.cook
1244
Forums
Filtered Topics
Unanswered
Unresolved
Announcements
Active Topics
Most Liked
Most Replies
Search Forums
Search
Advanced Search
Topics
Posts
Prev
Next
Forums
Integration / Customization
S3 Customization/Development
How to force an abend in a batch program?
Please
login
to post a reply.
11 Replies
0
Subscribed to this topic
17 Subscribed to this forum
Sort:
Oldest First
Most Recent First
Author
Messages
pbelsky
Veteran Member
Posts: 80
4/7/2011 2:46 PM
Can someone tell me where I can find out how to force an abend (needs recovery state) in a Lawson COBOL batch program? I have tried the error message APIs but they only print a message, do not force the pgm to abend. Lawson's precompiler will not allow me to populate RETURN-CODE or use STOP RUN. Thank you.
Al Miller
Basic Member
Posts: 10
4/7/2011 3:10 PM
Split
pbelsky,
I've never seen an abend API, but I've accomplished the same by purposely performing an 820-STORE-(filename) without performing the required 800-CREATE-(filename) first.
wilcoxmad
Veteran Member
Posts: 87
4/7/2011 4:49 PM
Split
COMPUTE WS-DUMMY = WS-DUMMY / 0.
this will blow up a program.
Roger French
Veteran Member
Posts: 549
4/7/2011 5:43 PM
Split
In my opinion, force abends is an ineffective and negative method for a COBOL program.
Really, you want a COBOL batch program to logically, by it's code, go into Needs Recovery? Doesn't make sense to me.
If you really want a 'stop' within the program, then try looking at GO TO's, meaning GO TO THE END of the program. Or use standard conditional loop logic. If done right the program will end cleanly and OK (not in needs recovery!).
Forced abends will only give you misery.
Sam Simpson
Veteran Member
Posts: 239
4/7/2011 7:20 PM
Split
What is the reason forcing the program into recovery mode? that is not standard programming methodology. Is the program looping or taking so long? Then cancel it from the scheduler. Are you trying to debug it? Try using display statements all over your program. I remember I once have a program that has many STOP RUNs but this program always write coded reasons and checksum informations into a log file which I can always look for reasons why the program stop.
Al Miller
Basic Member
Posts: 10
4/7/2011 7:39 PM
Split
I've coded AP Invoice interfaces for clients that were spec'ed for none of the transactions to be interfaced if any one record failed to "map" to a Lawson Vendor. The job was forced into recovery. Email alerts went out with an error report attachement. The users corrected "mapping" errors with a Lawson form, after which a request was sent to the Help Desk to recover the job. Everything worked seemlessly without any IT assistance.
pbelsky
Veteran Member
Posts: 80
4/7/2011 11:33 PM
Split
Thanks very much for the info, guys! I was hoping there might be an API or something a bit more graceful, but it sounds from your suggestions like I will just have to make the program take a dive.
FYI for those curious as to why a developer would want to force an abend... My pre-Lawson world was a large DB2 shop. We would commonly code rollbacks+abends to keep a bad file from puking all over the database. This also allows you to restart your program in a spot other than the begining, which is a big deal when your files are large and your batch window is tight. Also, when a program is part of a larger job stream, it is common to code an abend in response to an error that will cause a mess in the next program down the line.
Thank you again.
pbelsky
Veteran Member
Posts: 80
4/16/2011 6:40 PM
Split
Hi, just wanted to give you an update on this, in case anyone ever needs to force an abend. We are on Windows, 9.0.1.5 apps and 9.0.1.7 env, not sure if things work differently for others.
What I was trying to do was force an abend if a csv file was empty (to keep a subsequent transfer step from being run). I tried the good suggestions offered here, and believe it or not, they did not work. When I tried the 820-STORE method, Bismark would not let me compile. When I divided by zero, the program RAN CLEAN. I was stunned.
I was going to try to force the program to read an array out of bounds, but I was too lazy to set it up
I also learned that there doesn't seem to be anything that you can do to a csv that will cause your program to abend. I tried reading/closing it without opening it, reading past EOF, program did not care.
What I finally ended up doing was adding a sequential file to the program, and then issuing a READ for it without an OPEN.
Riverboat Sam
New Member
Posts: 3
5/5/2011 8:36 PM
Split
I have tried adding 1 to numeric variable that contains a space (S0C7), Dividing by zero (S0CB), and doing an Open of the same file twice. Job ran clean. What scares the jeepers out of me is the S0C7 continuing to run. No matter how well you vet your data, eventually you're going to get junk. And continuing to run with junk in calculations... hey, what if the result is a few million dollars off, eh? I cannot believe this is allowed to happen. It is totally unacceptable.
pbelsky
Veteran Member
Posts: 80
5/5/2011 9:13 PM
Split
I know, I was totally freaked out!!!
It's not just awesome... It's LAWSOME.
Tim Autry
Basic Member
Posts: 6
8/1/2011 1:00 PM
Split
If you are using MF-COBOL, this is a clean, forced abort called after you have displayed any/all error messages.
Program Working Storage - XXXWS
03 WS-RETURN-VALUE PIC 9(04) COMP-5 VALUE ZEROES.
Program Working Storage - XXXPD
MOVE 16 TO WS-RETURN-VALUE.
CALL "CBL_ABORT_RUN_UNIT" USING WS-RETURN-VALUE.
pbelsky
Veteran Member
Posts: 80
8/2/2011 3:29 PM
Split
WOW Tim! I came to Lawson from a mainframe shop, and you just opened up a whole new world of MF-COBOL for me
I was able to test your solution this morning, and it works perfectly on our system.
If anyone is interested, I found an alphabetical list of all the MF lib routines here:
http://supportline.microf...03/rhcall17.htm#s001
List by function is here:
http://supportline.microf.../nx50ws03/sytocc.htm
Please
login
to post a reply.