John, as other have said, very well put, thanks! However, I do have one question. Why not use the OFFSET= parameter of the CONVTOD macro to add the OP's time increment to the TOD value they have? Why do it manually?
(More a curiosity than anything else.) Charles (Chuck) Hardee Senior Systems Engineer/Database Administration CCG Information Technology Thermo Fisher Scientific 300 Industry Drive Pittsburgh, PA 15275 Direct: 724-517-2633 FAX: 412-490-9230 [email protected] -----Original Message----- From: IBM Mainframe Assembler List [mailto:[email protected]] On Behalf Of John McKown Sent: Sunday, June 22, 2014 2:25 AM To: [email protected] Subject: Re: Adding 30 seconds to a specific time On Sat, Jun 21, 2014 at 5:37 PM, Ward, Mike S <[email protected]> wrote: > Hello all, I have an assembler program where I get the date and time in > GMT time. The below code seems to work well. Now I want to add 30 seconds > to the time and also adjust the date if necessary. I can't seem to find any > assembler services that will allow me to do that. Can someone please point > me to a routine or an explanation of how I can go about doing this. > > Any help appreciated. > > TIA > > TIME DEC,OUTAREA,LINKAGE=SYSTEM,MF=(E,LIST1), > DATETYPE=MMDDYYYY,ZONE=GMT > UNPK TIMEC,OUTAREA(4) > UNPK DATEC,OUTAREA+8(5) > MVC TIME1,TIMEC > MVC TIME2,TIMEC+2 > MVC TIME3,TIMEC+4 > MVC DATE1,DATEC > MVC DATE2,DATEC+2 > MVC DATE3,DATEC+4 > > Well, there are two approaches There is the "like a human" approach. I would guess that you know how to do this, intuitively by add 30 to minutes and then adjusting all the other values if the minutes are > 60. It is not a very good method. What I would do it look at the CONVSTCK and STCKCONV macros. They can translate to various display formats to STCKE internal format( CONVSTCK). So it is easy. Convert your date/time to an STCKE value. Do a normal 128 bit add of 30 minutes in STCKE value units to it. Then use STCKCONV to convert it back to your display format of choice. Ref: http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IEA2A9B0/88.0 http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IEA2A7A0/30.1 Now, I can hear you asking: What is the STCKE value for 30 minutes??? Well, the wise and helpful people who wrote the POPS manual took pity on us mere mortals and have put a table in the POPS on page 7-317 of the -9 manual for various human values. In particular, one minute is 0x0000_0000_393b_7000_0000_0000_0000_0000 (the book only show the value of bits 0-71, so I pre & ap pended the proper number of 00 values for 128 bits. At least I hope that I did. They also show 1 hour as: 0x0000_000D_693A_4000_0000_0000_0000_0000. 30 minutes is 1/2 of an hour and so is 0x0000_0006_A49D_2000_0000_0000_0000_0000. All of this assuming that I can do bit shifts on paper correctly. ==== Now, in my case, I don't use the above. That is because my HLASM code is LE compliant any more. This means that I can use all the LE subroutines and the C-run time as well. Sometimes, to me, that is easier. I would likely use CEEISEC to convert a date (yyyy, mm, dd, hh, mm, ss) to a "seconds since epoch". Then add 1800 seconds (30 minutes). Then use CEESECI to convert the seconds since epoch back to (yyyy, mm, dd, hh, mm, ss). http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/CEEA31C0/2.2.5.48 http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/CEEA31C0/2.2.5.64 Of course, many still do not like LE. I have "embraced" it for most _application_ usage any more. It has made writing REFR code easier by handling the dynamic "DSA" storage for me. And when used for subroutines, the CEEDUMP from COBOL is more understandable if the assembler is LE compliant. -- There is nothing more pleasant than traveling and meeting new people! Genghis Khan Maranatha! <>< John McKown
