Convert data to character string in AS/400 query

5 pts.
Tags:
AS/400
AS/400 database
AS/400 Query
I use Query400 to output negative temperatures to a database file. The output file is currently created by the query at run time. The data is output as packed but I need the sign separate. I can't see how to convert the temperature to a character string either as the sign is ignored. Any other thoughts?

Answer Wiki

Thanks. We'll let you know when a new response is added.

I’m not sure what you are doing with the data that you need the sign separate.

If that’s the case a quick fix is run 2 queries.
First extracting negative temps and define a field sign and set it to ‘ – ‘.

Then extract positive temps and define a field sign and set it to ‘ + ‘.
Then add these results to the ouput file from the first.

Just a thought..

If this is for long term use a program would be the best solution

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Splat
    I'd dump the query & throw together a quick program over a permanent file (if you have to have the data separated by day, look into multiple members). With a program and an externally defined file you'd have the ability to define the output any way you like.
    7,235 pointsBadges:
    report
  • TomLiotta
    The data is output as packed but I need the sign separate. I don't know what that means. What do you expect to do with a 'separate' sign? Are you trying to obtain the "absolute value" of the temperature? This might be possible with Query/400, but I don't know how it could be done. You could convert it to a character value, but I don't see any good way to access the sign by itself. Personally, I wouldn't use Query/400 at all. If you really need the sign separated, you could do it with a QM query. You might even do it as a VIEW. If you used a VIEW to expose a "Sign" column, you could use any query tool to process it. Tom
    125,585 pointsBadges:
    report
  • ToddN2000
    Dumb question, but if you are outputting just negative numbers to your file then why do you need the sign at all. They should all be negative correct ?
    11,190 pointsBadges:
    report
  • ToddN2000
    I did not mean your question was dumb. May I am just misunderstanding it or contributing it to being Monday after a long weekend. It seems self explanitory.
    11,190 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following