Hi Srinivas,

Assuming the code is what you had in your earlier e-mail, you need to add 1 to the offset on the substring

EVAL FYD8TX = %SubSt(@Parm1: NewOffSet :
NewLength)
Should be

EVAL FYD8TX = %SubSt(@Parm1: NewOffSet+1 :
NewLength)

Regards

Paul Tuohy
ComCon
www.comconadvisor.com www.systemideveloper.com




Srinivas Boggula wrote:
Hi All,

In my Physical file I have a numeric field when i tried to move Newrecord Value or Old Record value to my data base field
I am getting junk value.

I am stucked here can any one please let me know the solution.

Thanks in advance

Regards,
Srinivas



________________________________________
From: midrange-l-bounces@xxxxxxxxxxxx [midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Paul Tuohy [tuohyp@xxxxxxxxxxxxxxxxx]
Sent: Wednesday, August 18, 2010 5:00 PM
To: Midrange Systems Technical Discussion
Subject: Re: Trigger Program.

Hi Srinivas,

The example you referenced was using hard coded lengths - which is why I
said it wasn't a good example.

|0005.03 C Eval NAME = %SubSt(@Parm1: NewOffSet+1 : 10)
0005.04 C Eval ADDRESS = %SubSt(@Parm1: NewOffset + 11:
0005.05 C 10)
|


Regards

Paul Tuohy
ComCon
www.comconadvisor.com
www.systemideveloper.com





Srinivas Boggula wrote:
Hi Paul,

Thanks for the information
but I am not hard coding lengths instead I am taking values from DS

In DS we have subfileds of TrgEvent,OrigOffSet,OrigLength,NewOffSet,NewLength

when ever we try to add record to a particular file TrigeEvent will be "1"
NewOffSet and NewLength will be used for Add operation

and Delete operation Triger Event will be '2'
OrigOffSet and OrigLength will be used for Delete operation

And for Update Operation triger event will be "3"
OrigOffSet and OrigLength for old data and NewOffSet and NewLength for new data.

Example:

SELECT
TrgEvent WHENEQ '1'
Eval FYD7TX = 'ADD'
EVAL FYD8TX = %SubSt(@Parm1: NewOffSet :
NewLength)
TrgEvent WHENEQ '2'
Eval FYD7TX = 'DELETE'
EVAL FYD8TX = %SubSt(@Parm1: OrigOffSet:
OrigLength)
TrgEvent WHENEQ '3'
Eval FYD7TX = 'UPDATE'
EVAL FYD8TX = %SubSt(@Parm1: OrigOffSet :
OrigLength)
EVAL FYC1TX = PGMUSER
WRITE FFYRES5
EVAL FYD8TX = %SubSt(@Parm1: NewOffSet :
NewLength)
ENDSL

EVAL FYC1TX = PGMUSER
WRITE FFYRES5

Eval *InLr = *On

Regards,
Srinivas



________________________________________
From: midrange-l-bounces@xxxxxxxxxxxx [midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Paul Tuohy [tuohyp@xxxxxxxxxxxxxxxxx]
Sent: Wednesday, August 18, 2010 1:16 PM
To: Midrange Systems Technical Discussion
Subject: Re: Trigger Program.

Hi Srinivas,

It may be simple but not a good example. Apart from the fact that the DS
uses absolute notation and binary fields your should NEVER, EVER hard
code lengths/offsets as in the example. What happens this program when
the length of NAME (on the database files - or even worse, on one of the
database files) is changed from 10 to 15?

Should have...

d p_dataIn S *
d dataIn E Ds based(p_dataIn) qualified
/free
p_dataIn = %addr( @parm1 + newOffset );
name = dataIn.name;
address = dataIn.address;

Regards

Paul Tuohy
ComCon
www.comconadvisor.com
www.systemideveloper.com





Srinivas Boggula wrote:

Hi All,

I found another easy way of doing this Please find attached link below.

http://tutorialindia.com/articles/as400/db2_trigger_example_rpg_iv.php

Regards,
Srinivas
iGATE is Ranked No. 1 in DQ-IDC best IT employer survey and Ranked No.2
by Business Today-Mercer Human Resource Consulting-TNS in a cross industry survey of Best Companies to work for in India
----------------------------------------------------------------DISCLAIMER---------------------------------------------------------
Information transmitted by this EMAIL is proprietary to iGATE Group of Companies and is intended for use only by the individual
or entity to whom it is addressed and may contain information that is privileged, confidential, or exempt from disclosure under
applicable law. If you are not the intended recipient of this EMAIL immediately notify the sender at iGATE or mailadmin@xxxxxxxxx
and delete this EMAIL including any attachments



--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
iGATE is Ranked No. 1 in DQ-IDC best IT employer survey and Ranked No.2
by Business Today-Mercer Human Resource Consulting-TNS in a cross industry survey of Best Companies to work for in India
----------------------------------------------------------------DISCLAIMER---------------------------------------------------------
Information transmitted by this EMAIL is proprietary to iGATE Group of Companies and is intended for use only by the individual
or entity to whom it is addressed and may contain information that is privileged, confidential, or exempt from disclosure under
applicable law. If you are not the intended recipient of this EMAIL immediately notify the sender at iGATE or mailadmin@xxxxxxxxx
and delete this EMAIL including any attachments


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
iGATE is Ranked No. 1 in DQ-IDC best IT employer survey and Ranked No.2
by Business Today-Mercer Human Resource Consulting-TNS in a cross industry survey of Best Companies to work for in India
----------------------------------------------------------------DISCLAIMER---------------------------------------------------------
Information transmitted by this EMAIL is proprietary to iGATE Group of Companies and is intended for use only by the individual
or entity to whom it is addressed and may contain information that is privileged, confidential, or exempt from disclosure under
applicable law. If you are not the intended recipient of this EMAIL immediately notify the sender at iGATE or mailadmin@xxxxxxxxx
and delete this EMAIL including any attachments

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
iGATE is Ranked No. 1 in DQ-IDC best IT employer survey and Ranked No.2 by Business Today-Mercer Human Resource Consulting-TNS in a cross industry survey of Best Companies to work for in India
----------------------------------------------------------------DISCLAIMER---------------------------------------------------------
Information transmitted by this EMAIL is proprietary to iGATE Group of Companies and is intended for use only by the individual or entity to whom it is addressed and may contain information that is privileged, confidential, or exempt from disclosure under applicable law. If you are not the intended recipient of this EMAIL immediately notify the sender at iGATE or mailadmin@xxxxxxxxx and delete this EMAIL including any attachments


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.