Using USR1068N routine

Hello

I am having problem in using the USR1068N API. I am trying to figure out the no. of db calls issued in an online program which is a very old program and it uses reporting mode.

When I tried to run the following it throws NAT0936 error

RESET USR1068L (A12)
REDEFINE USR1068L (FUNCTION (A2) MADIO (I2) MAXCL (I2) DBMS-CALLS (I2) RESPONSE (I4))
RESET USR1068N (A1)
REDEFINE USR1068N (VERSION (I01))
REDEFINE USR1068N (EXTENDED-DATA (A1/1:1)
....
CALLNAT 'USR1068N' USR1068L EXTENDED-DATA (1)
....

The CALLNAT statement is placed inside the Histogram statement loop. I can understand from the error, that it is something related to the variable definition, but I am not able to figure out the error:oops: Could you please help me :?:

Help for 936 error states:

Format/length conflict in parameter :1: (:2: :3:/:4:/:5:/:6:).    
                                                                     
Tx*** Short Text ***                                                
                                                                    
  Format/length conflict in parameter :1: (:2: :3:/:4:/:5:/:6:).    
                                                                    
Ex*** Explanation ***                                               
                                                                    
  The parameter defined at position :1: in object :3: (of type :2:, 
  loaded from library :4:, database :5:, file number :6:) does      
  not match the format/length of the corresponding parameter used to
  invoke it.                                                        
  The following conditions must be met:                             
    - The formats must be equal.                                  

USR1068N is expecting 6 parameters to be passed in the following formats: A2, I2, I2, I2, I4, and A1. You are passing 2 parameters, A12 and A1. Your redefinitions make no difference. You will need to define your local fields to match the parameters expected by the module. In report mode that would look like:

RESET FUNCTION (A2) MADIO (I2) MAXCL (I2) DBMS-CALLS (I2) RESPONSE (I4) EXTENDED-DATA (A1)
...
CALLNAT 'USR1068N' FUNCTION MADIO MAXCL DBMS-CALLS RESPONSE EXTENDED-DATA
...

The names don’t matter, only the format, length and order.

Education, Education, Education.

You need to learn the difference between a Group Name and a Field.

If you look at the documentation for USR1068N you will see:

DEFINE DATA
LOCAL
1 USR1068L
2 INPUTS
3 FUNCTION (A02)
2 INPUT-OUTPUTS
3 MADIO (I02)
3 MAXCL (I02)
2 OUTPUTS
3 DBMS-CALLS (I02)
3 RESPONSE (I04)
/*
1 USR1068N
2 VERSION (I01) INIT <0>
1 REDEFINE USR1068N
2 EXTENDED-PARMS
3 EXTENDED-DATA (A01/1:1)
END-DEFINE

Now here is the CALLNAT:

CALLNAT ‘USR1068N’ USR1068L USR1068N.EXTENDED-PARMS

Note in the definition that USR1068L is a Group Name, not a Field. At compile time, Group Names are replaced by the component fields.

Take a look at your code; you are passing a single A12 field to the routine. You need to pass Function, Madio, Maxcl, dbms-calls and Response.

steve

Hello Steve and Jerome

Thanks for your suggestion. It is working. I have very little exposure in working with reporting mode. Is there any document which explains about the variable definition in reporting mode?

Since none of the outsource companies in India seem willing to actually send their employees to Natural classes, you must fall back on things like the Natural reference manual, a poor second choice to an interactive class.

steve