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

Compare first byte higher nibble of two character fields


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

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Thu May 20, 2010 5:24 pm
Reply with quote

Hi,

I want to compare first byte higher nibble of two character fields.

Could you please suggest me which instruction I can use for this?

Thanks in advance.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu May 20, 2010 5:43 pm
Reply with quote

Quote:
Could you please suggest me which instruction I can use for this?
Could you please suggest us which LANGUAGE you're planning on using for this?
Back to top
View user's profile Send private message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Thu May 20, 2010 6:02 pm
Reply with quote

Hi Robert,

I am very very sorry.

I want to do this with Assembler.

Thanks!
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: Thu May 20, 2010 6:05 pm
Reply with quote

Try this -

Code:

WORKAREA DS    CL2
CHARAREA DS    CL2
*
         XC    WORKAREA,WORKAREA       ENSURE X'00'S
         MVZ   WORKAREA,CHARAREA       MOVE ZONES ONLY
         CLC   WORKAREA+1(1),WORKAREA  ARE THEY EQUAL?
         BNE   NOTEQUAL                NO, BRANCH ACCORDINGLY

This is just one of multiple ways of doing this....

Bill
Back to top
View user's profile Send private message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Thu May 20, 2010 6:13 pm
Reply with quote

Hi Bill,

I understand below two statements how they works.

Code:

         XC    WORKAREA,WORKAREA       ENSURE X'00'S
         MVZ   WORKAREA,CHARAREA       MOVE ZONES ONLY


Can you explain me the execution with an example please?

Thanks,
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: Thu May 20, 2010 6:25 pm
Reply with quote

The MVZ moves each of the high-order nibbles (zones) from the two-bytes defined to CHARAREA, into WORKAREA.

After clearing WORKAREA to X'00's and issuing the MVZ, WORKAREA(1) could equal (for example), X'C0' and WORKAREA+1(1) could equal (for example), X'D0'.

Then, after the CLC (effectively comparing the high-order nibbles of these two bytes because the low-order nibbles are B'0000'), you'll get an EQUAL or NOT EQUAL condition-code.

z/Architecture Reference Summary -

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/download/DZ9ZS004.pdf?DT=20080216193251&XKS=DZ9ZBK08

Bill
Back to top
View user's profile Send private message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Thu May 20, 2010 6:57 pm
Reply with quote

Thank you very much Bill.

I will try this code and will let you know.
Back to top
View user's profile Send private message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Wed May 26, 2010 11:55 am
Reply with quote

Hi,

I have modified my code as per your suggestion. I am getting error at compilation.

My code:

Code:

TMPAGT   DC    CL5'A1234'
INAGENT  DC    CL5'98564'

INAGT1   DC    CL1'0'
TMPAGT1  DC    CL1'0'

          XC    INAGT1,INAGT1
          XC    TMPAGT1,TMPAGT1
          MVZ   INAGT1,INAGENT(1)
          MVZ   TMPAGT1,TMPAGT(1)



I am getting following error message

Code:

000116 0000 0000 0000 00000 00000   121          MVZ   INAGT1,INAGENT(1)
** ASMA173S Delimiter error, expected blank - (1)
** ASMA435I Record 74 in MYID.HLQ2.SOURCE(QSX0780) on volume: IAS791
00011C 0000 0000 0000 00000 00000   122          MVZ   TMPAGT1,TMPAGT(1)
** ASMA173S Delimiter error, expected blank - (1)
** ASMA435I Record 75 in MYID.HLQ2.SOURCE(QSX0780) on volume: IAS791


Could you please tell me why this error is coming?

My intension here is I want to move one byte zone values to INAGT1, TMPAGT1 form INAGENT, TMPAGT respectively.

Thanks in advance!
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed May 26, 2010 12:07 pm
Reply with quote

You did not follow Bill' s suggestions

the mvz instruction uses the lenght of the first operand
so putting an explicit length on the second operand will cause assembler
to complain
-- (1) could be an explicit length or a register ref, anyway it should not be there

You could have found out by looking at the manuals

publib.boulder.ibm.com/infocenter/wdzinfo/v7r0/index.jsp?topic=/com.ibm.ent.asm.zos.doc/topics/fn1pgmst333.htm

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/dz9zr003/7.5.96?ACTION=MATCHES&REQUEST=MVZ&TYPE=FUZZY&SHELF=DZ9ZBK03&DT=20040504121320&CASE=&searchTopic=TOPIC&searchText=TEXT&searchIndex=INDEX&rank=RANK&ScrollTOP=FIRSTHIT#FIRSTHIT
but naturally You were too ..... to look for it Yourself


googling for the message ASMA173S or for IBM MVZ POP
Back to top
View user's profile Send private message
satish.ms10

Active User


Joined: 10 Aug 2009
Posts: 184
Location: India

PostPosted: Wed May 26, 2010 12:29 pm
Reply with quote

Hi,

Thank you very much for your quick reply. My code is working fine with the below change.

Code:
MVZ   INAGT1(1),INAGENT
MVZ   TMPAGT1(1),TMPAGT


Thank you very much once again!
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

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts 10 byte RBA conversion DB2 2
No new posts 10 byte RBA conversion -non applicati... JCL & VSAM 1
Search our Forums:

Back to Top