On 1/9/2012 5:05 PM, Paul Gilmartin wrote:
On 1/9/2012 4:30 PM, Steve Comstock wrote:

calculate interval:

( lmg R2,R5,datetimen pick up end times then start times
slgr R3,R5
slbgr R2,R4
stmg R2,R3,datetimen )

convert interval to format for editing:

( convtod convval=datetimen,etodval=timestart,timetype=dec, x
datetype=yyyymmdd,mf=(e,clist) )

You're confusing me. Isn't the CONVVAL input to CONVTOD in
displayable format, whereas you're passing it a value in ETOD
format, the output from "calculate interval"? CONVTOD will
presume that's a displayable time/date and from there attempt
to convert it to ETODVAL, in ETOD format, giving nonsense.

-- gil


First: none of the services time, stckconv, convtod produce
or accept as input that is displayable: it all needs some
manipulation.


My reading of the docs is thus (I'm doing this mostly for my
own benefit - it helps me re-think things):

TIME gets a value from the time of day (TOD) clock in either
standard or extended (128 bits: ETOD) format and returns it
to a memory location you specify into a 16 byte area you
provide in one of these formats:

8 bytes of time as one of these:

  packed decimal with no sign nybble: hh mm ss th mi ju 00 00

  unsigned 32-bit binary integer (low order bit = .01 second)
     followed by a word of binary zeros

  8 byte binary integer: number of microseconds that have
     elapsed since midnight

  8 byte STCK value (64-bit unsigned integer where bit 51 is
     equivalent to one microsecond)

  128-bit STCKE value (hmm: that's 16 bytes all by itself:
     how does it do that and still return date? never noticed
     that before)


4 bytes of date, in all cases packed decimal with no sign nybble:

  yyyyddd0
  mmddyyyy
  ddmmyyyy
  yyyymmdd


4 bytes reserved


----------------------------

STCKCONV converts a TOD value, either an 8-byte STCK
value or a 16-byte STCKE value and converts it to
a 16-byte area containing time (in one of the first
three formats listed for TIME) and date (as for TIME)


----------------------------

CONVTOD takes a 16 byte area containing time and date
(in one of the first three formats listed for TIME) and
date (as for TIME)) and returns an STCK (8 bytes) or
STCKE (16 bytes) value

----------------------------

OK, given the mysterious uncertainty of TIME when you
request STCKE, my best strategy may be:

* Get TIME as STCK
* Use STCKCONV to convert this value into time / date
    in this format:  hhmmssthmiju00 / yyyymmdd
    and format these for messages

at end of run,

* Get TIME as STCK
* Use STCKCONV to convert this value into time / date
    in this format:  hhmmssthmiju00 / yyyymmdd
    and format these for messages

* Subtract the starting STCK value from the ending STCK
  value to get an interval (these are just 64 bit
  integers, which simplifies other parts of my logic)

* Shift the 64-bit interval value 13 bits to the right
  to get number microseconds in the interval

* Convert to packed and edit the result

---------

What do you think?



--

Kind regards,

-Steve Comstock
The Trainer's Friend, Inc.

303-355-2752
http://www.trainersfriend.com

* To get a good Return on your Investment, first make an investment!
  + Training your people is an excellent investment

* Try our tool for calculating your Return On Investment
    for training dollars at
  http://www.trainersfriend.com/ROI/roi.html

Reply via email to