On 4/13/2020 9:08 PM, Charles Mills wrote:
Unless I am confused there is a nasty little bug in several places in the
subject program. If you are using it you might want to fix it. If you are
the person who maintains the tape (Sam Golob?) you might want to fix it, or
if you don't trust me, at least put a note in the program to this effect.

Consider the following subroutine, which takes as a parameter a binary SMF
Seconds*100 timestamp:
        
FmtHHMMSS: Procedure
   Arg SecsX100Bin
   SecsX100 = C2D(SecsX100Bin)                /* Get to Rexx Decimal */
   Hunds    = RIGHT((SecsX100 // 100), 2, 0)  /* Remainder Mod 100 = .hh */
   Work     = Trunc(SecsX100 / 100)           /* Get rid of hundredths */
   Secs     = Right((Work // 60), 2, 0)       /* Remainder Mod 60 = secs */
   Work     = Trunc(Work / 60)                /* Get rid of seconds */
   Mins     = Right((Work // 60), 2, 0)       /* Remainder Mod 60 = Mins */
   Hours    = Right(Trunc(Work / 60), 2, 0)   /* Get rid of minutes=hours*/
   Return Hours || ':' || Mins || ':' || Secs || . || Hunds

Do you see the bug there? ARG is short for PARSE UPPER ARG, and converting a
binary time to upper case introduces a subtle change in the value. There are
several other subroutines with the same problem.

The solution is to change that first line of code to, for example,
SecsX100Bin = Arg(1)

Someone give me a shout if I am wrong.

Charles


Charles,

c All 'arg ' prefix 'parse arg '.

Regards,
Tom Conley

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to