Retreiving Volume Serial from Device Number



High Level Assembler(HLASM) for MVS & VM & VSE

Retreiving Volume Serial from Device Number

Postby sensuixel » Mon Jan 21, 2013 7:44 pm

Hi Everyone,

Every day, for back-up purpose, we vary offline a large range of devices then do the back-up then put the devices back online.

The Offline/Online part is basically assumed by a MGCR.

We would like to test wether or not the devices are in the desired state,the UCBSCAN macro can retrieve the device's status
from a Volume Serial, but I only have Device Number as Input

Is there any mean to retrieve the volume serial from the device number ?
sensuixel
 
Posts: 58
Joined: Mon Feb 21, 2011 8:55 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Retreiving Volume Serial from Device Number

Postby steve-myers » Mon Jan 21, 2013 8:06 pm

Provided the volume is online, you can retrieve the volume serial from the UCB returned by UCBSCAN. If the volume is offline ... forget it. You can retrieve the device number from the UCB.

How are you going to backup an offline device??????
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: Retreiving Volume Serial from Device Number

Postby sensuixel » Mon Jan 21, 2013 8:24 pm

We put the device offline on one LPAR to put it online on another LPAR then we back it up.

But according to what you say, i cannot test wether a device is Offline ?
sensuixel
 
Posts: 58
Joined: Mon Feb 21, 2011 8:55 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Retreiving Volume Serial from Device Number

Postby steve-myers » Mon Jan 21, 2013 11:19 pm

Look at the UCB definition in IEFUCBOB. Online / offline status is readily available.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: Retreiving Volume Serial from Device Number

Postby sensuixel » Fri Feb 01, 2013 2:28 pm

Thank you, i dit what i need using :

TM UCBSTAT,UCBONLI


The most difficult part was to "convert" my input from my sysin to binary
e.g my sysin gives me the device numer 794B which is X'F7F9F4C2'
and i need X'794B'.

I managed to convert it by using two TR and MVN

*- CONVERSION X'F7F4F9FB' ==> X'0709040B'                         
         TR    DEVNUM1,HEXTR                                       
*- CONVERSION DE X'0704090B' ==> X'794B'                             
         LA    R2,2            R2 = Length of string
         LA    R3,DEVNUM1      R3 = @ of first digit of DEVNUM1   
         LA    R4,DEVNUM1_B    R4 = @ of device number in binary
NEXTCHAR MVC   BYTE0+0(2),0(R3)  read byte/byte                                   
         TR    BYTE1,HEXHI                                         
         MVN   BYTE1,BYTE2                                         
         MVC   0(1,R4),BYTE1   
         LA    R3,2(0,R3)                                           
         LA    R4,1(0,R4)                                           
         BCT   R2,NEXTCHAR                                         
...
BYTE0    DC 0XL2                     
BYTE1    DC XL1'00'  HIGH-ORDER BYTE
BYTE2    DC XL1'00'  LOW-ORDER  BYTE
*- Table pour TR :                                   
*-                                                   
*- But : change C'794B' X'FFFC'  ==> '0000'         
*-                         7942        749B         
*-                                                   
HEXTR  DC 0CL256                                     
       DC XL16'FF' 00-0F                             
       DC XL16'FF' 10-1F                             
       DC XL16'FF' 20-2F                             
       DC XL16'FF' 30-3F                             
       DC XL16'FF' 40-4F                             
       DC XL16'FF' 50-5F                             
       DC XL16'FF' 60-6F                             
       DC XL16'FF' 70-7F                             
       DC XL16'FF' 80-8F                             
       DC XL16'FF' 90-9F                             
       DC XL16'FF' A0-AF                             
       DC XL16'FF' B0-BF                             
*-          -0-1-2-3-4-5-6-7-8-9-A-B-C-D-E-F         
       DC X'FF0A0B0C0D0E0FFFFFFFFFFFFFFFFFFF' C0-CF 
...
*- But : change  X'0000'  ==> '74'                       
*-                 749B        9B                       
*-                                                       
HEXHI  DC 0CL256                                         
*-          -0-1-2-3-4-5-6-7-8-9-A-B-C-D-E-F             
       DC XL16'00102030405060708090A0B0C0D0E0F0' 00-0F   
       DC XL16'FF' 10-1F                                 
       DC XL16'FF' 20-2F                                 
       DC XL16'FF' 30-3F                                 
       DC XL16'FF' 40-4F                                 
       DC XL16'FF' 50-5F                                 
       DC XL16'FF' 60-6F                                 
       DC XL16'FF' 70-7F                                 
       DC XL16'FF' 80-8F                                 
       DC XL16'FF' 90-9F                                 
       DC XL16'FF' A0-AF                                 
       DC XL16'FF' B0-BF                                 
       DC XL16'FF' C0-CF                                 
       DC XL16'FF' D0-DF                                 
       DC XL16'FF' E0-EF                         
       DC XL16'FF' F0-FF       
sensuixel
 
Posts: 58
Joined: Mon Feb 21, 2011 8:55 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Retreiving Volume Serial from Device Number

Postby enrico-sorichetti » Fri Feb 01, 2013 2:54 pm

one translate and one pack instruction are more than enough ...
add one extra byte ...

the pack instruction is pretty dumb and is very good for smart trick
as per POP pack flips the less significant byte and ignores the 4 high order bits of the rest

                            char        hex
input                       123a        f1f2f3c1
after the translate                     0102030a
5bytes for the pack                     0102030axy
pack 3bytes,5bytes
3bytes after the pack                   123ayx

the first two bytes contain what You ask for
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: Retreiving Volume Serial from Device Number

Postby sensuixel » Fri Feb 01, 2013 3:08 pm

Your method is way less heavier than mine, thank you ;)
sensuixel
 
Posts: 58
Joined: Mon Feb 21, 2011 8:55 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Retreiving Volume Serial from Device Number

Postby steve-myers » Fri Feb 01, 2013 8:09 pm

The only potential gotcha with Mr. Sorichetti's method is the extra bytes after the after the input and output fields in the PACK instruction. You have to provide the extra byte for the first operand, or save and restore its contents. For the second operand, especially, it's all to easy to S0C4, which has happened to me.

I remember once I was trying to demonstrate the S0C4. After several tries it refused to S0C4 for me. Months later - unintentionally - I got the S0C4!
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: Retreiving Volume Serial from Device Number

Postby enrico-sorichetti » Fri Feb 01, 2013 8:25 pm

but it could also be done using registers without any intermediate <working storage>

here is a macro for the other way around

         MACRO
&NAME    $CVRX &R,&LOC,&LEN=8,&WORKREG=14
.*--------------------------------------------------------------------*
.*  THIS MACRO  CONVERTS THE CONTENTS OF A REGISTER TO HEX DISPLAY    *
.*             REGISTERS  0,1,14 ARE DESTROYED                        *
.*--------------------------------------------------------------------*
         LCLC  &MNAME,&C
         AIF   ('&LOC'(1,1) EQ '(' AND '&LOC'(K'&LOC,1) EQ ')').A1
&C       SETC  '&LOC'.'+&LEN'    .TARGET NAME IS NOT A REGISTER
         AGO   .A2
.A1      ANOP
&C       SETC  '&LEN'.'&LOC'
.A2      ANOP
&MNAME   SETC  'IHB'.'&SYSNDX'
&NAME    LA    1,&C               .TARGET LOW ORDER BYTE
         LA    0,&LEN             .DO WHILE (R0 > 0 & R0 <= 8)
         LR    &WORKREG,&R        .GET REGISTER CONTENTS
&MNAME.A DS    0H
         BCTR  1,0                .AROUND & AROUND
         STC   &WORKREG,0(1)      .WORK ON LOW ORDER NIBBLE
         SRL   &WORKREG,4         .SHIFT TO NEXT NIBBLE
         BCT   0,&MNAME.A         .ENDDO
         NC    0(&LEN,1),=&LEN.X'0F'     .DROP HIGH BITS
         TR    0(&LEN,1),=C'0123456789ABCDEF'   .TRANSLATE
         MEND
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: Retreiving Volume Serial from Device Number

Postby enrico-sorichetti » Sat Feb 02, 2013 7:12 am

and since I am in a very good mood here is the conversion asked by the TS

 EDIT       ENRICO.MACLIB($CVXR) - 01.07                    Columns 00001 00072
 Command ===>                                                  Scroll ===> CSR
 ****** ***************************** Top of Data ******************************
 000001          MACRO
 000002 &NAME    $CVXR &R,&LOC,&LEN=8
 000003 .*--------------------------------------------------------------------*
 000004 .*  THIS MACRO  CONVERTS HEX DISPLAY STRING TO A REGISTER             *
 000005 .*             REGISTERS  0,1,14,15 ARE DESTROYED                     *
 000006 .*--------------------------------------------------------------------*
 000007          LCLC  &MNAME,&C
 000008          AIF   ('&LOC'(1,1) EQ '(' AND '&LOC'(K'&LOC,1) EQ ')').A1
 000009 &C       SETC  '&LOC'             .SOURCE NAME IS NOT A REGISTER
 000010          AGO   .A2
 000011 .A1      ANOP
 000012 &C       SETC  '0'.'&LOC'
 000013 .A2      ANOP
 000014 &MNAME   SETC  'IHB'.'&SYSNDX'
 000015 &NAME    LA    1,&C               .SOURCE LOW ORDER BYTE
 000016          BCTR  1,0
 000017          LA    0,&LEN             .DO WHILE (R0 > 0 & R0 <= 8)
 000018          XR    14,14              .CLEAR WORK REG1
 000019          XR    15,15              .CLEAR WORK REG2
 000020 &MNAME.A DS    0H
 000021          LA    1,1(,1)            .AROUND & AROUND
 000022          XR    15,15              .CLEAR WORK REG2
 000023          IC    15,0(1)            .WORK ON LOW ORDER NIBBLE
 000024          C     15,=F'240'         .COMPARE WITH 0 X'F0'
 000025          BNL   &MNAME.B           .IF >= IS A NUMBER
 000026          S     15,=F'183'         .X'C1' - 183 ==> X'0A'
 000027 &MNAME.B DS    0H
 000028          N     15,=F'15'          .CLEAR HIGH ORDER NIBBLE
 000029          SLL   15,28              .SHIFT TO LEFT SIDE OF R15
 000030          SLDL  14,4               .SHIFT 4 BITS INTO R14
 000031          BCT   0,&MNAME.A         .ENDDO
 000032          LR    &R,14              .TRANSFER RESULT TO DESTINATION
 000033          MEND
 ****** **************************** Bottom of Data ****************************


tested with

          $CVXR 2,F00,LEN=1
          $CVXR 2,F00,LEN=2
          $CVXR 2,F00,LEN=3
          $CVXR 2,F00,LEN=4
          $CVXR 2,F00,LEN=5
          $CVXR 2,F00,LEN=6
          $CVXR 2,F00,LEN=7
          $CVXR 2,F00       lenght 8 default

...
...
...
F00      DC    C'01234567'


to obtain

00000000
00000001
00000012
00000123
00001234
00012345
00123456
01234567


cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Next

Return to Assembler

 


  • Related topics
    Replies
    Views
    Last post