>>>>> "BM" == Bob Mariotti <[EMAIL PROTECTED]> writes:

  BM> Uri;
  BM> Thanks for the suggestion.  I "think" I am understanding it so early
  BM> this morning but my brain is tired.

  BM> Here's what the modified code products for a test:

  BM> 0000  20 2D 30 30 30 31 32 33 34 35 20 2D 30 30 31 32 * -00012345
  BM> -0012* 0010  33 34 F5 20 0A 00 00 00 00 00 00 00 00 00 00 00
  BM> *34. ............*

that looks like od output. please don't word wrap it as it makes it hard
to read.

  BM> and here's the modified code:

  BM> my $AMT=123.45;
  BM> $AMT=0-$AMT;

don't use negative numbers. this is a formatting issue and not a number
issue. just set a flag if the number has a trailing - char. you cannot
format negative numbers. you format the positive version and add the
minus char/byte stuff later.

and if you did want to negate a number, you don't need to subtract from
0. just -$AMT is fine.

and don't use all upper case for variable names. that is reserved (by
convention) for constant values.

  BM> $AMT=~s/\.//g;

you don't strip , there as you needed in your previous post. tr is
faster for stripping chars than s///.

  BM> open(OFH,">test") or die $!;
  BM> my $OTR=pack("A A9 A A9"," ", sprintf("%09d",$AMT)," ",
  BM> sprintf("%08d",$AMT)| "\0" x 7 . "\xd0",
  BM> );

that pack doesn't gain you anything. you could have just used join '' or
. and gotten the same results.

  BM> print OFH $OTR, "\n";

and where is the output? you should put it here and not in the
beginning.

your bug is the leading - char as i keep telling you. DO NOT NEGATE THE
VALUE! it throws off the pad sizes i put in there so you modify the
wrong byte. you want a positive number in sprintf so it doesn't print a
leading - char. THEN you mung the last byte to be a negative ebcdic
marker.

  BM> ps: when you guys finally set a date for Damian to present on you tech
  BM> meeting please post early so those of us down here can schedule it in?

that has already been brought up on this list. we have been
debating/voting on what talk he should give. the date is tuesday july
13.

uri

-- 
Uri Guttman  ------  [EMAIL PROTECTED]  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org
_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to