Dan, is this the sort of thing you were looking for?

Dcl-PI *N;
Buffer Char(2000);
BufferLength Int(10);
End-PI;

Dcl-DS OldRecImage
ExtName('EMPLOYEE') Qualified
Based(OldImagePtr);
End-DS;

Dcl-DS NewRecImage
ExtName('EMPLOYEE') Qualified
Based(NewImagePtr);
End-DS;

Dcl-S OldImagePtr Pointer;
Dcl-S NewImagePtr Pointer;

Dcl-DS TrgBuffer Len(2000) Based(BufferPtr);
// Static portion
tbFileName Char(10);
tbLibraryName Char(10);
tbMemberName Char(10);
tbEvent Char(1);
tbTime Char(1);
tbCommitLock Char(1);
tbFill01 Char(3);
tbCCSID Int(10);
tbRRN Int(10);
tbFill02 Char(4);
tbOldOffset Int(10);
tbOldLength Int(10);
tbOldNullOff Int(10);
tbOldNullLen Int(10);
tbNewOffset Int(10);
tbNewLength Int(10);
tbNewNullOff Int(10);
tbNewNullLen Int(10);
// Dynamic portion
tbTheRest Char(1920);
End-DS;

Dcl-S BufferPtr Pointer;

BufferPtr = %Addr(Buffer);

OldImagePtr = BufferPtr + tbOldOffset;
NewImagePtr = BufferPtr + tbNewOffset;

NOTES:
- DCL-PR is no longer strictly necessary
- I also changed tbFill02 from 10i0 to Char(4), (see DB2 Programming Manual).

Brian.

-----Original Message----- From: Dan
Sent: Tuesday, April 05, 2016 7:10 PM
To: RPG400-L@xxxxxxxxxxxx
Subject: *Entry Plist w/ data structure using prototype / procedure interface

I'm writing my first trigger program in 15 or so years. I'm trying to
avoid the *Entry Plist C specs, but numerous attempts at defining the
prototype / procedure interface have not succeeded. The first parameter
for a trigger program is the buffer data structure. Obviously, I'm trying
to achieve best performance by not moving data around unnecessarily, so I'd
like to avoid moving the *entry parameters and, instead, use them directly.

We're on v7r1.

I've searched and haven't found any complete examples of how to do this in
/free. If anyone can provide a link or a RTFM reference, I would be most
appreciative.

5+d TrgBuffer ds
6+d tbFileName 10
7+d tbLibraryName 10
8+d tbMemberName 10
9+d tbEvent 1
10+d tbTime 1
11+d tbCommitLock 1
12+d tbFill01 3
13+d tbCCSID 10i 0
14+d tbRRN 10i 0
15+d tbFill02 10i 0
16+d tbOldOffset 10i 0
17+d tbOldLength 10i 0
18+d tbOldNullOff 10i 0
19+d tbOldNullLen 10i 0
20+d tbNewOffset 10i 0
21+d tbNewLength 10i 0
22+d tbNewNullOff 10i 0
23+d tbNewNullLen 10i 0
24+
25+d TrgBufferLen s 10i 0
26 d EntryParms pr ExtPgm( 'TRG001R'
)
27 d p1 Like( TrgBuffer
)
28 d p2 Like( TrgBufferLen
)
29 d EntryParms
pi
30 d
TrgBuffer
======>
aaaaaaaaa
======>
bbbbbbbbb
*RNF3316 30 a 000700 The item has already been defined on a
Definition
Specification; specification is
ignored.
*RNF3438 30 b 000700 LIKE keyword is expected for field but not
found;
definition is
ignored.
31 d
TrgBufferLen
======>
aaaaaaaaaaaa
*RNF3316 30 a 000800 The item has already been defined on a
Definition
Specification; specification is
ignored.
*RNF3438 30 31 000800 LIKE keyword is expected for field but not
found;
definition is
ignored.

- Dan

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.