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
 
Extract VSAM file attributes from Rexx

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
Bandita Bahubalendra

New User


Joined: 08 May 2008
Posts: 15
Location: Bangalore

PostPosted: Wed May 20, 2009 4:56 pm    Post subject: Extract VSAM file attributes from Rexx
Reply with quote

Hi All,

I want to get the attributes(space-units, space-allocated, space-used) from a VSAM file using REXX. I can do for flat files/PDS using LISTDSI but LISTDSI wil not support VSAM files.

Can anyone help me on this?

It would be great if i see any solution to this.

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

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8620
Location: Back in jolly old England

PostPosted: Wed May 20, 2009 5:21 pm    Post subject:
Reply with quote

This is an old REXX for extracting some VSAM information using CSI. If you want to add more fields then you will have to refer to the manual below for field names and also change the code accordingly.

Click HERE to see the manual for using CSI. Appendix C.

You may also want to investigate DCOLLECT records as a source of information instead.

This was created for batch execution with CATIN DD * supplying the VSAM clusters to be interrogated. It Accepts full * ** % and %% filtering capabilities for CATIN.

Good luck ......................

Code:

/* REXX ** RETURNS VSAM INFO, HARBA, HURBA, PHYRECSZ, RECS/TRK       */
NUMERIC DIGITS(30)
 "EXECIO * DISKR CATIN ( STEM CAT. FINIS"
 DO KCNT = 1 TO CAT.0
 KEY = SUBSTR(CAT.KCNT,1,44)
MODRSNRC = SUBSTR(' ',1,4)
CSIFILTK = SUBSTR(KEY,1,44)
CSICATNM = SUBSTR(' ',1,44)
CSIRESNM = SUBSTR(' ',1,44)
CSIDTYPS = 'C               '
CSICLDI  = SUBSTR('Y',1,1)
CSIRESUM = SUBSTR(' ',1,1)
CSIS1CAT = SUBSTR(' ',1,1)
CSIRESRV = SUBSTR(' ',1,1)
CSINUMEN = '0005'X
CSIFLD1  = 'VOLSER  '
CSIFLD2  = 'HARBADS '
CSIFLD3  = 'HURBADS '
CSIFLD4  = 'PHYBLKSZ'
CSIFLD5  = 'NOBLKTRK'
CSIOPTS  = CSICLDI || CSIRESUM || CSIS1CAT || CSIRESRV
CSIFIELD = CSIFILTK || CSICATNM || CSIRESNM || CSIDTYPS || CSIOPTS
CSIFIELD = CSIFIELD || CSINUMEN || CSIFLD1 || CSIFLD2 || CSIFLD3
CSIFIELD = CSIFIELD || CSIFLD4 || CSIFLD5
WORKLEN = 65536
DWORK = '00001000'X || COPIES('00'X,WORKLEN-4)
RESUME = 'Y'
CATNAMET = SUBSTR(' ',1,44)
DNAMET = SUBSTR(' ',1,44)
DO WHILE RESUME = 'Y'
 ADDRESS LINKPGM 'IGGCSI00  MODRSNRC  CSIFIELD  DWORK'
 RESUME = SUBSTR(CSIFIELD,150,1)
 USEDLEN = C2D(SUBSTR(DWORK,9,4))
 POS1=15
 DO WHILE POS1 < USEDLEN
   IF SUBSTR(DWORK,POS1+1,1) = '0'
    THEN DO
         CATNAME=SUBSTR(DWORK,POS1+2,44)
         IF CATNAME ^= CATNAMET THEN
          DO
           SAY 'CATALOG ' CATNAME
           SAY ' '
           CATNAMET = CATNAME
          END
         POS1 = POS1 + 50
         END
   DNAME = SUBSTR(DWORK,POS1+2,44)  /* GET ENTRY NAME                */
   IF SUBSTR(DWORK,POS1+1,1) = 'C' THEN DTYPE = 'CLUSTER '
   ELSE IF SUBSTR(DWORK,POS1+1,1) = 'D' THEN DTYPE = 'DATA    '
   ELSE IF SUBSTR(DWORK,POS1+1,1) = 'I' THEN DTYPE = 'INDEX   '
   ELSE IF SUBSTR(DWORK,POS1+1,1) = 'A' THEN DTYPE = 'NONVSAM '
   ELSE IF SUBSTR(DWORK,POS1+1,1) = 'H' THEN DTYPE = 'GDS     '
   ELSE IF SUBSTR(DWORK,POS1+1,1) = 'B' THEN DTYPE = 'GDG     '
   ELSE IF SUBSTR(DWORK,POS1+1,1) = 'R' THEN DTYPE = 'PATH    '
   ELSE IF SUBSTR(DWORK,POS1+1,1) = 'G' THEN DTYPE = 'AIX     '
   ELSE IF SUBSTR(DWORK,POS1+1,1) = 'X' THEN DTYPE = 'ALIAS   '
   ELSE IF SUBSTR(DWORK,POS1+1,1) = 'U' THEN DTYPE = 'UCAT    '
   ELSE DTYPE = '        '
    POS1 = POS1 + 46
    NUMVOL = C2D(SUBSTR(DWORK,POS1+4,2))/6
    POS2 = POS1+14
    DO I=1 TO 3
      VOLSER.I = SUBSTR(' ',1,6)
    END
    DO I = 1 TO NUMVOL
      VOLSER.I = SUBSTR(DWORK,POS2,6)
      POS2 = POS2 + 6
    END
    DSHARBA  = X2D(C2X(SUBSTR(DWORK,POS2,4)))
    DSHARBA  = RIGHT(DSHARBA,15)
    POS2 = POS2 + 4
    DSHURBA  = X2D(C2X(SUBSTR(DWORK,POS2,4)))
    DSHURBA  = RIGHT(DSHURBA,15)
    POS2 = POS2 + 4
    DSBLKSZ  = X2D(C2X(SUBSTR(DWORK,POS2,4)))
    DSBLKSZ  = RIGHT(DSBLKSZ,6)
    POS2 = POS2 + 4
    IF NUMVOL > 1 THEN DO
       DO J = 2 TO NUMVOL
          POS2 = POS2 + 4
       END
    END
    BLKTRK   = X2D(C2X(SUBSTR(DWORK,POS2,2)))
    BLKTRK   = RIGHT(BLKTRK,6)
    IF DNAMET ^= DNAME THEN
    DO
     IF DTYPE = 'DATA    ' THEN DO
     SAY DTYPE DNAME VOLSER.1 VOLSER.2 DSHARBA DSHURBA DSBLKSZ BLKTRK
     END
     IF DTYPE = 'INDEX   ' THEN DO
     SAY DTYPE DNAME VOLSER.1 VOLSER.2 DSHARBA DSHURBA DSBLKSZ BLKTRK
     END
     DNAMET=DNAME
    END
    POS1 = POS1 + C2D(SUBSTR(DWORK,POS1,2))
  END
END
END
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1252
Location: Israel

PostPosted: Wed May 20, 2009 5:31 pm    Post subject:
Reply with quote

Code:
X = OUTTRAP("Lst.")                                  /*1*/
Address TSO "LISTCAT ENTRIES(your.vsam.file) ALL"    /*2*/
X = OUTTRAP("OFF")                                   /*3*/

Do I = 1 To Lst.0
   Say Lst.I                                         /*4*/
End


  1. The 1st OUTTRAP tells REXX to store the output in the stem var instead of displaying it on the console.
  2. the LISTCAT command.
  3. Stop trapping output
  4. You will have to check each line for the attributes you need.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8620
Location: Back in jolly old England

PostPosted: Wed May 20, 2009 5:41 pm    Post subject:
Reply with quote

Looks like I have been using CSI for too long, and had completely forgotten about the IDCAMS approach.

Nice one Marso icon_lol.gif
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 -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts ISSUE IN copying Sequential file reco... thesumitk JCL & VSAM 2 Wed Dec 13, 2017 3:07 pm
No new posts Looping REXX - unable to interrupt RAVISANKAR07 CLIST & REXX 3 Wed Dec 06, 2017 1:08 pm
No new posts The same REXX program doesnt work for... jackzhang75 CLIST & REXX 5 Wed Dec 06, 2017 2:51 am
No new posts File Tailoring -- Temporary dataset i... samzee71 CLIST & REXX 3 Fri Dec 01, 2017 3:12 am
No new posts Rexx - File tailoring samzee71 CLIST & REXX 10 Thu Nov 30, 2017 10:47 pm

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