ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

How to update a value to a PF

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to update a value to a PF

    I have a rpg that calls another rpg.
    The first rpg is used to save data based on completely new entries in Item Master table(Item codes are unique)
    The second rpg is called to save additional data onto the data for which the item code are already existing in Item Master.
    SO in both the Item MAster and the secondary table only the Item codes are common
    BUT both the table also have a column called Quantity which have been differently named but serve the same purpose

    The issue now is that in my second rpg(that is after checking that a Item code exists i add a different value to the quantity field)

    Suppose
    Item Master table :

    ItemCode | Item | Quantity

    AA100 | Blueberry | 50
    AA200 | Cherry | 20

    Goods received table:

    ItemCode | Qty

    AA100 | 100

    Now as can be seen item code value is common but the fields quantity have different names.
    Now when i enter value of Goods received table as 100,this value must get added to the previous quantity value of master table.
    I have been able to code the addition part.It is infact also getting saved in that Quantity variable of MAster table.But when i perform Runquery on it,that doesnt show the updated value.

    In my second rpg,U spec has been given to Master file.Also when i do update a runtime error is seen of trying to enter duplicate value as that is being done by updating the master table record format
    eg: UPDATE ITMREC


    So how can i update the table only to reflect that one value and not the entire record row.Please help.

  • #2
    Re: How to update a value to a PF

    Way too much for me to read .. I'm very busy..

    but I think you are asking for this
    Code:
    //only update certain fields available v5r2             
    UPDATE EmpRec %FIELDS(Salary:Status);
    But... it seems you have other issue.. Like you are changing the name of one record to the name of second in error.
    so my guess is that when you use the code above you will be changing the quantity of the wrong item.
    I'm here to chew bubble gum and kick @#%@#%@#%.....and I'm all outta bubble gum !
    Yes I'm talking to you squirrel nuts.

    Comment


    • #3
      Re: How to update a value to a PF

      This version of rpg is rpg 3 so i guess my keyword usage differs like
      Code:
      UPDATITMREC
      Theres no issue of names clashing,only problem that seems to appear is that of not having the specific field getting updated.

      Comment


      • #4
        Re: How to update a value to a PF

        you have to create ospec with record format with only the one field in it and use EXCPT to update only one field in that
        old crap your coding in...


        Can't you just convert it, That is really old code you are working with.
        I'm here to chew bubble gum and kick @#%@#%@#%.....and I'm all outta bubble gum !
        Yes I'm talking to you squirrel nuts.

        Comment


        • #5
          Re: How to update a value to a PF

          #StartRant
          There is no way the shop does not have RPG IV. Use it. In fact don't even tell your mourn of a boss.
          #/EndRant
          Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

          Comment

          Working...
          X