Topic
  • 6 replies
  • Latest Post - ‏2011-11-04T06:41:58Z by B.Hauser
B.Hauser
B.Hauser
95 Posts

Pinned topic Issue with %LEN() under Release 7.1

‏2011-11-03T06:26:34Z |
Hi,

is there any restriction when using %LEN(Fld: *Max) in composition with datastructure subfields?
Or am I missing a PTF, if so which one?

Under release V5R4 I used the following statement to call a procedure:

Wx_ManChgFldVarChar(
'WDUSERNAME': %Addr(GblDSTXDATEP.UserName): 
'': *%Size(GblDSTXDATEP.UserName) - 2*: 
'Output');


Because I had to hardcode the number of prefixed bytes, I wanted to determine the maximum length for the varying length field under Release 7.1 with %LEN() and changed the call statement as follows:


Wx_ManChgFldVarChar(
'WDUSERNAME': %Addr(GblDSTXDATEP.UserName): 
'': *%Len(GblDSTXDATEP.UserName: *Max)*: 
'Output');


When compiling this code under release 7.1 I get a strange compile error.
*RNF5410 30 1 Prototype for procedure call not defined.

If I reset my procedure call to the version I used under release V5R4M0, I get my module compiled.

Thanks in advance

Birgitta
Updated on 2011-11-04T06:41:58Z at 2011-11-04T06:41:58Z by B.Hauser
  • B.Hauser
    B.Hauser
    95 Posts

    Re: Issue with %LEN() under Release 7.1

    ‏2011-11-03T06:31:25Z  
    I hate if I cannot correct my posts!

    It seems bold does not work in composition with code. In the original statement the leading and trailing asteric are not existent in the source code.

    The original snippets look as follows:
    
    Wx_ManChgFldVarChar(
    'WDUSERNAME': %Addr(GblDSTXDATEP.UserName): 
    '': %Size(GblDSTXDATEP.UserName) - 2: 
    'Output');
    


    
    Wx_ManChgFldVarChar(
    'WDUSERNAME': %Addr(GblDSTXDATEP.UserName): 
    '': %Len(GblDSTXDATEP.UserName: *Max): 
    'Output');
    


    Birgitta
  • Rick_C
    Rick_C
    13 Posts

    Re: Issue with %LEN() under Release 7.1

    ‏2011-11-03T14:12:17Z  
    Birgitta,

    Maybe the %size() and %len() BIF's return different size values. I checked documentation from 5.4 thru 7.1 and couldn't find a definition of how the value returned by these functions is defined. I have had difficulties recently where I am generating a value as the parameter for a function and it has triggered the prototype not defined for call error. Once I got the parameter definition in line with the caculated value definition everything was fine.

    Rick
  • JonParis
    JonParis
    190 Posts

    Re: Issue with %LEN() under Release 7.1

    ‏2011-11-03T16:08:14Z  
    It does appear as if you are missing a PTF Birgitta - but I have no idea which one.

    This works as expected on my V7 box.

    d myDs ds qualified
    d vary1 148a varying
    d vary2 148a varying(4)

    d length s 10i 0
    d size s 10i 0

    /free
    length = %Len(MyDS.vary1 : *Max);
    size = %Size(MyDS.vary1);
    dsply ('Vary1 can hold ' + %char(length)
    + ' in ' + %Char(size) + ' bytes');
    length = %Len(MyDS.vary2 : *Max);
    size = %Size(MyDS.vary2);
    dsply ('Vary2 can hold ' + %char(length)
    + ' in ' + %Char(size) + ' bytes');
    *inlr = *On;

    Have you tried using the function in isolation as I have here? It may only be an issue if it is used on a function call.
  • scott_klement
    scott_klement
    263 Posts

    Re: Issue with %LEN() under Release 7.1

    ‏2011-11-03T19:45:14Z  
    • B.Hauser
    • ‏2011-11-03T06:31:25Z
    I hate if I cannot correct my posts!

    It seems bold does not work in composition with code. In the original statement the leading and trailing asteric are not existent in the source code.

    The original snippets look as follows:
    <pre class="jive-pre"> Wx_ManChgFldVarChar( 'WDUSERNAME': %Addr(GblDSTXDATEP.UserName): '': %Size(GblDSTXDATEP.UserName) - 2: 'Output'); </pre>

    <pre class="jive-pre"> Wx_ManChgFldVarChar( 'WDUSERNAME': %Addr(GblDSTXDATEP.UserName): '': %Len(GblDSTXDATEP.UserName: *Max): 'Output'); </pre>

    Birgitta
    I agree with Jon. I'm trying to reproduce the error you're receiving, and I'm unable to. Here's my code...

    
    H DFTACTGRP(*NO)   D GblDSTXDATEP    ds                  qualified D   test                       123a D   UserName                   456a   varying D   test2                       11p 0   /free Wx_ManChgFldVarChar( 
    'WDUSERNAME' : %addr(GblDSTXDATEP.UserName) : 
    '' : %len(GblDSTXDATEP.UserName: *MAX) : 
    'Output' );   *inlr = *on; /end-free     P Wx_ManChgFldVarChar... P                 B D                 PI D   name                        10a   
    
    const D   data                          *   value D   etc                         12a   varying 
    
    const D   size                        10i 0 value D   usage                       10a   
    
    const   D msg             s             52a   varying /free   msg = name + 
    ' is ' + %
    
    char(size) + 
    ' bytes long' + 
    ' and used for ' + usage; dsply msg;   /end-free P                 E
    


    When I run this, I get:
    
    DSPLY  WDUSERNAME is 456 bytes 
    
    long and used 
    
    for Output
    


    It seems to be working as intended?
  • barbara_morris
    barbara_morris
    451 Posts

    Re: Issue with %LEN() under Release 7.1

    ‏2011-11-03T20:29:54Z  
    Hi Birgitta, there is a PTF SI41005 for APAR SE44055, that has a similar symptom. "RPGLE-CMPL-MSGMCH3601 %LEN(DS.SUBF:*MAX) WITH QUALIFIED SUBF". The MCH3601 doesn't fit your case, but rest of the description fits.

    http://www-01.ibm.com/support/docview.wss?uid=nas37c5b8ef50cde00308625779a006ead59

    I think that SI43157 is the latest supersede for that PTF.
  • B.Hauser
    B.Hauser
    95 Posts

    Re: Issue with %LEN() under Release 7.1

    ‏2011-11-04T06:41:58Z  
    Hi Birgitta, there is a PTF SI41005 for APAR SE44055, that has a similar symptom. "RPGLE-CMPL-MSGMCH3601 %LEN(DS.SUBF:*MAX) WITH QUALIFIED SUBF". The MCH3601 doesn't fit your case, but rest of the description fits.

    http://www-01.ibm.com/support/docview.wss?uid=nas37c5b8ef50cde00308625779a006ead59

    I think that SI43157 is the latest supersede for that PTF.
    Thanks!
    I'll order the PTF!

    Birgitta