ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Field Procedure not executing for Encode

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

  • Field Procedure not executing for Encode

    I've written an RPGLE Field Procedure to do some encrypting and hiding of a column in my table.
    The Field Procedure's Function 8 Definition is executing.
    The Field Procedure's Function 4 Decoding is executing.

    However, the Function 0 Encoding is not running.
    It's not that the FP is dying during execution.
    It's simply, just not executing.
    At all.

    What would cause this?

  • #2
    Can you share the procedure interface for your program. Also the definition you used to set up the Field procedure.

    So you have run it in debug and the code doesn't get called at all when function 0 should be invoked? In that case what is happening to the content of the new/updated record? What value is in the encrypted field?

    Comment


    • #3
      Here's the column definition in the table DDL.
      It is not part of any constraint.

      Code:
      USERPWD char(10) not null default
      fieldproc SYFP001 ('SY62R021,#SY62R021'),
      I should have been more clear.
      The fieldproc is simply not called in certain situations (verified with debug)

      It is called correctly in these situations:
      • Function 8 Defined is called
        • Upon CREATE TABLE.
      • Function 4 Decode is called
        • With an interactive or embedded SELECT statement
        • Code for Decode merely returns a mask - all those asterisks
      • Function 0 Encode is called
        • Upon CREATE TABLE. I assumed because of the DEFAULT, but Encode ran without the DEFAULT.
      • Optional parameter (the ('SY62R021,#SY62R021') ) is processed correctly when the field proc is actually called.
      It is NOT called at all in these situations
      • Function 0 Encode
        • NOT called with an SQL INSERT or UPDATE,
        • NOT called with a native RPG WRITE or UPDATE
      • Function 4 Decode
        • NOT called with a native RPG CHAIN.
      Field procedure is written in RPGLE, all free-format, non-linear MAIN (MAIN keyword in CTL-OPT, main procedure is also name of program object).
      ACTGRP(*caller).
      Table and field proc are in the same library.
      I am simply trying to mask the field for now. I have not coded encryption/decryption yet.


      Comment

      Working...
      X