# Format buffer error calling .NET from Natural

**URL:** <https://techcommunity.softwareag.com/t/format-buffer-error-calling-net-from-natural/59831>\
**Category:** Forum\
**Tags:** Mainframe-Integration, EntireX\
**Created:** [April 4, 2007, 5:14am UTC](https://techcommunity.softwareag.com/t/format-buffer-error-calling-net-from-natural/59831 "2007-04-04T05:14:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steven\_Ystebo](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@Steven\_Ystebo](https://techcommunity.softwareag.com/u/Steven_Ystebo)\
**Post date:** [April 4, 2007, 5:14am UTC](https://techcommunity.softwareag.com/t/format-buffer-error-calling-net-from-natural/59831/1 "2007-04-04T05:14:20Z")

</div>

Natural version: 4.1.4.6  
EntireX version: 7.2.1  
Natural IDL Gen version: 7.2.1.58  
RPC Server version: 7.2.1.5

I am making a call from Natural to a .NET app using a data area (DA) that has group fields in it. There are two ways I can get it to work now:

1. Modify the DA to have no group levels and generate a stub that uses the “old” template.
2. Create a stub using the DA with group levels still in it, then use the parameter area created in that stub to overlay the parameter area in the stub generated for the DA with no group fields. Basically, a merge of the two stubs. This requires a good bit of work since the fields names do not match between the two templates used to create the stub programs.

When I try to use the stub program created for the DA that has group fields (the stubless template), it gets the following error:

0x00000ed0\> . . . . . . returns: 10010009  
0x00000ed0\> . . . . . ) ERXUnmarshal  
0x00000ed0\> . . . . . 10050031 ERXUnmarshal() failed for dotNetServer/ERX\_Exit\_SERVER\_CALL.  
0x00000ed0\> . . . . . ( ERXGetLastError (1. call)  
0x00000ed0\> . . . . . . returns: 00000000  
0x00000ed0\> . . . . . . MsgId : 10010009  
0x00000ed0\> . . . . . . MsgText :  
0x00000ed0\> . . . . . ) ERXGetLastError  
0x00000ed0\> . . . . . 10010009 Invalid format buffer. Location of wrong Parameter is 3.10050033 Could not resolve RPC call for START/XSDADVN9.  
0x00000ed0\> . . . . ) xDynamicCallback()  
0x00000ed0\> . . . . returns: 10010009  
0x00000ed0\> . . . ) ProcessCall  
0x00000ed0\> . . . SERVER checkpoint: at TransactionControl Control= 3,index=1  
0x00000ed0\> . . . ThreadSetStatus(Thread=1) ACTIVE\_OCCUPIED → ACTIVE\_OCCUPIED\_RESET  
0x00000ed0\> . . . returns: 10010009

This is the generated IDL:

Library ‘SDSYLIB’ Is  
Program ‘XSDADVN9’ Is  
Define Data Parameter  
1 PARAMS  
2 G0001  
3 G0002  
4 #X0003 (A60)  
4 #X0004 (A30)  
4 #X0005 (A2)  
4 #X0006 (A10)  
4 #X0007 (A3)  
3 G0008  
4 #X0009 (N3)  
4 G0010  
5 #X0011 (A60/2)  
5 #X0012 (A30/2)  
5 #X0013 (A2/2)  
5 #X0014 (A10/2)  
5 #X0015 (A3/2)  
5 #P0016 (N1.2/2)  
5 #X0017 (N2/2)  
5 #X0018 (N2/2)  
End-Define

This is the stub program:

* * *

- 
- Stub XSDADVN9 generated in library: SDSYLIB
- with Natural version: 4146
- at: 04/03/2007 12:31:57
- 
- (c) Copyright Software AG Darmstadt 1993-2005. All rights reserved
- 

* * *

DEFINE DATA  
PARAMETER  
1 #PARAMS  
2 #G0001 /\* inout  
3 #G0002 /\* inout  
4 #X0003(A60) /\* inout  
4 #X0004(A30) /\* inout  
4 #X0005(A2) /\* inout  
4 #X0006(A10) /\* inout  
4 #X0007(A3) /\* inout  
3 #G0008 /\* inout  
4 #X0009(N3) /\* inout  
4 #G0010 /\* inout  
5 #X0011(A60/2) /\* inout  
5 #X0012(A30/2) /\* inout  
5 #X0013(A2/2) /\* inout  
5 #X0014(A10/2) /\* inout  
5 #X0015(A3/2) /\* inout  
5 #P0016(N1.2/2) /\* inout  
5 #X0017(N2/2) /\* inout  
5 #X0018(N2/2) /\* inout  
LOCAL USING NATRPCL  
LOCAL  
1 IN-BLOCK(A1/372)  
1 REDEFINE IN-BLOCK  
2 CBX(A192)  
2 FB (A50/2)  
2 FBX(A33)  
2 GEN-STRING (A47)  
END-DEFINE  
GEN-STRING := ‘Natural version 4146, 2007-04-03 12:31:57, z/OS’  
CB\_LIB := \*LIBRARY-ID  
CB\_PNAM := \*PROGRAM  
CB\_USID := _USER  
CB\_RESERV := ‘2’  
ASSIGN CB\_VERSION = CB\_VERSION\_2000  
CB\_NPARM := 22  
CB\_COMPRESS:=‘2’  
RESET CB\_NATERR\_INFO CB\_RESPONSECODE  
ASSIGN FB(1) = ‘MG1,1MG2,1MA60,0MA30,0MA2,0MA10,0MA3,0MG2,0MG2,1MN’  
ASSIGN FB(2) = ‘3,0MG3,1MA60,0,2MA30,0,2MA2,0,2MA10,0,2MA3,0,2MN1,’  
ASSIGN FBX = ‘2,2MN2,0,2MN2,0,2MG3,0MG2,0MG1,0.’  
SEND-LEN := 325  
REC-LEN := -1  
CB\_STPLSET := ‘N’  
MOVE CBBLOCK TO CBX  
CALL ‘NATGWRPC’ FKT-STUBLESSRPCX ‘C’ SEND-LEN REC-LEN IN-BLOCK(_)  
IF REC-LEN \> -1 THEN ESCAPE ROUTINE  
END-IF  
CALLNAT ‘NATCLT4’ #PARAMS  
END

The autorpc aspect of the call is triggering, as confirmed by the error coming from the RPC server. I’m thinking that it might be a version issue somewhere, but I haven’t been able to identify the cause of the problem yet.

Anyone have any ideas or suggestions?

Steve

---

<div class="post-metadata">

**Author:** ![Rolf\_Bahlke](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/rolf_bahlke/32/109_2.png) [@Rolf\_Bahlke](https://techcommunity.softwareag.com/u/Rolf_Bahlke)\
**Post date:** [April 4, 2007, 8:42pm UTC](https://techcommunity.softwareag.com/t/format-buffer-error-calling-net-from-natural/59831/2 "2007-04-04T20:42:11Z")

</div>

Hello Steve,

theory says that it should work if you generate both a stub and an IDL file from the very same Natural subprogram.

There is definitely something wrong in the generated stub program so the RPC Server is right to complain. Th parameter area starts with 3 group elements (#PARAMS, #G0001, #G0002) but in “FB(1) = 'MG1,1MG2,1MA60” there are only 2 group elements, so there is a mismatch in the 3rd parameter.

You might try to regenerate the Natural stub in a clean environment. If this still fails I suggest to contact Support.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 2, 2021, 2:40pm UTC](https://techcommunity.softwareag.com/t/format-buffer-error-calling-net-from-natural/59831/3 "2021-04-02T14:40:05Z")

</div>


