+ Reply to Thread
Results 1 to 6 of 6

Thread: Variable-Length Fields

  1. #1

    Default Variable-Length Fields

    ** This thread discusses the article: Variable-Length Fields **
    ** This thread discusses the Content article: Variable-Length Fields **
    0

  2. #2
    Guest.Visitor Guest

    Default Variable-Length Fields

    ** This thread discusses the article: Variable-Length Fields **
    Overall, I'd like to echo Bob's encouragement to use varying length character variables whenever possible. I'd just like to offer some clarifications to a couple of points: First, be careful using varying length variables in the traditional fixed form opcodes like MOVE, MOVEL, SUBST, etc. A subtle issue of varying length semantics is that a character varying variable used in a fixed-format calc behaves exactly like a fixed length variable declared with the current length. For example, if you move a string to a character varying variable using MOVE, and the target has a current length of say 10, the operation will move the source right-adjusted into those 10 characters, with the left-most characters unchanged if the source is shorter. That is, the length of a character varying variable does not change when coded as the result field in a fixed-form, non-expression calc. On the other hand, varying length variables within expressions behave pretty much as you'd expect. Second, under the section "How Long Is It?", note that comparing %LEN(STR) to 0 is not the same as comparing STR to '' (the null string). In character comparisons in RPG, the shorter operand is padded with blanks. And so the null string compares equal to a variable holding a string of blanks. Cheers! Hans

  3. #3
    Guest.Visitor Guest

    Default Variable-Length Fields

    ** This thread discusses the article: Variable-Length Fields **
    Thank you for the the illuminating article! Are there any "gotchas" when using variable length fields in a database file? For example, saving and restoring? And once a variable length database field has been read in by an RPG program, does it behave in the same way as a "varying" field? Regards, Chris

  4. #4
    Guest.Visitor Guest

    Default Variable-Length Fields

    ** This thread discusses the article: Variable-Length Fields **
    Be aware also of passing VARYING vars to CLP or CLLE pgm. You will get the length word (2 bytes) into the string parm. Maybe I did something wrong but thats I got.

  5. #5

    Default Variable-Length Fields

    ** This thread discusses the article: Variable-Length Fields **
    Perhaps the reason that varying length fields are used with infreaquency, is that there are also reasons for not using them! Dave

  6. #6
    Guest.Visitor Guest

    Default Variable-Length Fields

    ** This thread discusses the article: Variable-Length Fields **
    If I have a subprocedure (function) that needs to process a varying length field and return a varying length field of the same size. Basically just manipulate the value without changing the length. How do I describe the prototype parameter, with Varying or with Options(*Varsize)? Likewise, would the procedure interface be exactly the same? Thanks, Erick

+ Reply to Thread

Similar Threads

  1. Using Variable Length Fields
    By Guest.Visitor in forum RPG
    Replies: 7
    Last Post: 08-24-2007, 05:40 PM
  2. Variable Length Fields
    By David Abramowitz in forum General
    Replies: 3
    Last Post: 05-13-2005, 08:07 AM
  3. Replies: 3
    Last Post: 02-05-2003, 11:55 AM
  4. How to Use Variable-Length Fields
    By Guest.Visitor in forum RPG
    Replies: 4
    Last Post: 04-01-2002, 07:19 AM
  5. Variable Length fields
    By Guest.Visitor in forum Application Software
    Replies: 2
    Last Post: 07-05-2000, 04:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts