ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

reg Decimal Data Error

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

  • reg Decimal Data Error

    Hi folks!

    I have a PF in which one of the field is DOJ n i have defined as 8S 0 or 8P 0 n i am using this field in my RPG prgm n i am dividing this field into subfields using Data Structure for some validation purpose, i have divided the 8S 0 field into three fields with 2, 2 and 4 digits each. now i am getting Decimal data error. can anybody explain y the error is coming.

    thanks

  • #2
    Re: reg Decimal Data Error

    try to initilize the datastructure
    (did I spell any of that right????)

    Code:
      *                                              
      * Informational data structure.                
      *                                              
     d INFDS           DS                        inz 
     d  CURREC               378    379B 0           
      *
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

    Comment


    • #3
      Re: reg Decimal Data Error

      Close enough, jamie. Way too many vowels involved anyway. My first thought about this question was that the maybe the data structure was defined as alpha?
      Hail to the king, baby.

      Comment


      • #4
        Re: reg Decimal Data Error

        Hi Folks!

        I am using RPG400 not ILE i have no idea abt ILE can anybody let me know hw the initialization can be done in RPG400 n wt data type we need to give.

        thanks

        Comment


        • #5
          Re: reg Decimal Data Error

          Um.... stick an "I" in front of the "DS" to initialize it.
          Hail to the king, baby.

          Comment


          • #6
            Re: reg Decimal Data Error

            Maybe you could show us your data structure?
            Hail to the king, baby.

            Comment


            • #7
              Re: reg Decimal Data Error

              A numeric subfield in a data structure is initialized as Zoned decimal. Without INZ keyword at DS definition or Subfield level a numeric subfield is initialised to blanks instead of zero(default for numeric). So in program when u try to move a numeric value to this subfield as: Eval Fieldname = Fieldname + 12345, you receive a decimal data error. As Jamie has correctly said when using DS having numeric subfield use INZ keyword at DS definition. This will ensure numeric subfield is initialized to zeros instead of blanks. Another way is to use CLEAR opcode for DS in *INZSR or before any process is started using DS subfield.

              Comment


              • #8
                Re: reg Decimal Data Error

                Thanks beaus (like this)
                Code:
                I*--------------------------------------------         
                I* HOURS ARRAY - 'BEFORE' FIELDS                       
                I*--------------------------------------------         
                I           [COLOR="Red"]I[/COLOR]DS                                        
                I                                        1  50 HRB     
                I                                        1   52AUBH01  
                I                                        6  102AUBH02  
                I                                       11  152AUBH03  
                I                                       16  202AUBH04  
                I                                       21  252AUBH05  
                I                                       26  302AUBH06  
                I                                       31  352AUBH07  
                I                                       36  402AUBH08  
                I                                       41  452AUBH09  
                I                                       46  502AUBH10
                All my answers were extracted from the "Big Dummy's Guide to the As400"
                and I take no responsibility for any of them.

                www.code400.com

                Comment


                • #9
                  Re: reg Decimal Data Error

                  Also I would feel bad if I didnt say its easy to convert RPGIII /RPG400 to ILE

                  just create a bigger source file (length 112 instead of 92)

                  crtsrcpf mylib/qrpglesrc rcdlen(112)

                  then use command CVTRPGSRC to convert the "older" source to ILE.

                  thanks it.

                  jamie
                  All my answers were extracted from the "Big Dummy's Guide to the As400"
                  and I take no responsibility for any of them.

                  www.code400.com

                  Comment


                  • #10
                    Re: reg Decimal Data Error

                    ..."Show us your Data Structure?" ....

                    Wow.. I'm glad WE know what we're talking about!

                    Comment


                    • #11
                      Re: reg Decimal Data Error

                      Hey, I love showing off my data structure. I just think everyone should be proud of theirs and not ashamed to hang them out there. Maybe you're a lil shy, maybe you don't have one, I dunno. Maybe you're just jealous...
                      Hail to the king, baby.

                      Comment


                      • #12
                        Re: reg Decimal Data Error

                        Hi Folks!

                        Let me explain my problem in a more clear way:

                        i have a field in a PF which is defined as DOJ - 8S 0

                        in my RPG400 Program i am using Data Structure to divide the above field into three Subfields as i have to use these subfields for some validation purpose, i have defined my Data Structure as follows:

                        I DS
                        I 1 80DOJ
                        I 1 20DD1
                        I 3 40MM1
                        I 5 80YYYY1

                        so now the decimal data error is coming.

                        let me tell u one more thing, as i got Decimal Data Error so after that what i did is like in C - Spec: i have moved the value of the DOJ to some variable as DOJ1 and that DOJ1 i used as Data Structure as follows

                        I DS
                        I 1 80DOJ1
                        I 1 20DD1
                        I 3 40MM1
                        I 5 80YYYY1

                        in C - Spec i wrote

                        C MOVE DOJ DOJ1

                        now the Decimal Data Error is not coming, can anybody tell whyyyyyyyyyyyyyyyyyy.


                        thanks

                        sorry if i am troubling u guys

                        Comment


                        • #13
                          Re: reg Decimal Data Error

                          Okay First your not bothering us.

                          second just initialize the datastructure as shown previously,

                          and lastly here is what RPGLE source type can do for you and dates
                          Code:
                           *                                                             
                           *  Field Definitions.                                         
                           *                                                             
                          d DOJ             S              8  0   inz(03032006)          
                          d EURdate         S               D     datfmt(*EUR)           
                          d Days            S              2  0                          
                          d Month           S              2  0                          
                          d Year            S              4  0                          
                           *=============================================================
                           *  M A I N     L I N E                                        
                           *=============================================================
                          c     *eur          test(de)                DOJ                
                          c                   if        not%error                        
                          c                   eval      EURDATE = %Date(DOJ:*eur)        
                          c                   eval      days  = %Subdt(EURDate:*D)       
                          c                   eval      Month = %Subdt(EURDate:*M)       
                          c                   eval      year  = %Subdt(EURDate:*Y)       
                          c                   endif                                      
                          c                   eval      *inlr = *on

                          take care
                          jamie
                          All my answers were extracted from the "Big Dummy's Guide to the As400"
                          and I take no responsibility for any of them.

                          www.code400.com

                          Comment


                          • #14
                            Re: reg Decimal Data Error

                            Ohhhhhhhhh Jaime... You big stud you... Where's You're your Data Structure? Are you ashamed of it?

                            Comment


                            • #15
                              Re: reg Decimal Data Error

                              Im married and my wife works miles from here....I could drive up there and see if I can borrow it for a while....

                              let me know
                              All my answers were extracted from the "Big Dummy's Guide to the As400"
                              and I take no responsibility for any of them.

                              www.code400.com

                              Comment

                              Working...
                              X