1. Home
  2. Knowledge Base
  3. Validating via an RPG External Object Source Code

Validating via an RPG External Object Source Code

mrc recommends using the Workflow Designer to validate user input going forward.

Source Code

5761WDS V7R1M0  100416       SEU SOURCE LISTING
SOURCE FILE . . . . . . .  MRCWORKLIB/QRPGLESRC
MEMBER  . . . . . . . . .  VALIDDATES
SEQNBR*...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7
1       *Author Rick Hurckes
2       *Date: 2011-09-19
10      *This example is designed to illustrate how to call external objects
11      *at the *FLDVALID    09/19/11
20      *location of m-Power applications.
21      *This example will verify that an end user has entered a beginning
22      *and end date and that 09/19/11
29      *the beginning date occurs prior to the end date.
30     C     *entry        plist
100    C                   parm                    @error           99
200    C                   parm                    @startdate        8 0
300    C                   parm                    @enddate          8 0
400    C
500    C                   eval      @error = *blanks
600    C                   if        @startdate = 0 and @enddate = 0
700    C                   eval      @error = 'Please enter some dates.'
800    C                   GOTO      END
801    C                   endif
900    C
902    C                   if        @startdate = 0
903    C                   eval      @error = 'You must enter a start date.'
904    C                   GOTO      END
905    C                   endif
1000   C
1001   C                   if        @enddate = 0
1002   C                   eval      @error = 'You must enter an end date.'
1003   C                   GOTO      END
1005   C                   endif
1100   C
1101   C                   if        @startdate > @enddate
1102   C                   eval      @error = 'Start date is after end date.'
1103   C                   GOTO      END
1104   C                   endif
2500   C
2501   C     END           TAG
2600   C                   eval      *inlr =*on
* * * *  E N D  O F  S O U R C E  * * * *

Updated on June 20, 2023

Was this article helpful?

Need Support?
Can’t find the answer you’re looking for? Don’t worry we’re here to help!
Contact Support