ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Decimal-data error.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Re: Decimal-data error.

    Hi Scott!

    I did not enclose compiler listing of caller but the field is zoned in the "DDS I-specs" and at the end of listing (cross reference): i.e. RPG does not redefine on-the-fly as packed.

    A question arises: Why/when does RPG it and why/when not?
    Furthermore: in the new version of the programme with the work around I told in my last msg, the field you quoted starts as zoned and is packed in the cross reference and it's not used in the C-specs nor redefined in the D-specs.

    I do not say that I can learn only with 20, it's just that after a 20 years stop writing programmes (I developed and used on a S36 up to SSP 7.0 - thus using CALLS - a complete software for the travel agency where I worked) it takes some time to get the gears in my 56yrs-head in motion again. For the moment I have to "translate" RPGII/SSP knowledge to ILE/CL and then learn the, for me, new possibilities (e.g. prototypes).

    Before asking, I'm used to search for all the informations I can find on the net and in the ILE/CL books and manuals I have and try out what I think I have understood.

    Thank you for your time and assistance.
    Arnaldo

    Comment


    • #17
      Re: Decimal-data error.

      I have run into this before, esp when calling RPG-IV from RPG-III. Here's what I found:
      1. I always pass and receive numerics as packed, using another variable if needed. It seems like it wants to pack them.
      2. Exception to rule 1 - if the numeric fields are in a data structure, it will pass as defined. It will not pack it on you. You can pass the whole DS as a parm.

      Comment


      • #18
        Re: Decimal-data error.

        Originally posted by argasoft36 View Post
        A question arises: Why/when does RPG it and why/when not?
        In the case of an externally-described file with a zoned field, if the field is defined in a data structure as zoned (the default type for numeric data structure subfields), the compiler will define it as zoned. If the field is not defined in a data structure, the compiler will define it as packed.

        In this example, CUSNUM is zoned, ZIPCOD is packed, even though both are zoned in the physical file.

        Code:
        Fqcustcdt  if   e             disk    
                                              
        D DataStructure   ds                  
        D    CusNum

        Comment

        Working...
        X