ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

How to validate date

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

  • How to validate date

    How to validate date in RPG400? Is there any opcode, especially in RPG/400 not in ILE.

  • #2
    Re: How to validate date

    there has always been the TEST opcode. But If your talking RPGIII and not RPG400 then this wont work.


    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


    • #3
      Re: How to validate date

      Originally posted by jamief
      there has always been the TEST opcode. But If your talking RPGIII and not RPG400 then this wont work.


      jamie
      Um - Jamie - RPG/400 _is_ RPG III.

      There is no native way to test (or do anything else with) real dates in RPG III (RPG/400) - iSeries network in it's previous guise of News/400 published a series of date routines by Paul Conte under the title "The last Date Routines You'll Ever Need" or something very similar. Try searching the www.iSeriesNetwork.com and see if they are still there. Google might find them somewhere too.

      Why on earth is ANYONE writing code in RPG III. What a total bloody waste of time and energy.

      Comment


      • #4
        Re: How to validate date

        He's BAAAAaaaaAAACK...

        Comment


        • #5
          Re: How to validate date

          I didnt know that I thought RPG400 was with the extended factor one and factor two making the source files 112 instead of the RPGIII which was a length of 92. Im not saying thats correct Im just saying thats what I thought.

          I agree with the waste of time statement I cant even remember how to use a limits file.

          code would look something like this.....remember leap year......and youll have to add logic for # of days by month. I didnt do that this is just a very simple example
          PHP Code:
          RPG400/RPGIII

               I            DS
               I                                        1   80WKDAT8
               I                                        1   20WKCENT
               I                                        3   40WKYEAR
               I                                        5   60WKMNTH
               I                                        7   80WKDAY
                
          *
               
          C           WKDAT8    IFEQ *ZEROS
               C                     MOVEL
          'Y'       ERROR
               C                     
          ENDIF
                *
               
          C           WKCENT    IFNE 19
               C           WKCENT    ANDNE20
               C                     MOVEL
          'Y'       ERROR
               C                     
          ENDIF
                *
               
          C           WKDAY     IFGT 31
               C                     MOVEL
          'Y'       ERROR
               C                     
          ENDIF
                *
               
          C           WKYEAR    IFEQ *ZEROS
               C                     MOVEL
          'Y'       ERROR
               C                     
          ENDIF
                *
               
          C           WKMNTH    IFGT 12
               C                     MOVEL
          'Y'       ERROR
               C                     
          ENDIF
                *
               
          C                     MOVE *ON       *INLR
                
          *-----------------------------------------------------
                *  
          INDATE 8 CCYY/MM/DD
                
          *-----------------------------------------------------
               
          C           *INZSR    BEGSR
               C           
          *ENTRY    PLIST
               C                     PARM           INDATE  8
               C                     PARM           ERROR   1
                
          *
               
          C                     MOVE INDATE    WKDAT8  80
                
          *
               
          C                     ENDSR 

          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


          • #6
            Re: How to validate date

            Originally posted by jamief
            I didnt know that I thought RPG400 was with the extended factor one and factor two making the source files 112 instead of the RPGIII which was a length of 92. Im not saying thats correct Im just saying thats what I thought.
            RPG400 was introduced with the AS/400 back in 1988. It was nothing more than RPG III from the S/38 with a couple of minor quirks.

            Between 1988 and V3R1 (whenever that was - 1994?) a small number of extra features were added to the langauge but nothing much.

            With V3R1 IBM introduced RPG IV (aka ILE RPG) which has the 112 spec length and the extended factor 2 etc. While it was stupidly referred to as ILE RPG/400 in some quarters of IBM those of us involved in the launch always favored RPG IV for the simple reason that RPG IV programs do not have to be ILE programs. In fact, the vast majority (compiled with PDM 14 and standard defaults) are not really ILE programs at all but rather they are fake OPM programs.

            V3R2 introduced subprocedures and off we went!


            End of brief history lesson

            Comment

            Working...
            X