× 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: Output of Null-Capable Fields in the Trigger Buffer
  • From: "Nelson C. Smith" <ncsmith@xxxxxxxx>
  • Date: Mon, 22 May 2000 22:23:56 -0400

Take a look at the catalog files.  QADBIFLD,  if memory serves, gives a
listing of the fields and their positions, sizes, etc.

----- Original Message -----
From: "Alexander Brand" <Brand@ireks.com>
To: <RPG400-L@midrange.com>
Sent: Monday, May 22, 2000 3:48 AM
Subject: Output of Null-Capable Fields in the Trigger Buffer


> Hi,
> is there a way to find out the position-number of an field in my
> database file?
>
> I created a before trigger (insert and update) to manipulate
> some fields in our files like ID-Number, WriteDate, WriteTime,
> UpdateDate, Update Time and so on.
>
> But some of these fields are null-capable. When a null-capable field is
> output to or updated in the trigger new record image, then if the
> field is null, the value placed in the buffer will be ignored by data
management.
> These fields have the null indicator on in the trigger new null record
map: This is
> the map of the null record fields of my database file. This character
array has the
> same length as the number of fields in the database file associated to the
trigger
> program. DB2/400 can set each character to 1 (NULL field) or 0 (not NULL).
>
> How can I find out the position of the field in my database file to set
the null
> indicator off? I need a softcoding version because I don t want to
hardcode
> the position number.
>
> In IBM s Redbook "DB2/400 Advanced Database Functions" theres is an
example
> of softcoding the trigger buffer. This means that if for some reason you
change the structure of the
> physical file, you also need to change the structure of the physical file
inside the
> trigger program. This must be repeated for all the trigger programs where
the
> structure of the related table has changed. The alternative is that at the
time of
> writing the trigger program, you do not hard code the structure of the
table but
> soft-code it. That way if and when you change the structure of a table,
you only
> need to recompile the trigger program and not make any changes to the
trigger
> program itself.
>
> Example:
>
> ********************************************************
> * TRIGGER BUFFER data structure
> ********************************************************
> D TgBufDs                DS
> .....
> D TgAftOfs                                         Like( TypeBin4 )
> D TgAftLen                                        Like( TypeBin4 )
> D TgAftNulOf                                     Like( TypeBin4 )
> D TgAftNulLn                                     Like( TypeBin4 )
> D TgBufChr                 1     32767A
> D TgBufAry                                1A    Overlay( TgBufChr )
> D                                                        DIM
%Size( TgBufChr ) )
>
> ***********************************************************
> * Data Structures for the Before and After images
> ***********************************************************
> D BfCustomer E DS ExtName( Customer ).
> D                             Prefix( Bf )
> D                             Based( TgBfrPtr )
> D AfCustomer E DS ExtName( Customer ).
> D                             Prefix( Af )
> D                             Based( TgAftPtr )
>
>
> *****************************************************
> * LETS EVALUATE THE VALUE OF THE POINTERS FOR THE BEFORE
> * AND AFTER IMAGES .
> ***********************************************************
> C Eval TgBfrPtr = %Addr(TgBufAry(TgBfrOfs + 1))
> C Eval TgAftPtr = %Addr(TgBufAry(TgAftOfs + 1))
>
>
> Thanks in advance.
> Alexander.
>
> Alexander Brand
> brand@ireks.com
> http://www.ireks.com
>
>
>
> +---
> | 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
> +---
>

+---
| 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 ...

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.