× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: Trigger program input buffer layout
  • From: "Scott Klement" <infosys@xxxxxxxxxxxx>
  • Date: 07 Jan 2000 17:35:29 -0600

Hi Jim,

> When this program runs, I am expecting the file I am opening,
> APUNIONBNK, to contain a new record that is an exact
> copy of the record added to my file.  But it is blank.  Here is the
> code it it's entirety.

As near as I can tell, the data structure called "NewBuffer" is
never assigned a value in your code -- thats why its writing out
as "blank" to your file.

>      C                   Eval      NewRecord =
>                                      %SubSt(Parm1:Offset:150)
>      C                   Write     APUnionBnk    NewBuffer

You're putting the data in a field called "NewRecord" and writing
a field called "NewBuffer".

> This seems an awfully cumbersome way to do it though, is there
> a better way?

As far as a "better way to do it", the way that I usually handle
triggers is that I make an externally defined data structure using
the description of the file that the trigger is to be added to.
Then, I base that data structure on a pointer, and I offset that
pointer to the location that the record is stored in "Parm1"

Something like this:

D Parm1           DS
D* Array, because I can't use pointer arthmetic at V3R2
D  Buffer                 1   3072A   DIM(3072)
D  FileName               1     10
D  LibName               11     20
D  MemName               21     30
D  TrigEvent             31     31
D  TrigTime              32     32
D  CommLockLvl           33     33
D  Reserved01            34     36
D  CCSID                 37     40B 0
D  Reserved02            41     48
D  OldOffset             49     52B 0
D  OldLength             53     56B 0
D  OldByteMapOff         57     60B 0
D  OldByteMapLen         61     64B 0
D  NewOffset             65     68B 0
D  NewLength             69     72B 0
D  NewByteMapOff         73     76B 0
D  NewByteMapLen         77     80B 0
D  Reserved03            81     96

D p_NewBuf        S               *
D dsRecord      e ds                  EXTNAME(MYFILE)
D                                     BASED(p_NewBuf)

c                   eval      p_NewBuf = %addr(Buffer(NewOffset+1))

If your release can use pointer arithmetic directly, you could
(instead of using the array) just add the "newoffset" to the
address of Parm1 to get p_NewBuf instead of using the array method
that I used above...

Hope that helps...
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.