Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RPGLE Trigger - Return Changed Field

Status
Not open for further replies.
Mar 25, 2004
2
0
0
US
I have a file with an DES encrypted field on the i5 - V5R3.
I wrote the program below as a trigger to decrypt the field
and return the clear field to the program that initiated the
read. I know the decryption works in the trigger but the
decrypted data is not returned to the reading program. Is
what I am trying not possible?

Thanks. Bob

PS - I am attempting to go this route because with have some
programs that use the file but we do not have the source. We
want this to be transparent to the user(s).

D* Start of TbBufDs
D TgBufDs DS
D TgFile 10
D TgLib 10
D TgMbr 10
D TgMbr 10
* EVENTS: 1=INSERT,2=DELETE,3=UPDATE,4=READ
D TgTrgEvt 1
* TIME: 1=AFTER CHANGE,2=BEFORE CHANGE
D TgTrgTime 1
D TgCmtLvl 1
D TgReserve1 3A
D TgCcsId 8B 0
D TgReserve2 8A
D TgBfrOfs 8B 0
D TgBfrLen 8B 0
D TgBfrNulOf 8B 0
D TgBfrNulLn 8B 0
D TgAftOfs 8B 0
D TgAftLen 8B 0
D TgAftNulOf 8B 0
D TgAftNulLn 8B 0
D TgBufChr 1 32767A
D TgBufAry 1A Overlay( TgBufChr )
D DIM ( %Size( TgBufChr ) )
D* End of TbBufDs
D PARM2 DS
D LENG 1 4B 0
D BEFORE E DS EXTNAME ( ACCRECP )
D BASED ( beforePtr )
D QUALIFIED
D AFTER E DS EXTNAME ( ACCRECP )
D BASED ( afterPtr )
D QUALIFIED
D beforePtr S *
D afterPtr S *
C *ENTRY PLIST
C PARM TgBufDs
C PARM PARM2
C EVAL beforePtr =
C %ADDR ( TgBufAry ( TgBfrOfs + 1 ) )
C EVAL afterPtr =
C %ADDR ( TgBufAry ( TgAftOfs + 1 ) )
C SELECT
C WHEN TgTrgEvt = '4'
C EXSR @SubBefore
C EVAL %SUBST (TgBufDs:TgBfrOfs+1:TgBfrLen)
C = BEFORE
C OTHER
C ENDSL
C EVAL *INLR = *ON
C RETURN
C @SubBefore BEGSR
C EVAL Before.SomeField = ClearData
C ENDSR

ADDPFTRG FILE(mylib/myfile) TRGTIME(*AFTER) TRGEVENT(*READ)
PGM(mylib/Decrypt) RPLTRG(*YES) ALWREPCHG(*YES)
 
Hi

It's my understanding that a trigger program is called by the operating system and not by your program doing the read, therefore I do not think what you are doing is possible.

You could get the trigger program to write to a file, data structure or userspace and get your read program to check for the data after a short delay.

--------------------------------
Rome did not create a great empire by having meetings, they did it by killing all those who opposed them.
 
I agree that it appears that what I wanted to do is not possible. The only reason I was hoping to do this was to avoid changing any programs. I will now simply write a couple encode & decode procedures and change what programs we have source for. Thanks for your input. Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top