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
 
Execute instruction with UNPK

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
View previous topic :: :: View next topic  
Author Message
Harsh Pawar

New User


Joined: 04 Jun 2008
Posts: 25
Location: Noida

PostPosted: Wed Apr 15, 2009 6:21 pm    Post subject: Execute instruction with UNPK
Reply with quote

Hi,
I have a requirement of unpacking a doubleword.
The double word can contain anything varying from 1 to 999999999 (packed value). Since the value is not fixed i am using EXECUTE instruction as shown below:
PS: R08 has value acording to XYZ. e.g if XYZ = 999 then R08=2


EX R08,UNPKXYZ


UNPKXYZ UNPK ABC+10(*-*),XYZ


ABC DS XL30
XYZ DS D

This logic worked in Pack but it is not working for UNPK.
Kindly help.

Regards,
Harry
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8154
Location: East Dubuque, Illinois, USA

PostPosted: Wed Apr 15, 2009 6:53 pm    Post subject:
Reply with quote

Can you show an example or two of ABC and XYZ and what you mean when you say "it is not working" -- do you mean compiler error, run-time error, or the results you get are not what you expected (3 very different "not working" things that could have very different solutions)?
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Wed Apr 15, 2009 7:05 pm    Post subject:
Reply with quote

Hex display the double word XYZ when it contains your example of 999.
Which one is it?
99000000
9C000000
or
00000099
0000009C
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8154
Location: East Dubuque, Illinois, USA

PostPosted: Wed Apr 15, 2009 7:08 pm    Post subject:
Reply with quote

or even
Code:
0000000E
00000037
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: Wed Apr 15, 2009 7:15 pm    Post subject: Reply to: Execute instruction with UNPK
Reply with quote

I believe you mean dblword XYZ = PL8'999'?

FWIW, I'd use 0 (this is more clear for the next person) as the length for operand-1 and if R8 = F'2', then the UNPK should work, with a result of X'F9F9C9'. But, to avoid the X'C9', OI the last byte of the dblword with X'0F' before unpacking.

An EX against an UNPK (as well as most/all SS instructions) only OR's the length of Operand-1. icon_sad.gif

HTH....

Regards,
Back to top
View user's profile Send private message
Harsh Pawar

New User


Joined: 04 Jun 2008
Posts: 25
Location: Noida

PostPosted: Wed Apr 15, 2009 7:53 pm    Post subject: Reply to: Execute instruction with UNPK
Reply with quote

Sorry for the confusion, let me rephrase the logic with an example.

We have a field Emp-Id which used to be 5 digits only, so my code was using
UNPK ABC+10(5),XYZ and the logic is giving expected o\p i.e:

ABC=EMPLOYEEID12345

Now i want employee-id to include more than 5 digits as well,for this i am using EX instruction.

So i calculated the length of value inside XYZ(if XYZ=000000000123456C the length is 6).

R08 contains 6 -1 = 5 ........ subtracted 1 for machine inst.

LA R08,5

1)
EX R08,UNPKXYZ
UNPKXYZ UNPK ABC+10(*-*),XYZ

when i run above code i get EMPLOYEEID6.
which should have been ABC=EMPLOYEEID123456 since R08 value is 5.

2)
When i tried following code:

UNPK ABC+10(6),XYZ

i am getting correct output
ABC=EMPLOYEEID123456.


But i want to make dynamic and it should work for employee-id having 5 to 10 digits.

PS: The code is not giving any compilation error, there is some flaw in the logic.

Thanks again for showing your interest in this.

Regards,
Harry.
[/i]
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10309
Location: italy

PostPosted: Wed Apr 15, 2009 8:22 pm    Post subject: Reply to: Execute instruction with UNPK
Reply with quote

the EX instruction will or the second byte of the executed instruction full stop

it' s up to you to build it accordingly to the executed instruction specification
for a SS instructions
4 bits for the first operand length and 4 bits for the second one

code snippet ( review as required )

Code:

         ...
         la   Xreg,lenght1
         bctr Xreg,0
         sll  Xreg,4
         la   Wreg,length2
         bctr Wreg,0
         or   Xreg,Wreg
         ex   Xreg,unpk
         ...
unpk     unpk target(0),source(0)
source   ds   ...
target   ds   ...
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: Wed Apr 15, 2009 8:34 pm    Post subject: Reply to: Execute instruction with UNPK
Reply with quote

Enrico,

I stand humbly corrected. Having only used EX in the past on MVC's, XC's and OC's, I made a bad assumption on an SS with an operand-2 length, which the aforementioned instructions don't have. I should have consulted The POPS manual beforehand.

Slowly wiping egg from face icon_redface.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10309
Location: italy

PostPosted: Wed Apr 15, 2009 8:52 pm    Post subject: Reply to: Execute instruction with UNPK
Reply with quote

Hi Bill !
my remarks were not on reply to Your post icon_biggrin.gif,
I was simply reminding the TS about the workings of the EX instruction ,the quirks of SS instructions
and why he was not getting the expected results

cheers
Back to top
View user's profile Send private message
quest2008

New User


Joined: 12 Jun 2008
Posts: 22
Location: bangalore

PostPosted: Thu Apr 16, 2009 5:39 pm    Post subject:
Reply with quote

Harry ,

If R08 contains the length for XYZ and R07 contains the length for ABC

Decrement the length for both registers by 1.


Here ABC is the first operand and XYZ is the second operand of the UNPK instruction.

Shift bits left for R07 by 4 bits.


Use SLL R07,4 and get the length of both operands in last one byte of R07. You can do this by AR R07,R08 or use OR R07,R08 will work as indicated above by enrico.
BCTR R08,0
BCTR R07,0
SLL R07,4
AR R07,R08
EX R07,UNPKXYZ


UNPKXYZ UNPK ABC+10(0),XYZ(0)


ABC DS XL30
XYZ DS D


Ensure that XYZ will have data in packed format. Other wise you may face abend at UNPK instruction.


Thanks
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: Thu Apr 16, 2009 6:50 pm    Post subject:
Reply with quote

Quest200 said -
quest2008 wrote:

Ensure that XYZ will have data in packed format. Other wise you may face abend at UNPK instruction.

Unless you have an addressability error or one (or both) of the operand lengths is screwy, then you will never get an error on an UNPK.

If all is OK, you can UNPK any data type....

Regards,
Back to top
View user's profile Send private message
Harsh Pawar

New User


Joined: 04 Jun 2008
Posts: 25
Location: Noida

PostPosted: Thu Apr 16, 2009 9:18 pm    Post subject: Reply to: Execute instruction with UNPK
Reply with quote

I think Bill is right "If all is OK, you can UNPK any data type.... "

I was getting expected result when i used EX with MVC and TRT (without doing SLL Reg,4) so i got confused when i used it the same way with UNPCK.
Actually i missed that MVC and TRT are SS1 type instruction and hence moving the length into register's last byte's last 4 bit will work i.e. (R08=0005 worked).

But UNPCK is SS2 type intruction and we need to take care of both Op1 and Op2's length hence we need to move both the length into last byte of the register.
first 4 bit of last byte is length of Op1 and last 4 bit is length of Op2

Enrico, your suggestion worked and now i am getting expected output.

thank u all !!

Regards,
Harsh
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 -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Execute TSO ACF commands from COBOL-I... supreethi.srid TSO/ISPF 0 Tue Feb 21, 2017 5:19 pm
No new posts execute APP if they are not ADDRESS T... italo_pm CLIST & REXX 3 Fri Aug 12, 2016 2:15 am
No new posts Execute multiple DB2 Load commands in... faizm DB2 4 Wed Aug 03, 2016 12:53 pm
No new posts CEXEC not able to execute if no SLINE... boyti ko CLIST & REXX 2 Wed Apr 13, 2016 4:31 pm
No new posts CALL MACRO EXECUTE FORM - Setting the... sudarshan.srivathsav PL/I & Assembler 7 Tue Feb 09, 2016 10:32 pm

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