IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How do I coding assembly code for hex data calculate.


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Mansik Kim

New User


Joined: 15 Dec 2006
Posts: 29
Location: Korea

PostPosted: Fri Dec 27, 2013 7:23 am
Reply with quote

Hi All,

I am working SMF read program in assembly.

There was changed hex data length from 4 byte to 8 byte.

So, I need to change my program code for calculate logic.

Please let me have a good samples.

The following code is current and changed code.

Thanks,
Mansik.

========================================
The current program code
========================================
Code:
**********************************************************************
*       SMF DATA READ (FIRST READ)
**********************************************************************
        GET       OF1101                 /* SMF RECORDS
        LR        R6,R1                  /*  R1   ===> R6
        MVC       OR1101(256),0(R6)
*
LOOP1   L         R3,DISPT
            CVD       R3,DX
            AP        DISPT1,DX
*
SKIP4  GET       OF1101                 /* SMF RECORDS
           LR        R6,R1                  /*  R1   ===> R6
*
           MVC       OR1101(256),0(R6)
*
           B         LOOP1
*
DISPT   DS        CL4
*
DISPT1  DC        XL8'000000000000000C'
*
DX        DC        XL8'000000000000000C'
**********************************************************************
*       SMF1101 INPUT AREA DEFINE
**********************************************************************
        DS       0D
OR1101  DS       0CL256
        ..
        ..
DISPT   DS        CL4
        ..
        ..
*

==============================================
The changed (DISPT Length 4 byte ==> 8 byte)
==============================================
Code:
DISPT   DS        CL4
===>
DISPT   DS        CL8


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

CICS Moderator


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

PostPosted: Fri Dec 27, 2013 3:54 pm
Reply with quote

What's the hex-format of the date? Please provide an example and then we'll go from there.
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Fri Dec 27, 2013 4:25 pm
Reply with quote

Bill, the date in SMF is always PL4'0cyyddd' The sign is usually X'F'.

In the last couple of years I've written a lot of Assembler code to read SMF data, but I don't have a clue what the TS is trying to accomplish. The MVC OR1101,0(R6) is likely going to get random S0C4s. If the revised DISPT is supposed to represent the SMF record time and date rather than the date the code is going to get S0C7s as the time is binary time of day in 1/100th seconds. It appears the TS has no clue how to process SMF data.
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Fri Dec 27, 2013 5:07 pm
Reply with quote

This is more correct. Notice the only arithmetic is compares.
Code:
SMFREC   DSECT                     DEFINE A GENERIC SMF RECORD
SMFRECL  DS    2AL2                RECORD LENGTH IN THE RDW   
         DS    BL1                 FLAGS                     
SMFRTYPE DS    AL1                 RECORD TYPE               
SMFRTME  DS    XL4                 RECORD TIME               
SMFRDTE  DS    XL4                 RECORD DATE               

LOOP     GET   SMFDCB
         LR    6,1
         USING SMFREC,6
         CLI   SMFRTYPE,2
         BE    LOOP
         CLI   SMFRTYPE,3
         BE    LOOP
         CP    SMFRDTE,LOWDATE
         BL    NEWLOW
         BH    NOTLOW
         ICM   0,B'1111',SMFRTME
         C     0,LOWTIME
         BNL   NOTLOW
NEWLOW   MVC   LOWDATE,SMFRDTE
         MVC   LOWTIME,SMFRTME
NOTLOW   ...
         B     LOOP
         ...
SMFDCB   DCB   DSORG=PS,MACRF=GL,BFTEK=A,...
LOWTIME  DC    0F'0',X'7FFFFFFF'
LOWDATE  DC    PL4'999365'
The code ignores record types 2 and 3; those records are written by IFASMFDP and do not represent data. I use ICM to load the record time of day into reg 0 because the field is not aligned and this code does not cause an Assembler warning message. LOWDATE and LOWTIME are set very high to make sure the first record will set them with a "real" date and time.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


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

PostPosted: Fri Dec 27, 2013 5:28 pm
Reply with quote

Steve,

I wasn't 100% sure of the date-format and this is why I had asked.

I'm still hoping the TS will post the new 8-Byte format, (rather than taking a SWAG), so that we'll know for sure, even though it's in an SMF record.

Requests such as this have a tendency to completely change. icon_eek.gif

All we can do now is wait.

But, after re-reading the post, I have a question for the TS - IS THIS A DATE OR DATA?

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

CICS Moderator


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

PostPosted: Fri Dec 27, 2013 8:14 pm
Reply with quote

Let's assume at 0(R6), there's 8-Bytes of valid hex-data, which we need to convert to packed-decimal -

Code:

QWORD    DS    L                       QUADWORD-AREA                   
DWORD    DS    D                       DBLWORD-AREA                     
*                                                                       
         MVC   DWORD,0(R6)             POPULATE DBLWORD                 
         LG    R15,DWORD               LOAD GRANDE R15                 
         CVDG  R15,QWORD               MAKE IT 16-BYTES PACKED-DECIMAL                   

At this point QWORD (effectively, a PL16) contains the 16-Byte Packed-Decimal equvilent of the 8 Hex-Bytes which were found at 0(R6).

HTH....
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Sat Dec 28, 2013 1:34 am
Reply with quote

Bill, actually I think this is what you want.
Code:
         TR    QWORD,UNHEXTAB
         PACK  DWORD(5),QWORD(9)   
         PACK  DWORD+4(5),QWORD+8(9)

UNHEXTAB DC    (C'A')X'00',X'0A0B0C0D0E0F'
         DC    (C'0'-(*-UNHEXTAB))X'00',X'00010203040506070809'
         DC    (256-(*-UNHEXTAB))X'00'
QWORD    DC    C'0123456789ABCDEF',C' '
DWORD    DC    XL8'00',X'00'
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


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

PostPosted: Sat Dec 28, 2013 2:08 am
Reply with quote

Steve,

I'm not sure what the TS wants, so I took a SWAG, because I still don't know if it's a DATE or DATA he's after and whether he needs to convert the 8-Bytes of Hex into 16-Bytes of Character or convert the 8-Bytes to Packed-Decimal.

I guess our replies are not that critical because I haven't heard from the TS.

The drama continues.... icon_eek.gif
Back to top
View user's profile Send private message
Mansik Kim

New User


Joined: 15 Dec 2006
Posts: 29
Location: Korea

PostPosted: Sat Dec 28, 2013 9:20 am
Reply with quote

Hi all,

I was already have a SMF read program.
I can read SMF data from assembly include date, time format.

I want to know that 8 byte hex data addition calculate method.

Please let me have a good samples.

Thanks,
Mansik.
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Sat Dec 28, 2013 9:32 am
Reply with quote

Mansik Kim wrote:
... I want to know that 8 byte hex data addition calculate method.
You will have to be more specific. Doing arithmetic on date and times is fairly difficult. Believe me, I speak from experience.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Sun Dec 29, 2013 10:20 pm
Reply with quote

Hello,

You might consider writing the data arithmetic operations in a COBOL module and then invoke it. COBOL has far more tools to work with dates than does assembler.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Mon Dec 30, 2013 4:42 am
Reply with quote

we are getting nowhere
data/date misunderstanding ...
the TS talks about 8 bytes hex data, but the coded samples show 8 bytes PACKED data
???
best thing would be for the TS to tell the SMF record type and the field/variable name
that he is trying to process
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Mon Dec 30, 2013 6:58 am
Reply with quote

Enrico - I agree. If the little sample he gave us is any indication of his real code, he has lots of problems. About the only thing he gave us that is correct is the GET macro - assuming the DCB specifies MACRF=GL,BFTEK=A, which he did not show us.

Spring 2013 I think it was I wrote code to compute elapsed time given an SMF record time and a start time in SMF time of day and date format. The code works, but it is very rough - not something I'd share. I just wrote the equivalent as a closed subroutine, but as I write this it's not working, and even when I get it to work I'm not sure I'd want to share it.
Back to top
View user's profile Send private message
Mansik Kim

New User


Joined: 15 Dec 2006
Posts: 29
Location: Korea

PostPosted: Mon Dec 30, 2013 7:07 am
Reply with quote

Code:
QWORD    DS    L                       QUADWORD-AREA                   
DWORD    DS    D                       DBLWORD-AREA                     
*                                                                       
         MVC   DWORD,0(R6)             POPULATE DBLWORD                 
         LG    R15,DWORD               LOAD GRANDE R15                 
         CVDG  R15,QWORD               MAKE IT 16-BYTES PACKED-DECIMAL

Hi Bill,

Thanks for your reply.

How can I have reference manial about "LG" and "CVDG".

I can't find that.

Please let me know.

Thanks,
Mansik.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


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

PostPosted: Mon Dec 30, 2013 7:26 am
Reply with quote

Mansik,

LG and CVDG are two of the many 64-Bit instructions (known as Grande), introduced with HLASM and POPS well over 10 years ago.

The z/OS Principles of Operation manual (The Bible for Assembler programmers) defines these instructions and many others, extensively.

z/OS 1.13 POPS Manual (PDF format) -

publibfi.boulder.ibm.com/epubs/pdf/dz9zr008.pdf

It's around 35MB, so if you have a slow connection, begin the download and go get some breakfast icon_smile.gif

You can also Google these instructions as well....

HTH....
Back to top
View user's profile Send private message
Mansik Kim

New User


Joined: 15 Dec 2006
Posts: 29
Location: Korea

PostPosted: Mon Dec 30, 2013 9:14 am
Reply with quote

Hi Bill,

Thank you for your answer.

I got you upload manual and I try it.

Thanks,
Mansik.
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Mon Dec 30, 2013 12:01 pm
Reply with quote

Bill: the topic starter is leading you down a false trail. The topic starter seems to be convinced the 8 byte data area defined by SMFRTME and SMFRDTE in my first post in this thread is an 8 byte packed decimal data area. This is not true. The first 4 bytes are binary data that represents the time of day in 1/100th of a second from midnight. The second 4 bytes are a date, as a packed decimal number with digits containing PL4'0cyyddd' where c is a century indicator, 0 for 1900 through 1999, and 1 for 2000 through 2099, yy is the year in the century, and ddd is the day of the year, from 001 through 365 or 366 in leap years.

Performing LG/CVDG will work, but the result of the CVDG, for all intents and purposes, will be garbage.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Mon Dec 30, 2013 4:30 pm
Reply with quote

Bill, Steve I didn't see the TS talking about DATE but about DATA.
Even the titel of this topic is : How do I coding assembly code for hex DATA calculation.

In his poor coding example even the the DISPT field is hanging around.

So before you put any effort in this crappy topic, the TS has to do better with explaining which fields from what SMF records he/she wants to process.
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Mon Dec 30, 2013 5:03 pm
Reply with quote

Peter. Agreed. I'm not going to comment any more until this Mansik Kim defines his input correctly.
Back to top
View user's profile Send private message
Mansik Kim

New User


Joined: 15 Dec 2006
Posts: 29
Location: Korea

PostPosted: Thu Jan 02, 2014 6:18 pm
Reply with quote

Hi Bill,

I did completed asembly code and SMF data read test successfull.

Thank you for your answer.

Mansik.
Back to top
View user's profile Send private message
Mansik Kim

New User


Joined: 15 Dec 2006
Posts: 29
Location: Korea

PostPosted: Thu Jan 02, 2014 6:37 pm
Reply with quote

Hi Bill,

I have more question.

How can I post assem code witch display 3270 screen mode.

Please let me know.

Thanks,
Mansik.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Thu Jan 02, 2014 7:07 pm
Reply with quote

Hello,

This question is not clear. . .

Do you mean you want to show some of your code from am edit/view screen?

If yes, copy/paste the screen data and paste into your reply here. Then apply the Code Tag to improve readabilit and preserve alignment.

If this is not what you mean, please clarify.
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Thu Jan 02, 2014 11:00 pm
Reply with quote

When you specify "code" brackets, you click on the code block just above the reply area. You will see a left square bracket code code right square bracket in the reply area. Enter the text you want displayed and then type left square bracket /code right square bracket.
Code:
Like this
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2454
Location: Hampshire, UK

PostPosted: Thu Jan 02, 2014 11:07 pm
Reply with quote

Note that the Code button is not available with the Quick Reply editor so you need to click on Preview and that will do it.

You can also selct the text to be "coded" and then click the Code button and it will insert start and end tags.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1248
Location: Richfield, MN, USA

PostPosted: Thu Jan 02, 2014 11:25 pm
Reply with quote

Quote:
Note that the Code button is not available with the Quick Reply editor
It's not? It seems to be available to me. Maybe I'm doing something different?
Code:
This is using the Code button.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts db2 vs static data COBOL Programming 1
No new posts External data queue (changes?) CLIST & REXX 0
No new posts Pull data using date difference betwe... DB2 6
No new posts fast data scrambling PL/I & Assembler 10
No new posts How to save SYSLOG as text data via P... All Other Mainframe Topics 4
Search our Forums:

Back to Top