+ Reply to Thread
Results 1 to 2 of 2

Thread: Decimal vs Zoned fields in RPGLE

  1. #1
    Guest.Visitor Guest

    Default Decimal vs Zoned fields in RPGLE

    I wrote an RPGLE program that has this D spec: D pcomp s like(icomp) ICOMP is field from a DB file. it's defined as 2 zoned 0 dec. The compiler seems to turn it into a packed field which is causing me trouble (compiler output below): I S 2 3 0ICOMP ICOMP ZONE 2,0 SIGNED *RNF7031 ICOMP P(2,0) 003600 1000003D PCOMP P(2,0) 003600D you can see that the Input spec shows it zoned and so does one other spot in the compiler output, but the third place it appears it has been magically transformed to PACKED! The problem is that PCOMP is therefore packed and I am using it in a parm statement on an *ENTRY plist (I have my reasons for not being more ILE-ish on this one). When an RPG program that I have calls this one, passing ICOMP from the file I get a decimal data error - very frustrating!!! Why oh, why does the compiler insist on packing this field and how do I prevent it from doing so? I could take away the LIKE(ICOMP) and hard code the definition, but that obviously stinks. I could define a separate field in the caller that is packed and then move ICOMP into it, but that is unsatisfying. I want to control the compiler's strange decision to do this to me. Ideally I'd be able to code an "S" for signed in the D spec but SEU won't let me do this with the LIKE keyword. If anybody has a solution or even an explanation, I'd appreciate it. Thanks

  2. #2
    Guest.Visitor Guest

    Default Decimal vs Zoned fields in RPGLE

    This is a FAQ. Numeric fields in external files (other than float) are defined by default within an RPG program as packed decimal, regardless of the format defined in the DDS. If you want to force all of the fields in some record to have the format defined in the DDS, include an externally described data structure within your program, where the external definition is taken from that file.

+ Reply to Thread

Similar Threads

  1. Packed vs. Zoned
    By David Abramowitz in forum RPG
    Replies: 2
    Last Post: 05-17-2005, 03:19 PM
  2. Reading data queue containing a zoned decimal field
    By Guest.Visitor in forum Visual Basic
    Replies: 6
    Last Post: 09-29-2003, 07:34 AM
  3. Zoned numeric vs packed
    By David Abramowitz in forum RPG
    Replies: 10
    Last Post: 06-21-2002, 07:00 AM
  4. Zoned Decimal array in RPG III
    By Guest.Visitor in forum Application Software
    Replies: 5
    Last Post: 07-28-2000, 12:40 PM
  5. Packed vs Zoned
    By bibarnes@yahoo.com in forum Application Software
    Replies: 32
    Last Post: 10-14-1999, 02:17 AM

Posting Permissions

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