ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Query 400 Question

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

  • Query 400 Question

    Hello,

    TEST HSTTRANDSC
    LGLTBA BDTRLGLTBA YYCO
    XXX 00 0000 XXXX 0000000405759
    0000
    174 00 L174 0000000405759
    20040109

    How do I accomplish this with query 400. I am trying to pull out the records in this file where every character in the field TEST is populated with a character. For example. In the above records I would only pull out the following record because the test is populated with all characters.

    TEST HSTTRANDSC
    LGLTBA BDTRLGLTBA YYCO

    Thanks,

    DAC

  • #2
    Re: Query 400 Question

    create a result field 1 *char long using substr.
    then check to see all <> *blanks.
    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: Query 400 Question

      Hi dcutaia:

      If this is a QRY400 question (not sql)

      under the select records option

      Code:
      testfld     nlike '% %'
      That will get you all positions in the field filled in. If they must be non numeric
      Code:
          testfld    nlike '% %'
      and testfld    nlike '%0%'
      and testfld    nlike '%1%'
      etc
      Best of luck
      GLS
      The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

      Comment


      • #4
        Re: Query 400 Question

        Hello

        In define result fields:
        PHP Code:
        CHAR1       substr(testfld,1,1)
        CHAR2       substr(testfld,2,1)
        CHAR3       substr(testfld,3,1)
        CHAR4       substr(testfld,4,1
        In Select Records:
        PHP Code:
        CHAR1             RANGE  'a' 'Z'
        CHAR2             RANGE  'a' 'Z'
        CHAR3             RANGE  'a' 'Z'
        CHAR4             RANGE  'a' 'Z' 

        Comment

        Working...
        X