[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: [sqr-users] Truncated values with PRINT command



Use  print &b_order1 (1, 11, 10) instead and see what happens.  Just a 
thought.  -ag

At 10:27 AM 11/10/2004, you wrote:
>The program I showed was conceptual.  I tried writing
>a small program to isolate the error but it worked
>fine.  I get the field truncation error in the larger
>program, which is writing 57 fields out for a total
>record size of 832 characters.
>
>Forgot to specify some things:
>
>Oracle 9i
>SQR 4.3 (I know - really really old...)
>OpenVMS
>
>I have a few more datapoints to share below:
>
>--- the dragon <ceprn@hotmail.com> wrote:
>
> > I wonder if your data in b_order c_order don't
> > really have 2 leading spaces.
> >   Try putting shows in your procedure before the
> > prints such as
> >
> >    show 'data in column c order = |' &c_order '|'
> >
> > and see what the data really is.  Then ltrim the
> > spaces.
>
> >From Oracle, I've selected the order fields from the
>database, and they are indeed nine characters long,
>with a leading space.  For example:
>
>select '<' || b_order || '>' b_order,
>        length(b_order) len
>   from temp_154536
>
>gives results like this:
>
>B_ORDER         LEN
>---------------------
>< 00000005>     9
>< 00000005>     9
>< 00000001>     9
>
>
>HOWEVER! From within the SQR program I've printed out
>the order fields after the SELECT and they are EIGHT
>characters long, with a leading space.  For example:
>
>         show '&b_order1      <' &b_order1 '>'
>
>results in:
>
>&b_order1      < 0000000>
>
>So it's not the PRINT command but somehow the SELECT
>is losing the last character.  I'm going to
>investigate this further.  Thanks for your suggestions
>so far.
>
> > Also, if you're creating a flat file, I have always
> > found it easier to use
> > the write comand rather than print.
> >
> > I also find the space between b_order and B and
> > c_order and c unexplained.
> > Those columns should be run together without spaces
> > according to your print
> > commands.
>
>The space should not be there - that's the bug I'm
>talking about.  The PRINT command only gives me the
>first 8 characters from the _order fields.  The ninth
>character is left as a blank.
>
>
>
> > peace,
> > clark 'the dragon' willis
> >
> >
> >
> > PSA: Salary <> Slavery. If you earn a salary, your
> > employer is renting your
> > services for 40 hours a week, not purchasing your
> > soul. Your time is the
> > only real finite asset that you have, and once used
> > it can never be
> > recovered, so don't waste it by giving it away.
> >
> > "Time is the coin of your life. It is the only coin
> > you have, and only you
> > can determine how it will be spent. Be careful lest
> > you let other people
> > spend it for you."
> >
> > Carl Sandburg
> > (1878 - 1967)
> >
> >
> >
> > ----Original Message Follows----
> >
> > Sorry about the appearance of my first posting.  It
> > looked fine in Yahoo email and then the SQR UG mail
> > program "cleaned" it up.  Here's a plain-text
> > version
> > where the output looks better:
> >
> > P Mroz <zstringer999@yahoo.com> wrote:I'm having a
> > strange problem when printing output. I'm creating
> > an
> > output file from a table, and some of the fields
> > have
> > the last character truncated. Here's a shortened
> > version of the program (original is very long):
> >
> > begin-report
> >    do get_sorted_data
> > end-report
> >
> > begin-setup
> > no-formfeed
> > page-size 1 832 ! the real version prints out many
> > fields....
> > end-setup
> >
> > begin-procedure get_sorted_data
> > begin-select distinct
> > a &a1
> > b_order &b_order1
> > b &b1
> > c_order &c_order1
> > c &c1
> >    do print_report
> > from mytable
> > order by a, b_order || b || c_order || c
> > end-select
> > end-procedure ! get_sorted_data
> >
> > begin-procedure print_report
> >    print &a1 (1, 1, 10)
> >    print &b_order1 (1, 11, 9)
> >    print &b1 (1, 20, 10)
> >    print &c_order1 (1, 30, 9)
> >    print &c1 (1, 39, 10)
> > new-page
> > end-procedure ! print_report
> >
> >
> > In the table MYTABLE, the columns A, B and C are
> > VARCHAR2(10). The columns B_ORDER and C_ORDER are
> > VARCHAR2(9). The table looks like this:
> >
> > A          B_ORDER   B          C_ORDER   C
> > a1aaaaaaaa  00000011 b1bbbbbbbb  00000020 c1cccccccc
> > a2aaaaaaaa  00000011 b2bbbbbbbb  00000021 c2cccccccc
> > a3aaaaaaaa  00000012 b3bbbbbbbb  00000020 c3cccccccc
> > a4aaaaaaaa  00000012 b4bbbbbbbb  00000021 c4cccccccc
> >
> > Note that the columns B_ORDER and C_ORDER have a
> > leading space. When I run it through the program I
> > get
> > the following output:
> >
> > a1aaaaaaaa 0000001 b1bbbbbbbb 0000002 c1cccccccc
> > a2aaaaaaaa 0000001 b2bbbbbbbb 0000002 c2cccccccc
> > a3aaaaaaaa 0000001 b3bbbbbbbb 0000002 c3cccccccc
> > a4aaaaaaaa 0000001 b4bbbbbbbb 0000002 c4cccccccc
> >
> > The output is in the correct order, but what happens
> > is that the columns B_ORDER and C_ORDER have the
> > last
> > digit truncated.
> >
> > Has anyone seen anything like this before? Sorry if
> > the program seems weird - I've inherited a large
> > legacy application - this is a small piece of it.
> >
> > Thanks for your help,
> > Peter Mroz
> > zstringer999@yahoo.com
> >
> > _______________________________________________
> > sqr-users mailing list
> > sqr-users@sqrug.org
> > http://www.sqrug.org/mailman/listinfo/sqr-users
> >
> >
> >
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > Check out the new Yahoo! Front Page.
> > www.yahoo.com
> >
> >
> >
> > _______________________________________________
> > sqr-users mailing list
> > sqr-users@sqrug.org
> > http://www.sqrug.org/mailman/listinfo/sqr-users
> >
> >
> >
> > _______________________________________________
> > sqr-users mailing list
> > sqr-users@sqrug.org
> > http://www.sqrug.org/mailman/listinfo/sqr-users
> >
>
>
>__________________________________________________
>Do You Yahoo!?
>Tired of spam?  Yahoo! Mail has the best spam protection around
>http://mail.yahoo.com
>
>_______________________________________________
>sqr-users mailing list
>sqr-users@sqrug.org
>http://www.sqrug.org/mailman/listinfo/sqr-users


---------------------------------------------------------------------------------------------------
Antonio G. Guiza                                        mailto:aguiza@pcc.edu
Programmer/Analyst 
503-977-4395
Portland Community College  SY CC-224             fax   503-977-4987
ITS - Systems Development                               http://www.pcc.edu
---------------------------------------------------------------------------------------------------
 


_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users