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

Re: I am having a problem with data



Wendy,

Assuming $my_string contains something like '700{', try this:

   let $new_string = translate( $my_string , '{ABCDEFGHI}JKLMNOPQR' ,
                                             '01234567890123456789' )
   let #new_number = to_number( $new_string )
   if instr( '}JKLMNOPQR' , substr($mystring,length($my_string),1) , 1 ) > 0
      let #new_number := - #new_number
   end-if

Ray

PS.  Kate: good call.

> I know of no SQR utility which does this conversion for you.
> But this last digit is a trailing "overpunch" character which
> you can convert on your own before having the value
> treated as a numeric.  You would need to know the
> data positions of all fields falling into this category.
> In fact this trailing overpunch could represent positive
> and negative data in this one byte:
>     700{    = +7000
>     700A   = +7001
>         ...
>     700I     = +7009
>     700}     = -7000
>     700J    = -7001
>         ...
>     700R    = -7009
>
> Basically, the last byte will contain 2 pieces of
> data -- one is the sign, the other is the value between
> 0 and 9.
> > ----------
> > From:         Wendy Stern[SMTP:wstern@NUI.COM]
> > Reply To:     SQR-USERS@USA.NET
> > Sent:         Friday, October 24, 1997 1:49 PM
> > To:   Multiple recipients of list SQR-USERS
> > Subject:      I am having a problem with data
> >
> > I receive data from an outside vender.  It comes from a mainframe
> > computer.  On a numeric field the last bite is {, }, A, B, C, D, E, F,
> > G, H, I, J, L, M, N, O, P, or R.  The number 7000, would come in 700{.
> > The SQR program reads this data as 700.
> > TIA
> > Wendy
> >
>

----------------------------------------------------------------------
Ray Ontko       |  Ray Ontko & Co  |  "Time for a new signature line."
rayo@ontko.com  |  Richmond, In    |  See us at http://www.ontko.com/