You are here:

AS400 Mid Range/'Wrong input' error on AS400 after duplicate key error

Advertisement


Question
I'm a beginning RPG programmer and have written a standard 'maintenance' style program that uses two files: an Item Master file and a display file for the user's workstation.  The user can press key F6 to go to screen 2 of the display file and ADD new records.  In testing, I have coded in the body of a subroutine to do a CHAIN using the two unique key fields of the Item Master File (line# and item) to check if a record with this key value already exists.  If the key already exists in Item Master, I use %STATUS function to trap and handle the error.  (EX. If %STATUS = 01021, display error msg).  But, when I go back to my screen to correct the key fields, I get a 'Wrong Input' error on the terminal session (I use Mocha terminal) and it locks the keyboard.  If I key over even a single letter of any other field besides a key field, the program will add the record properly.  But if I only change one or both of the two key fields, I get the wrong input/lockup.  I tried unlocking the record without success.  The file I'm trying to add the record to is spec'd as an externally described, full-operational, update file with "A"dd capability, keyed access (Line, Item) and type DISK.  In the display file, all of the display fields are declared as Input/Output (usage "B"), have the same name as the fields from ItemMast and are referenced to the Item Master file (REFFLD ItemMast).

Answer
It's difficult for me to tell for certain what your problem is because I don't recognize 'Wrong Input' as a typical AS400 message.  My guess is that, after trapping the error, you need to EXFMT the display format again before trying to make an entry.  Otherwise, it's possible that you're seeing a Mocha terminal message, not an AS/400 message.

- Laird

AS400 Mid Range

All Answers


Answers by Expert:


Ask Experts

Volunteer


Concise Systems/Laird Scranton

Expertise

General AS/400, RPG/400, SDA and CL programming questions. AS/400 performance tuning.

Experience


Past/Present clients
CB Sportswear
Coca-Cola of New York
Encore Paper Company
Golub Corporation
HBO Home Video
Imperial Pools
Kaiser Permanente of NE New York
Mallinckrodt Medical
Marigold Foods
Manpower & Associates
National Datacomputers
New York State Easter Seals Society
New York State Food Merchants Association
Pepsi-Cola Allied Bottlers
Petricca Construction
Taconic Telephone Corporation
TOMRA Recycling
Unistress Corporation

©2012 About.com, a part of The New York Times Company. All rights reserved.