Example of using FLD/VERIFY and FLD/CHANGE

Using the bank account segment from the "Bank Account Example" database, assume that a customer wants to withdraw $100 from a checking account. The checking account number is 24056772. To find out whether the customer can withdraw this amount, you must check the current balance. If the current balance is greater than $100, you want to subtract $100 from the balance, and add 1 to the transaction count in the segment.

You can do all of this processing by using one FLD call and three FSAs. The three FSAs are described:

  1. Verify that the value in the BALANCE field is greater than or equal to $100. For this verification, you specify the BALANCE field, the H operator for greater than or equal to, and the amount. The amount is specified without a decimal point. Field names less than eight characters long must be padded with trailing blanks to equal eight characters. You also have to leave a blank between the field name and the operator for the FSA status code. This FSA looks like this:
    BALANCEbb
    H10000*
    The last character in the FSA is an asterisk, because this FSA will be followed by other FSAs.
  2. Subtract $100 from the value in the BALANCE field if the first FSA is successful. If the first FSA is unsuccessful, IMS does not continue processing. To subtract the amount of the withdrawal from the amount of the balance, you use this FSA:
    BALANCEbb
    -10000*
    Again, the last character in the FSA is an asterisk, because this FSA is followed by a third FSA.
  3. Add 1 to the transaction count for the account. To do this, use this FSA:
    TRANCNTbb
    001b
    
    In this FSA, the last character is a blank (b), because this is the last FSA for this call.

    When you issue the FLD call, you do not reference each FSA individually; you reference the I/O area that contains all of them.