× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Just to close this out...

I ended up using a case statement. When value < 0, concat a hyphen in front of the trimmed char(number) value and I cast the whole thing to char(15).

Quick to implement and easy to understand.

Roger Harman
COMMON Certified Application Developer – ILE RPG on IBM i on Power







-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of Vernon Hamberg
Sent: Tuesday, June 02, 2020 8:24 PM
To: Midrange Systems Technical Discussion
Subject: Re: Leading minus sign in QMQRY result?

Hi Roger

I just tried this - the sign in the the outfile is displayed on the
right - now that makes some sense, since neither a packed or zoned
column has a visible sign, right?

I had the idea that I could override the QPQXPRTF (that's what QM uses
for *PRINT) with a PF - it wouldn't even take it. The reason I tried it
was, the sign would be on the left in the SPLF, could I get it to go to
a text file automatically.

Now another thought - CPYTOIMPF, is there an FDF spec that could make
the formatting be what you want?

The other idea is something others have mentioned - use the SQL in QM to
put all the stuff together as CSV - something like this -

select '"' || strip(replace('"', charfld, '""')) || '"' || ','
varchar_format(numfld, 'format_string') from somefile

I put in the replace() function to double up any embedded full quotes.

varchar_format can give you a character representation with lots of options.

With this one, you would use the CPY IFS command to populate the CSV file.

You could maybe just do the varchar_format for that numeric field, then
the CPYTOIMPF would just take care of the rest.

How's that for late-nightish thoughts!!

Regards
Vern

On 6/2/2020 9:43 PM, Roger Harman wrote:
Even if it's just going to an outfile? Not sure how that would work. Outfile gets copied to CSV and emailed.

I'll look at it in the morning.

For most of these things, I just use SQL Workbench/J which has XLSX output. But, this is a scheduled daily job.



-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of Peter Dow
Sent: Tuesday, June 02, 2020 4:45 PM
To: midrange-l@xxxxxxxxxxxxxxxxxx
Subject: Re: Leading minus sign in QMQRY result?

Hi Roger,

As I recall, you have to create a QM Report Form (STRQM option 2). That
form will let you specify edit codes for numeric columns among other
things.  I think P is for leading minus.

Then when you run the query, you specify the name of the form.

--
*Peter Dow* /
Dow Software Services, Inc.
909 793-9050
petercdow@xxxxxxxxx <mailto:petercdow@xxxxxxxxx>
pdow@xxxxxxxxxxxxxx <mailto:pdow@xxxxxxxxxxxxxx> /

On 6/2/2020 4:36 PM, Roger Harman wrote:
This shouldn't be baffling me as much as it is but it's been quite a day....

I have a QM Query object that I need to change to have a leading minus instead of trailing in a particular column.  Is there an easy way to do this?  It's escaping me at the moment.

V7R2

Thanks.

Roger Harman
COMMON Certified Application Developer - ILE RPG on IBM i on Power









As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.