/* Rexx - Edit macro to format a format 1 dscb from a listds command.*/ /* */ /* This macro was originally named DSCB */ /* Syntax: DSCB dsname */ /* or DSCB */ /* Without dsname if edited file already has output */ /* of a LISTDS dsname LABEL command */ /* */ /* Usage: */ /* - If you have output from a LISTDS dsname LABEL command, paste */ /* it in an edited member and run this macro in the edit session. */ /* - If you just want to see the format1 dscb for a data set on your */ /* system, enter DSCB dsname in any edit session. */ /* * Be aware that this macro replaces all data within an edit */ /* session, so be careful of saving the data. */ /* - as of V2.00 you can also say TSO DSCB dsname on any command line*/ /* */ /* *-----------------------------------------* */ /* *-- Updates and corrections are welcome --* */ /* *-----------------------------------------* */ /* */ /* Author: Doug Nadel nadel@us.ibm.com */ /* Version: 1.00 */ /* Date: August 13, 1999 */ /* */ /* V2.00 April 28,2000 */ /* Thanks to Gary Gindler ggindler@yahoo.com for date code!*/ /* - converted date-related fields into readable format */ /* - made exec work from tso command line or opt 3.4 */ /*-------------------------------------------------------------------*/ Address isredit 'MACRO (DSNAME)' If rc>0 Then /* maybe not an edit macro? */ Do Parse Source . . me . Arg dscbdsn . If sysdsn(dscbdsn)='OK' Then Do Address tso 'ALLOC F(XDSCBCHK) DSO(PS) LREC(80) SP(1)', ' TRA NEW DEL REU REC(F B)' Address ispexec 'LMINIT DATAID(DC) DDNAME(XDSCBCHK) ENQ(SHRW)' 'VPUT DSCBDSN SHARED' 'EDIT DATAID(&DC) MACRO(%'me')' 'LMFREE DATAID(&DC)' Address tso 'FREE F(XDSCBCHK)' End Else Say' Unable to find 'dscbdsn'.' Return 0 End Address ispexec 'VGET DSCBDSN SHARED' If rc=0 Then dsname=dscbdsn Address ispexec 'VERASE DSCBDSN SHARED' 'CAPS OFF' If dsname \= '' Then Do If dsname='*' Then /* allow '*' as shorthand for edited ds name */ Do '(DSNAME) = dataset' dsname="'"dsname"'" End 'RESET' 'DEL ALL NX' x=outtrap( 'var.', 40) Address 'TSO' 'LISTDS 'dsname 'LABEL' x=outtrap('OFF') Do a = 1 to Var.0 line = Var.a 'LINE_AFTER .ZLAST = (LINE)' End End 'F "FORMAT'||' 1 DSCB" FIRST' If rc>0 Then Do; Say 'Need dsname or LISTDS output';Exit;End '(LN) = LINENUM .ZCSR' ln=ln+1 '(LINE) = LINE 'ln Parse Var line fmtid dssn volsq crdt expdt extents nodbd flag1 syscd . ln=ln+1 '(LINE) = LINE 'ln Parse Var line Parse Var line refdt 7 smsflag 9 scext dsorg recfm optcd blkl lrecl , keyl rkp dsind dscalo lstar trbal . /* ---- */ Call add 'DSCB Format', fmtid Call add 'Volume Serial', dssn, 'C' Call add 'Volume Sequence num',volsq Call add 'Create Date', dscbdate(crdt)/* GG */ Call add 'Expiration Date', dscbdate(expdt) Call add 'Extents', extents,'D' Call add 'ds1nodbd', dsorg Call add 'Flag 1', flag1 Call flags flag1,1,1,'Compressible Extended' Call flags flag1,2,1,'Checkpointed Data Set' Call add 'System Code', syscd, 'C' Call add 'Reference Date', dscbdate(refdt)/* GG */ Call add 'SMS Flags', smsflag Call flags smsflag,1,1,'SMS Data set' Call flags smsflag,2,1,'SMS Uncataloged' Call flags smsflag,3,1,'May be reblocked' Call flags smsflag,4,1,'DADSM created orig blksz' Call flags smsflag,5,1,'PDSE' Call flags smsflag,6,1,'Striped data set' Call flags smsflag,7,1,'HFS if PDSE is also on' Call flags smsflag,8,1,'Extended attributes exist' Call add 'Secondary Space ext',scext If substr(x2b(scext),1,1)='1' Then atp='Original Block length' Else atp='Average record length' Call flags scext,1,1,atp' is 'x2d(delstr(scext,1,1)) Call flags scext,2,1,'Megabytes ('x2d(delstr(scext,1,1))')' Call flags scext,3,1,'Kilobytes ('x2d(delstr(scext,1,1))')' Call flags scext,4,1,'Bytes ('x2d(delstr(scext,1,1))')' Call flags scext,5,1,'Compacted by 256 ('x2d(delstr(scext,1,1))')' Call flags scext,6,1,'Compacted by 64K ('x2d(delstr(scext,1,1))')' Call add 'Dataset Org', dsorg at=substr(x2b(dsorg),1,7) Select When (at='1000000') Then atp='Indexed Sequential' When (at='0100000') Then atp='Physical Sequential' When (at='0010000') Then atp='Direct Organization' When (at='0001000') Then atp='BTAM or QTAM line' When (at='0000001') Then atp='Partitioned Organization' Otherwise atp='???' End Call flags dsorg,1,7,atp Call flags dsorg,8,1,'Unmovable' at=substr(x2b(dsorg),9,6) Select When (at='1000000') Then atp='Graphics Organization' When (at='0100000') Then atp='TCAM Line group' When (at='0010000') Then atp='TCAM Message group' When (at='0000100') Then atp='VSAM data set' When (at='0000001') Then atp='TCAM 3705' Otherwise atp='???' End If substr(dsorg,3,2)\= '00' Then Call flags dsorg,9,6,atp Call add 'Record Format', recfm at=substr(x2b(recfm),1,2) Select When (at='10') Then atp='Fixed' When (at='01') Then atp='Variable' When (at='11') Then atp='Undefined' Otherwise atp='Not Fixed, Variable or Undef.' End Call flags recfm,1,2,atp Call flags recfm,3,1,'Track Overflow' Call flags recfm,4,1,'Blocked' Call flags recfm,5,1,'Standard (F) or Spanned (V)' at=substr(x2b(recfm),6,2) Select When (at='00') Then atp='No Control Character' When (at='10') Then atp='ANSI Control Character' When (at='01') Then atp='Machine Control Character' Otherwise atp='Reserved' End Call flags recfm,6,2,atp Call add 'Optcd', optcd Call flags optcd,8,1,'OPTCD=J' Call add 'Block Length', blkl, 'D' Call add 'Record Length', lrecl,'D' Call add 'Key Length', keyl, 'D' Call add 'Relative Key Pos', rkp, 'D' Call add 'Dataset Indicators',dsind Call flags dsind,1,1,'End of Data on this Vol' Call flags dsind,2,1,'Def w/ racf discrete profile' Call flags dsind,3,1,'Block length is a multiple of 8' Call flags dsind,4,1,'Password required' Call flags dsind,5,1,'Password indicator bit (see doc)' Call flags dsind,7,1,'DS opened for output since backup' Call flags dsind,8,1,'Secure checkpoint data set' Call add 'Allocation parms', dscalo at=substr(x2b(dscalo),1,2) Select When (at='11') Then atp='Cylinder request' When (at='10') Then atp='Track request' When (at='01') Then atp='Average block length request' Otherwise atp='Allocation type' End Call flags dscalo,1,2,atp Call flags dscalo,3,1,'Mass Storage Volume' Call flags dscalo,4,1,'Secondary space descriptor exists' Call flags dscalo,5,1,'Contiguous request' Call flags dscalo,6,1,'MXIG request' Call flags dscalo,7,1,'ALX request' Call flags dscalo,8,1,'Round' Call add 'DS1LSTAR', lstar Call add 'Track Balance', trbal,'D' 'LOCATE 0' 'RESET' Exit 1 /* Add: Format a line for character or decimal */ /* Syntax: Call add heading,value <,format> */ /* If format is 'c', value is followed by character */ /* representation of the value shown in quotes. */ /* If format is 'd', value is followed by decimal */ /* representation of the value shown in parenthesis. */ add: Procedure a1=Arg(1) a2=Arg(2) line=left(a1' ',23,'.')' 'a2 If Arg(3)='C' Then line = line' '''||x2c(a2)||'''' If Arg(3)='D' Then line = line' ('x2d(a2)')' 'LINE_AFTER .ZLAST = (LINE)' Return /* Flags: Format bits within a flag byte */ /* Syntax: Call flags heading, byte, bitnumber, num_Of_Bits*/ flags: Procedure a1=x2b(substr(Arg(1),1,2)) line=overlay(substr(a1,Arg(2),Arg(3)), , copies('.',8),Arg(2))' 'Arg(4) line = insert(' ',line,4) line=copies(' ',24)||line 'LINE_AFTER .ZLAST = (LINE)' Return /* GG */ dscbdate: Procedure Arg dscb_date If dscb_date="000000" Then Return dscb_date yyyy = x2d(substr(dscb_date,1,2)) + 1900 ddd = x2d(substr(dscb_date,3,4)) jul_date = yyyy||.||right(ddd,3,'0') yyyy_0101 = yyyy || 0101 base_date = date('B',yyyy_0101,'S') + ddd - 1 normal_date = date('N',base_date,'B') days_ago = date('B') - base_date date_string = dscb_date jul_date normal_date "(" If days_ago >= 0 Then date_string = date_string||days_ago "days ago)" Else date_string = date_string||abs(days_ago) "days from today)" Return date_string /* GG */