ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Free-form syntax of TEST operation

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

  • Free-form syntax of TEST operation

    Am I the only one who doesn't understand the RPGLE Reference Manual with regard to the free-form syntax of the TEST operation?

    If my traditional syntax looks like this:

    *YMD Test(D E) SLENDT
    If %Error

    then how is that represented in free-form? The reference manual shows the syntax this way:

    TEST{(EDTZ)} {dtz-format} field-name

    I'm not clear on how the concept of factor1, factor2, and result are represented in free-form when there is no BIF. I'm familiar with C, C++, C#, and VB so the free-form built-in functions like the one below make perfect sense to me:

    ISONumeric = %Dec(ISODate : *ISO);

    Anybody?

    Thanks in advance...

  • #2
    I think your looking for this

    TEST{(EDTZ)} {dtz-format} field-name

    Test with either or combination of "E" "D" "T" or "Z"

    E = error
    D = date
    T = Time
    Z = TimeStamp

    Then The date format in my example *USA (12/14/2004)

    Then the field with the date in it TempDate.

    Code:
    TempDate = %subst(s2NewOvr:1:8);
    test(de) *usa0 TempDate;

    Hope this helps
    Jimmy

    Comment


    • #3
      Hi Jimmy,

      It's working now. I had already tried the same line of code with one TINY little difference:

      This works:
      Test(DE) *YMD TestDate;

      This does not:
      Test(D E) *YMD TestDate;

      The space between the D and the E! Traditional syntax will compile either way but free-form won't compile with the space. And here I thought I couldn't interpret the syntax.

      Thanks for your help,
      Paul

      Comment

      Working...
      X