Replacing information in a field in AS/400

15 pts.
Tags:
AS/400
AS/400 Fields
I am trying to find out how to replace information in a field for multiple records. Example; field A is a name field for a salesman. Some of the names are no longer valid and need to be changed. How can I "drop" in a replacement name just for those records? This is an AS/400 4.2 system. Or is there any literature out there that can help with this type of information? I'm not a serious programmer, just someone that was thrown to the wolves. :) Thanks in advance for the help.

Answer Wiki

Thanks. We'll let you know when a new response is added.

You need SQL. Are you sure you mean version 4.2? That is very old. If you have interactive SQL, you do the following (try this out on a test system or file beforehand!):

1. Get a command line.
2. Take backup of your file. For example:
CPYF YOURLIB/YOURFILE BACKUPLIB/YOURFILE CRTFILE(*YES)
Press <Enter>.
3.  Type STRSQL and press <Enter>.
If you don’t have interactive SQL you’ll need to stop here.
3. Otherwise, you need an SQL UPDATE, like so:
UPDATE  <tablename> SET fieldA = ‘New Salesperson’ WHERE fieldA = ‘Old Salesperson’
Then press <Enter>.
Be very careful with SQL. If you don’t put in the WHERE clause, you will update the whole table.

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • ToddN2000
    The easiest way is mentioned above. Take a back up and follow those steps as long as you have access to SQL. If not contact a programmer in your company that does.
    15,080 pointsBadges:
    report
  • Scott321
    That did it!  Thanks for the help!  It was a lot easier than I thought it would be!
    15 pointsBadges:
    report
  • PGMBOB
    A program can read a record Test for the value No good? Next record Good? Change the value / update the record. Loop back for next record.
    1,150 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following