Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

Alpha/Num to Numeric in Query/400

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

  • Alpha/Num to Numeric in Query/400

    I have done a search and did not find this.... Our school stores grades in a 3 character field - you can have #'s and alpha/numerics i.e. MX for medical excuse or 100 etc..etc.. Anyway I want to extract just the number grades for later calculations I would just like to know how to convert this 3 postion alpha/numeric field to numeric...Possible in QUERY/400 ?? thanks very much,, Rob

  • #2
    Alpha/Num to Numeric in Query/400

    While it may (or may not) be possible in Query/400, I would recommend using an HLL like RPG or COBOL which is better suited for the task. In RPG you can use the CHECK or TEST opcodes to ensure that a field contains only numeric characters. In COBOL you can use the IF NUMERIC test to achieve the same results. Dave

    Comment


    • #3
      Alpha/Num to Numeric in Query/400

      IN SQL why could you not say Select * from file_name where grade between 0 an 999 ???? HTH BOBH

      Comment


      • #4
        Alpha/Num to Numeric in Query/400

        I need to calculate a weighted GPA adding up all the grades and dividing by the credits....... then determining the student's rank I have taken Dave's advice and written a quick RPG-er was hoping to do in Query but doesn't look like it can be done-- thanks Rob

        Comment


        • #5
          Alpha/Num to Numeric in Query/400

          Using query: On the select records screen, use 'RANGE' as the test code for a field between 000 and 100. Thats assuming numeric grades are right jusified and padded with leading zeros. Otherwise, if you alpha codes contain only alpha letters and no numeric you can say: Field1 LIKE '%1%' or Field2 LIKE '%2%' or ... all the way thru zero.

          Comment


          • #6
            Alpha/Num to Numeric in Query/400

            Robert, It can be done. It's a bit obtuse and has a couple of restrictions. I had never done it before now when I tested it with a six digit/character field. The logic is actually quite simple. Turn the character field into the microseconds portion of a time stamp. CCUSTN microsecond('2000-02-18-01.01.01.' || CCUSTA) In this example, CCUSTA was created by Digits(CCUST). Obviously, any combo will do. I think I have heard the restrictions are that the number must be a whole number in the range of 0 to 999999. Bill (I did a full article about the date calculation capabilities in Query in Midrange Computing around 1995, if you have some old issues look it up) > Bill, > very interesting your instructions for Date manage with Query/400. > One more question: don't you know if there is a keyword in query that allow > me to convert an alphabetic field in a numeric ? (something opposite to the > keyword DIGITS). > Thanks > Claudia

            Comment


            • #7
              Alpha/Num to Numeric in Query/400

              You can't do this in Query/400, but IQ from New Generation Software should be able to handle it. IQ is what Query/400 should have been.
              Our school stores grades in a 3 character field - you can have #'s and alpha/numerics i.e. MX for medical excuse or 100 etc..etc.. Anyway I want to extract just the number grades for later calculations I would just like to know how to convert this 3 postion alpha/numeric field to numeric...Possible in QUERY/400 ?? thanks very much,,

              Comment

              Working...
              X