Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
asking for COBOL program for STCKCONV

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Gary Lin
Warnings : 1

New User


Joined: 08 Mar 2009
Posts: 15
Location: Taipei, Taiwan

PostPosted: Fri Jul 24, 2009 8:34 am    Post subject: asking for COBOL program for STCKCONV
Reply with quote

is anyone have a COBOL program which will do the function like the assembler STCKCONV ?
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Jul 24, 2009 10:21 am    Post subject:
Reply with quote

Hello,

Doubtful as cobol does not have STore ClocK (stck) capability. Why not just use the assembler macro in a small module as is?
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2504
Location: Atlanta, Georgia, USA

PostPosted: Sat Jul 25, 2009 9:31 pm    Post subject: Reply to: asking for COBOL program for STCKCONV
Reply with quote

Gary,

I dug up this COBOL code (TODCONV), so give it a try or adjust as needed. The minimum version/release is COBOL/370 as this code uses FUNCTION's and it converts an existing STCK value, passed in WS-TOD-DWORD -

Code:

           03  WS-CCYYMMDD         PIC  9(008).                           
           03  WS-CCYYMMDD-X       REDEFINES WS-CCYYMMDD                 
                                   PIC  X(008).                           
           03  WS-HHMMSS           PIC  9(006).                           
           03  FILLER              REDEFINES WS-HHMMSS.                   
               05  WS-TIME-HH      PIC  9(002).                           
               05  WS-TIME-MM      PIC  9(002).                           
               05  WS-TIME-SS      PIC  9(002).                           
           03  WS-MSECS-PACKED     PIC S9(015)     PACKED-DECIMAL.       
           03  WS-MSECS-PACKED-X   REDEFINES WS-MSECS-PACKED             
                                   PIC  X(008).                           
           03  WS-DWORD            PIC S9(015)     PACKED-DECIMAL.       
           03  WS-DWORD-X          REDEFINES WS-DWORD                     
                                   PIC  X(008).                           
           03  WS-TOD-DWORD        PIC S9(018)     BINARY.               
           03  WS-TOD-DWORD-X      REDEFINES WS-TOD-DWORD                 
                                   PIC  X(008).                           
           03  WS-BINARY-DWORD     PIC S9(018)     BINARY.               
           03  WS-BINARY-DWORD-X   REDEFINES WS-BINARY-DWORD             
                                   PIC  X(008).                           
           03  WS-INTEGER-OF-DATE  PIC S9(009)     PACKED-DECIMAL.       
           03  WS-SAVE-MSECS       PIC S9(015)     PACKED-DECIMAL.       
           03  WS-SAVE-MSECS-X     REDEFINES WS-SAVE-MSECS               
                                   PIC  X(008).                           
           03  WS-DBLWORD          PIC S9(015)     PACKED-DECIMAL.       
           03  WS-DBLWORD-X        REDEFINES WS-DBLWORD                   
                                   PIC  X(008).                           
           03  WS-CALC-SECS        PIC S9(015)     PACKED-DECIMAL.       
           03  WS-CALC-SECS-V999   REDEFINES WS-CALC-SECS                 
                                   PIC S9(012)V999 PACKED-DECIMAL.       
           03  WS-CALC-SECS-X      REDEFINES WS-CALC-SECS                 
                                   PIC  X(008).                           
      *                                                                   
      *    FIRST, SHIFT-RIGHT ONE-BYTE, THEN SHIFT-RIGHT 4-BITS. DIVIDE   
      *    THE BINARY-DOUBLEWORD BY 60000000 WITH THE RESULTING DIVIDEND 
      *    IN 'WS-DWORD' AND THE REMAINDER IN 'WS-DBLWORD'. ADJUST BOTH   
      *    OF THESE PACKED-DOUBLEWORDS ACCORDINGLY AND CALCULATE INTO     
      *    'WS-MSECS-PACKED' AND YOU'LL NOW HAVE NUMBER OF MILLISECONDS   
      *    SINCE JANUARY 1, 1900.                                         
      *                                                                   
      *    NOTE THAT DIVIDING THE BINARY-DOUBLEWORD BY 4096 (TO SHIFT     
      *    RIGHT 12-BITS) _W I L L_ RESULT IN A S0C7. SO, THIS IS THE     
      *    REASON FOR THE RIGHT-SHIFTING OF ONE-BYTE FOLLOWED BY THE     
      *    RIGHT-SHIFTING OF 4-BITS (DIVIDE DOUBLEWORD BY 16).           
      *                                                                   
      *    WHEN ALL IS SAID AND DONE, WS-CCYYMMDD WILL CONTAIN THE       
      *    DATE AND WS-HHMMSS WILL CONTAIN THE TIME.                     
      *                                                                   
           MOVE LOW-VALUE              TO WS-BINARY-DWORD-X (1:1).       
           MOVE WS-TOD-DWORD-X         TO WS-BINARY-DWORD-X (2:).         
           COMPUTE WS-BINARY-DWORD     = (WS-BINARY-DWORD / 16).         
           DIVIDE  WS-BINARY-DWORD     BY 60000000                       
                                       GIVING WS-DWORD                   
                                       REMAINDER WS-DBLWORD.             
           COMPUTE WS-MSECS-PACKED     = (WS-DWORD * 60000) +             
                                         (WS-DBLWORD / 1000).             
           MOVE WS-MSECS-PACKED        TO WS-SAVE-MSECS.                 
           COMPUTE WS-DBLWORD          = (WS-SAVE-MSECS / 86400000).     
           COMPUTE WS-INTEGER-OF-DATE  = (WS-DBLWORD + 109208).           
           COMPUTE WS-CALC-SECS        = (WS-SAVE-MSECS -                 
                                         (WS-DBLWORD * 86400000)).       
           MOVE WS-CALC-SECS-V999      TO WS-DBLWORD.                     
           MOVE WS-DBLWORD             TO WS-CALC-SECS.                   
      *                                                                   
           IF  WS-SAVE-MSECS-X (7:1) > X'49'                   
               ADD  1                  TO WS-CALC-SECS                   
           END-IF.                                                       
      *                                                                   
           COMPUTE WS-TIME-HH          = (WS-CALC-SECS / 3600).           
           COMPUTE WS-CALC-SECS        = (WS-CALC-SECS -                 
                                         (WS-TIME-HH * 3600)).           
           COMPUTE WS-TIME-MM          = (WS-CALC-SECS / 60).             
           COMPUTE WS-TIME-SS          = (WS-CALC-SECS -                 
                                         (WS-TIME-MM * 60)).             
           COMPUTE WS-CCYYMMDD         = FUNCTION DATE-OF-INTEGER         
                                             (WS-INTEGER-OF-DATE).       

FWIW, adding 109208 to WS-DBLWORD will yield the number of days since 1 January 1601 and 1 January 1900.

HTH....

Bill
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2504
Location: Atlanta, Georgia, USA

PostPosted: Sat Jul 25, 2009 9:46 pm    Post subject: Reply to: asking for COBOL program for STCKCONV
Reply with quote

Gary,

In my previous post -

"FWIW, adding 109208 to WS-DBLWORD will yield the number of days since 1 January 1601 and 1 January 1900." is not a true statement. What it will do is to calculate the CCYYMMDD associated with your converted STCK <---> Millisecond value.

Bill
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sun Jul 26, 2009 1:36 am    Post subject:
Reply with quote

Hi Bill,

How does the calculation code obtain this vaue (WS-TOD-DWORD)?
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2504
Location: Atlanta, Georgia, USA

PostPosted: Sun Jul 26, 2009 1:57 am    Post subject: Reply to: asking for COBOL program for STCKCONV
Reply with quote

Dick,

Oops, that's the input STCK value to be converted. icon_redface.gif

I wrote it over five years ago and I hope it still works!

Bill
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sun Jul 26, 2009 5:25 am    Post subject:
Reply with quote

Hi Bill,

Quote:
I wrote it over five years ago and I hope it still works!
Should be ok (or we're all in big trouble if code gets "dusty" and clogs after sitting around for a while icon_smile.gif ).

Now, if there was just a cobol function for stck/stcke. . . .
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts Accessing CICS tran with map from JCL... navdeepaggarwal CICS 5 Tue Oct 03, 2017 6:15 pm
No new posts Assembler Macro Copybook converted to... Ziquilix PL/I & Assembler 4 Tue Sep 26, 2017 3:07 am
This topic is locked: you cannot edit posts or make replies. Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us