Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1298617
  • 博文数量: 287
  • 博客积分: 11000
  • 博客等级: 上将
  • 技术积分: 3833
  • 用 户 组: 普通用户
  • 注册时间: 2007-08-16 08:43
文章分类
文章存档

2013年(15)

2012年(17)

2011年(17)

2010年(135)

2009年(85)

2008年(18)

分类: 系统运维

2010-06-21 09:22:32

QUSLRCD - List Record Formats
 
     '*---------------------------------------------------------------*
     h option(*nodebugio)
     '* Program Name: LISTPF          Program Author:  Tommy Holden   *
     '* Program Date: 08/09/2004      Program Purpose:                *
     '*---------------------------------------------------------------*

     '* Report Output
     FQSysPrt   o    f  132        Printer OflInd(*InOF)

     '* Create User Space API Procedure
     DCrtUsrSpc        pr                  ExtPgm('QUSCRTUS')
     DCUSQualUSName                  20a   CONST
     DCU***tAttribut                 10a   CONST
     DCUSInitSize                    10I 0 CONST
     DCUSInitValue                    1a   CONST
     DCUSPublicAuth                  10a   CONST
     DCUSDescription                 50a   CONST
     DCUSReplace                     10a   CONST
     DErrorCode                   32766A   options(*varsize)

     '* List Record Formats API Procedure
     DListRcdFmts      pr                  ExtPgm('QUSLRCD')
     d  CUSQualUSName                20a   Const
     d  CUSRcdFmt                     8a   Const
     d  CUSPFName                    20a   Const
     d  OverrideProc                  1a   Const
     d  ErrorCode                 32766a   options(*varsize)

     '* List Fields API Procedure
     DListFields       pr                  ExtPgm('QUSLFLD')
     d  CUSFldUSName                 20a   Const
     d  CUSRcdFmt                     8a   Const
     d  CUSPFName                    20a   Const
     D  PFRcdFmt                     10a   Const
     d  OverrideProc                  1a   Const
     d  ErrorCode                 32766a   options(*varsize)

     '* List Key Fields (QDBRTVFD retrieve file desc)API Procedure
     DListFileDesc     pr                  ExtPgm('QDBRTVFD')
     d  OutputData                32766a   Options(*Varsize)
     d  OutputDataLen                10i 0 Const
     d  CUSPFNameRet                 20a
     D  PFRcdFmt                      8a   Const
     d  CUSPFName                    20a   Const
     D  RcdFmt                        8a   Const
     d  OverrideProc                  1a   Const
     d  System                       10a   Const
     d  FormatType                   10a   Const
     d  ErrorCode                 32766a   options(*varsize)

     '* List Members API Procedure
     DListMembers      pr                  ExtPgm('QUSLMBR')
     d  CUSMbrUSName                 20a   Const
     d  CUSRcdFmt                     8a   Const
     d  CUSPFName                    20a   Const
     D  Members                      10a   Const
     d  OverrideProc                  1a   Const
     d  ErrorCode                 32766a   options(*varsize)

     '* List Database Relations API Procedure
     DListDBR          pr                  ExtPgm('QDBLDBR')
     d  CUSDBRUSName                 20a   Const
     d  CUSRcdFmt                     8a   Const
     d  CUSPFName                    20a   Const
     D  Members                      10a   Const
     d  RcdFmt                       10a   Const
     d  ErrorCode                 32766a   options(*varsize)

     '* List Members Info (QUSRMBRD retrieve member desc)API Procedure
     DListMemberInfo   pr                  ExtPgm('QUSRMBRD')
     d  OutputData                32766a   Options(*Varsize)
     d  OutputDataLen                10i 0 Const
     D  PFRcdFmt                      8a   Const
     d  CUSPFName                    20a   Const
     d  Member                       10a   Const
     d  OverrideProc                  1a   Const
     d  ErrorCode                 32766a   options(*varsize)

     '* ReSend Message API Procedure
     D SendMsg         PR                  ExtPgm('QMHRSNEM')
     D   MsgKey                       4A   const
     D   ErrorCode                32766A   options(*varsize)
     D   ToStkEntry               32766A   options(*varsize: *nopass)
     d   ToStkEntryLn                10I 0 const options(*nopass)
     D   Format                       8A   const options(*nopass)
     D   FromEntry                     *   const options(*nopass)
     D   FromCounter                 10I 0 const options(*nopass)

     '* Get User Space Pointer API Procedure
     D UserSpacePntr   PR                  ExtPgm('QUSPTRUS')
     D CUSQualUSName                 20A   CONST
     D  CUSPointer                     *

     '* Error Code DS For API Calls
     D ErrorDS         DS
     D   dsEC1                       10I 0 inz(0)
     D   dsEC2                       10I 0 inz(0)

     '* Program Stack DS For API Calls
     D StackDS         ds
     d   dsRS_StkCnt                 10I 0 inz(2)
     D   dsRS_StkQual                20A   inz('*NONE     *NONE')
     D   dsRS_IDLen                  10I 0 inz(7)
     D   dsRS_StkID                   7A   inz('*')

     '* User Space Header DS
     D USHeader        ds                  Based(CUSPointer)
     d HdrUserArea                   64a
     d HdrHdrSize                    10i 0
     d HdrStrLvl                      4a
     d HdrFormat                      8a
     d HdrAPIUsed                    10a
     d HdrCrtDate                    13a
     d HdrInfoSts                     1a
     d HdrSizeOfUS                   10i 0
     d HdrOffsetToInp                10i 0
     d HdrSizeOfInp                  10i 0
     d HdrOffsetToHdr                10i 0
     d HdrSizeOfHdr                  10i 0
     d HdrOffsetToDtl                10i 0
     d HdrSizeOfDtl                  10i 0
     d HdrNumberOfDtl                10i 0
     d HdrEntrySize                  10i 0
     d HdrCCSID                      10i 0
     d HdrCountry                     2a
     d HdrLangID                      3a
     d HdrSubsetInd                   1a
     d HdrReserved1                  42a
     DSaveHdrDS        ds
     d SavUserArea                   64a
     d SavHdrSize                    10i 0
     d SavStrLvl                      4a
     d SavFormat                      8a
     d SavAPIUsed                    10a
     d SavCrtDate                    13a
     d SavInfoSts                     1a
     d SavSizeOfUS                   10i 0
     d SavOffsetToInp                10i 0
     d SavSizeOfInp                  10i 0
     d SavOffsetToHdr                10i 0
     d SavSizeOfHdr                  10i 0
     d SavOffsetToDtl                10i 0
     d SavSizeOfDtl                  10i 0
     d SavNumberOfDtl                10i 0
     d SavEntrySize                  10i 0
     d SavCCSID                      10i 0
     d SavCountry                     2a
     d SavLangID                      3a
     d SavSubsetInd                   1a
     d SavReserved1                  42a
     DSav2HdrDS        ds
     d Sv2UserArea                   64a
     d Sv2HdrSize                    10i 0
     d Sv2StrLvl                      4a
     d Sv2Format                      8a
     d Sv2APIUsed                    10a
     d Sv2CrtDate                    13a
     d Sv2InfoSts                     1a
     d Sv2SizeOfUS                   10i 0
     d Sv2OffsetToInp                10i 0
     d Sv2SizeOfInp                  10i 0
     d Sv2OffsetToHdr                10i 0
     d Sv2SizeOfHdr                  10i 0
     d Sv2OffsetToDtl                10i 0
     d Sv2SizeOfDtl                  10i 0
     d Sv2NumberOfDtl                10i 0
     d Sv2EntrySize                  10i 0
     d Sv2CCSID                      10i 0
     d Sv2Country                     2a
     d Sv2LangID                      3a
     d Sv2SubsetInd                   1a
     d Sv2Reserved1                  42a

     '* List Record Format Header DS
     D  RcdFmtHdrPtr   s               *
     DRcdFmtHdrDS      ds                  Based(RcdFmtHdrPtr)
     D  RcdPFName                    10a
     D  RcdPFLib                     10a
     D  RcdPFType                    10a
     D  RcdPFText                    50a
     D  RcdPFCCSID                   10i 0
     D  RcdPFCrtDate                 13a

     '* List Record Formats DS
     D RcdFmtPtr       s               *
     DRcdFmtDS         ds                  Based(RcdFmtPtr)
     D  RcdFmtName                   10a
     D  RcdLvlChkID                  13a
     D  RcdReserved                   1a
     D  RcdLength                    10i 0
     D  RcdNumFlds                   10i 0
     D  RcdFmtDesc                   50a
     D  RcdReserved1                  2a
     D  RcdCCSID                     10i 0

     '* List Fields DS
     D FldPtr          s               *
     DLstFldDS         ds                  Based(FldPtr)
     D  FldName                      10a
     D  FldDataType                   1a
     D  FldUsage                      1a
     D  FldOutBuffPos                10i 0
     D  FldInBuffPos                 10i 0
     D  FldLength                    10i 0
     D  FldDigits                    10i 0
     D  FldDecimals                  10i 0
     D  FldDesc                      50a
     D  FldEditC                      2a
     D  FldEditWLen                  10i 0
     D  FldEditWord                  64a
     D  FldColHdg1                   20a
     D  FldColHdg2                   20a
     D  FldColHdg3                   20a
     D  FldIntName                   10a
     D  FldAltName                   30a
     D  FldAltLen                    10i 0
     D  FldDBCS#                     10i 0
     D  FldAllowNull                  1a
     D  FldHostVar                    1a
     D  FldDateFormat                 4a
     D  FldDateSep                    1a
     D  FldVarSize                    1a
     D  FldDescCCSID                 10i 0
     D  FldDataCCSID                 10i 0
     D  FldColHCCSID                 10i 0
     D  FldEdtWCCSID                 10i 0
     D  FldUSC2Len                   10i 0
     D  FldDataEncode                10i 0
     D  FldMaxObjLen                 10i 0
     D  FldPadLen                    10i 0
     D  FldUDTLen                    10i 0
     D  FldUDTName                  132a
     D  FldUDTLib                    10a
     D  FldDLCntl                     1a
     D  FldDLInteg                    1a

     '* List File Description Header DS
     D  FDHDS          ds
     D  FDHBytesRet                  10i 0
     D  FDHBytesAvail                10i 0
     D  FDHMaxKeyLen                  5i 0
     D  FDHKeyCount                   5i 0
     D  FDHReserved                  10a
     D  FDHFormatCnt                  5i 0
     D  KeyRecFmt                    10a
     D  KeyReserve                    2a
     D  Key#OfKeys                    5i 0
     D  KeyReserv1                   14a
     D  KeyInfoOffset                10i 0

     '* List Key Information DS
     D KeyDS           ds
     D  KeyIntName                   10a
     D  KeyExtName                   10a
     D  KeyDtaType                    5i 0
     D  KeyFldLen                     5i 0
     D  Key#OfDigits                  5i 0
     D  KeyDecPos                     5i 0
     D  KeyAttrFlg                    1a
     D  KeyAltLen                     5i 0
     D  KeyAltName                   30a
     D  KeyReserv3                    1a
     D  KeyAttrFlg1                   1a
     D  KeyReserv4                    1a

     '* List Members Header DS
     D  MbrHdrPtr      s               *
     D MbrHdrDS        ds                  Based(MbrHdrPtr)
     D  MbrQualPF                    20a
     D  MbrPFAttr                    10a
     D  MbrPFText                    50a
     D  #OfMembers                   10i 0
     D  MbrSrcFile1                   1a
     D  MbrRsv                        3a
     D  MbrPFCCSID                   10i 0

     '* Member Information DS
     D MemberDS        ds
     D MbrBytesRet                   10i 0
     D MbrBytesAvail                 10i 0
     D MbrPFName                     10a
     D MbrPFLib                      10a
     D MbrName                       10a
     D MbrFileAttr                   10a
     D MbrSrcType                    10a
     D MbrCrtDate                    13a
     D MbrLSrcChg                    13a
     D MbrText                       50a
     D MbrSrcFile                     1a
     D MbrRemote                      1a
     D MbrLForPF                      1a
     D MbrODPShare                    1a
     D MbrReserved                    2a
     D MbrCurrRcds                   10i 0
     D MbrDltRcds                    10i 0
     D MbrDataSpcSize                10i 0
     D MbrAccPthSize                 10i 0
     D Mbr#BasedOn                   10i 0
     D MbrChgDate                    13a
     D MbrSaveDate                   13a
     D MbrRstDate                    13a
     D MbrExpDate                     7a
     D MbrReserv1                     6a
     D Mbr#DaysUsed                  10i 0
     D MbrLstUsed                     7a
     D MbrUseReset                    7a
     D MbrReserv2                     2a
     D MbrDtaSpcMult                 10i 0
     D MbrAccPthMult                 10i 0
     D MbrOffset1                    10i 0
     D Mbr1Len                       10i 0
     D MbrCurrBORcds                 10u 0
     D MbrDltBORcds                  10u 0
     D MbrReserv3                     6a
     D MbrJoinMbr                     1a
     D MbrAccPthMaint                 1a
     D MbrSQLType                    10a
     D MbrReserv4                     1a
     d MbrAllowRead                   1a
     D MbrAllowWrite                  1a
     D MbrAllowUpdate                 1a
     D MbrAllowDelete                 1a
     D MbrReserv5                     1a
     D MbrRcdFrcWrite                10i 0
     D MbrMaxPctDlt                  10i 0
     D MbrInit#Rcds                  10i 0
     D MbrIncr#Rcds                  10i 0
     D MbrMaxIncrem                  10i 0
     D MbrCurIncrem                  10u 0
     D MbrRcdCapacity                10u 0
     D MbrRcdFmtPgm                  10a
     D MbrRcdFmtLib                  10a
     D Mbr#Constraint                 5i 0
     D MbrOffsetConst                10i 0
     D MbrReserv6                    46a

     '* Based On PF DS
     D BasedOnDS       DS
     D  BOPFName                     10a
     D  BOPFLib                      10a
     D  BOPFMember                   10a
     D  BORcdFmt                     10a
     D  BORest                41    112a

     '* DBR DS
     D DBRPtr          s               *
     D DBRDS           ds                  Based(DBRPtr)
     d DBRPFName                     10a
     d DBRPFLib                      10a
     D DBRDepFile                    10a
     D DBRDepLib                     10a
     D DBRDepType                     1a
     D DBRReserve                     3a
     D DBRJoinRef#                   10i 0
     D DBRCstLib                     10a
     D DBRCstNameLen                 10i 0
     D DBRCstName                   258a

     '* Work Fields
     DCUSQualUSName    s             20a
     DCUSFldUSName     s             20a
     DCUSDBRUSName     s             20a
     DCUSPFNameRet     s             20a
     DInputPFName      s             20a
     DCU***tAttribut   s             10a
     DCUSInitSize      s             10I 0
     DOutputDataLen    s             10I 0 inz(32766)
     DOutputData       s          32766a
     DCUSInitValue     s              1a
     DCUSPublicAuth    s             10a
     DCUSDescription   s             50a
     DCUSReplace       s             10a
     DCUSMbrUSName     s             20a
     D MbrPtr          s               *
     D Member          s             10a   Based(MbrPtr)
     DFilNam           s             10a
     DStrPos           s             10i 0
     DOffset           s             10i 0
     DTimes            s             10i 0
     DEndBuf           s              5  0
     DSeq#             s              8  0
     D #OfDepFiles     s             10i 0
     Dtmpdate          s               d   inz(D'1995-01-01') datfmt(*usa/)
     Dlines            s            132a   inz(*All'_')
     d  OverrideProc   s              1a   Inz('0')
     D Dependancy      s             50a
     D a               s             10i 0
     D b               s             10i 0
     D c               s             10i 0
     D i               s             10i 0
     D j               s             10i 0
     D k               s             10i 0
     C     *Entry        PList
     C                   Parm                    CUSPFName        20
     '* Set up Date & Time Output Field...
     c                   movel     *date         tmpdate
     C                   time                    utime             6 0
     C                   Eval      FilNam=%Subst(CUSPFName:1:10)

     '* Create The User Space For The Record Format List
     c                   Eval      CUSQualUSName='RCDFMT    QTEMP'
     c                   Eval      CU***tAttribut='USRSPC'
     c                   Eval      CUSInitSize=1024
     c                   Eval      CUSInitValue=x'00'
     c                   Eval      CUSPublicAuth='*ALL'
     c                   Eval      CUSDescription='Record Formats'
     c                   Eval      CUSReplace='*YES'
     c                   CallP(E)  CrtUsrSpc(CUSQualUSName:
     c                             CU***tAttribut:CUSInitSize:
     c                             CUSInitValue:CUSPublicAuth:
     c                             CUSDescription:CUSReplace:
     c                             ErrorDS)

     '* Create Failed
     c                   If        %Error
     c                   callp     SendMsg(*blanks:
     c                                   ErrorDS:
     c                                   StackDS:
     c                                   %size(StackDS):
     c                                   'RSNM0100':
     c                                   *NULL:
     c                                   0)
     c                   endif

     '* List Record Formats Into User Space
     c                   CallP(E)  ListRcdFmts(CUSQualUSName:
     c                             'RCDL0200':
     c                             CUSPFName:
     c                             OverrideProc:
     c                             ErrorDS)

     '* Access The Data via Pointer
     c                   CallP(E)  UserSpacePntr(CUSQualUSName:CUSPointer)
     c                   Eval      SaveHdrDS=USHeader
     c                   Eval      RcdFmtHdrPtr=CUSPointer+SavOffsetToHdr
     c                             + ((a-1) * %Size(RcdFmtHdrDS))

     '* Process The Detail Data
     c                   Do        SavNumberOfDtli
     c                   Eval      RcdFmtPtr=CUSPointer+SavOffsetToDtl
     c                             + ((i-1) * %Size(RcdFmtDS))
     C                   Except    Heads
     C                   Except    Head1

     '* Get Record Format Info Printed
     c                   ExSR      RcdFmtSR

     '* Get Key Data Info Printed
     c                   ExSR      KeyDataSR

     '* Get Member Data Info Printed
     c                   ExSR      MbrDataSR
     c                   EndDo

     '* Terminate
     c                   ExSR      Terminate

     '* Record Format Information
     c     RcdFmtSR      BegSR

     '* Create The User Space For The Field List
     c                   Z-Add     0             Seq#
     c                   Eval      CUSFldUSName='FLDLST    QTEMP'
     c                   Eval      CU***tAttribut='USRSPC'
     c                   Eval      CUSInitSize=1024
     c                   Eval      CUSInitValue=x'00'
     c                   Eval      CUSPublicAuth='*ALL'
     c                   Eval      CUSDescription='Field List'
     c                   Eval      CUSReplace='*YES'
     c                   CallP(E)  CrtUsrSpc(CUSFldUSName:
     c                             CU***tAttribut:CUSInitSize:
     c                             CUSInitValue:CUSPublicAuth:
     c                             CUSDescription:CUSReplace:
     c                             ErrorDS)

     '* Create Failed
     c                   If        %Error
     c                   callp     SendMsg(*blanks:
     c                                   ErrorDS:
     c                                   StackDS:
     c                                   %size(StackDS):
     c                                   'RSNM0100':
     c                                   *NULL:
     c                                   0)
     c                   endif

     '* Create Field List
     c                   CallP(E)  ListFields(CUSFldUSName:
     c                             'FLDL0100':
     c                             CUSPFName:
     c                             RcdFmtName:
     c                             OverrideProc:
     c                             ErrorDS)

     '* Access Data via Pointer
     c                   CallP(E)  UserSpacePntr(CUSFldUSName:CUSPointer)
     c                   Eval      OutputData=*Blanks

     '* Process Detail Data
     c                   Do        HdrNumberOfDtlj
     c                   Eval      FldPtr=CUSPointer+HdrOffsetToDtl
     c                             + ((j-1) * %Size(LstFldDS))

     '* Get the Ending Buffer Position
     c                   Eval      EndBuf=FldOutBuffPos+(FldLength-1)

     '* If Numeric Field Set On Indicator 10
     c                   If        FldDataType ='B'
     c                             OR FldDataType='D'
     c                             OR FldDataType='F'
     c                             OR FldDataType='M'
     c                             OR FldDataType='N'
     c                             OR FldDataType='P'
     c                             OR FldDataType='S'
     c                   Eval      *In10=*On
     c                   Else
     c                   Eval      *In10=*Off
     c                   EndIf

     '* Increment the Sequence Number & Write The Details
     c                   Add       10            Seq#
     c   OF              Except    Heads
     C   OF              Except    Head1
     c                   Except    Detail
     c                   Eval      *InOF=*Off
     c                   EndDo

     '* Save The Number Of Fields For Total Printing
     c                   Z-Add     RcdNumFlds    FldCnt           10 0
     c                   EndSR

     '* Key Data Information
     c     KeyDataSR     BegSR

     '* Get The Key Information From API Into Output Variable
     c                   Except    KeyHed
     c                   Eval      OutputDataLen=32766
     c                   Eval      CUSPFNameRet=*Blanks
     c                   CallP(E)  ListFileDesc(OutputData:
     c                             OutputDataLen:
     c                             CUSPFNameRet:
     c                             'FILD0300':
     C                             CUSPFName:
     c                             RcdFmtName:
     c                             OverrideProc:
     c                             '*LCL':
     c                             '*EXT':
     c                             ErrorDS)

     '* If Any Errors Occur or No Key Fields Found, Set Number Of Keys To 0
     c                   If        OutputData=*Blanks
     C                             OR %Error
     c                             OR %len(%Trim(OutputData))=0
     c                   Eval      Key#OfKeys=0
     c                   Else
     c                   MoveL     OutputData    FDHDS
     c                   EndIf

     '* Process Key Information Stored in the OutputData Variable
     c                   Eval      StrPos=KeyInfoOffset+1
     c                   Do        Key#OfKeys
     c                   Eval      KeyDS=%Subst(OutputData:StrPos:
     c                             +%Size(KeyDS))

     '* Print Key Information
     c   OF              Except    Heads
     c   OF              Except    KeyHed
     c                   Except    KeyLine
     c                   Eval      *InOF=*Off
     c                   Eval      StrPos=StrPos+%Size(KeyDS)
     c                   EndDo
     c                   EndSR

     '* Member Information
     c     MbrDataSR     BegSR

     '* Create The User Space For The Member List
     c                   Except    MbrHed
     c                   Eval      CUSMbrUSName='MBRLST    QTEMP'
     c                   Eval      CU***tAttribut='USRSPC'
     c                   Eval      CUSInitSize=1024
     c                   Eval      CUSInitValue=x'00'
     c                   Eval      CUSPublicAuth='*ALL'
     c                   Eval      CUSDescription='MembersList'
     c                   Eval      CUSReplace='*YES'
     c                   CallP(E)  CrtUsrSpc(CUSMbrUSName:
     c                             CU***tAttribut:CUSInitSize:
     c                             CUSInitValue:CUSPublicAuth:
     c                             CUSDescription:CUSReplace:
     c                             ErrorDS)

     '* Create Failed
     c                   If        %Error
     c                   callp     SendMsg(*blanks:
     c                                   ErrorDS:
     c                                   StackDS:
     c                                   %size(StackDS):
     c                                   'RSNM0100':
     c                                   *NULL:
     c                                   0)
     c                   endif

     '* Get Member List
     c                   CallP(E)  ListMembers(CUSMbrUSName:
     c                             'MBRL0100':
     c                             CUSPFName:
     c                             '*ALL':
     c                             OverrideProc:
     c                             ErrorDS)

     '* Access Member List via Pointer
     c                   CallP(E)  UserSpacePntr(CUSMbrUSName:CUSPointer)
     c                   Eval      Sav2HdrDS=USHeader
     c                   Eval      MbrHdrPtr=CUSPointer
     c                   Eval      MbrHdrPtr=MbrHdrPtr+Sv2OffsetToHdr
     C                   Eval      InputPFName=CUSPFName

     '* Process The Member List
     c                   Do        Sv2NumberOfDtlk
     c                   Eval      MbrPtr=CUSPointer+Sv2OffsetToDtl
     c                             + ((k-1) * %Size(Member))
     c                   Eval      OutputDataLen=32766
     c                   Eval      OverrideProc='0'

     '* Retrieve The Member Information via API
     c                   If        Member<>*Blanks
     c                   CallP(E)  ListMemberInfo(OutputData:
     c                             OutputDataLen:
     c                             'MBRD0300':
     c                             InputPFName:
     c                             Member:
     c                             OverrideProc:
     c                             ErrorDS)

     '* Error During Retrieve The Member Information via API
     c                   If        OutputData=*Blanks
     C                             OR %Error
     c                             OR %len(%Trim(OutputData))=0
     c                   Eval      Mbr#BasedOn=0
     c                   Else
     c                   MoveL     OutputData    MemberDS
     c                   EndIf

     '* Print Member Information
     c   OF              Except    Heads
     c   OF              Except    MbrHed
     c                   Except    MbrLine

     '* If This is a LF, List the Based On PF Information
     c                   If        MbrLForPF='1'
     c                   Eval      StrPos=384
     c                   If        Mbr#BasedOn>0
     c                   SetOn                                        11
     c                   SetOff                                       12
     c                   Except    BasedOnHdr
     c                   Do        Mbr#BasedOn
     c                   Eval      BasedOnDS=%Subst(OutputData:StrPos:112)
     c                   Except    BasedOnDtl
     c                   Eval      StrPos=StrPos+112
     c                   EndDo
     c                   EndIf

     '* If This is a PF, List the Dependent File Information
     c                   Else
     c                   SetOn                                        12
     c                   SetOff                                       11
     c                   ExSR      ListDBRSR
     c                   EndIf
     c                   EndIf
     c                   EndDo

     '* Print File Totals
     c                   Except    Totals
     c                   EndSR

     '* List Database Relations Subroutine
     c     ListDBRSR     BegSR

     '* Create The User Space For The DBR List
     c                   Eval      CUSDBRUSName='DBRLST    QTEMP'
     c                   Eval      CU***tAttribut='USRSPC'
     c                   Eval      CUSInitSize=1024
     c                   Eval      CUSInitValue=x'00'
     c                   Eval      CUSPublicAuth='*ALL'
     c                   Eval      CUSDescription='DBR List'
     c                   Eval      CUSReplace='*YES'
     c                   CallP(E)  CrtUsrSpc(CUSDBRUSName:
     c                             CU***tAttribut:CUSInitSize:
     c                             CUSInitValue:CUSPublicAuth:
     c                             CUSDescription:CUSReplace:
     c                             ErrorDS)

     '* Create Failed
     c                   If        %Error
     c                   callp     SendMsg(*blanks:
     c                                   ErrorDS:
     c                                   StackDS:
     c                                   %size(StackDS):
     c                                   'RSNM0100':
     c                                   *NULL:
     c                                   0)
     c                   endif

     '* List DBR Into User Space
     c                   CallP(E)  ListDBR(CUSDBRUSName:
     c                             'DBRL0100':
     c                             CUSPFName:
     c                             '*ALL':
     c                             '*ALL':
     c                             ErrorDS)

     '* Access Data via Pointer
     c                   CallP(E)  UserSpacePntr(CUSDBRUSName:CUSPointer)
     c                   If        HdrNumberOfDtl>0
     C                   Except    DBRHeads
     c                   Eval      #OfDepFiles=HdrNumberOfDtl

     '* Process All Dependancies
     c                   Do        HdrNumberOfDtlc
     c                   Eval      DBRPtr=CUSPointer+HdrOffsetToDtl
     c                             + ((c-1) * %Size(DBRDS))

     '* Load Dependancy Type For Print
     c                   Select
     c                   When      DBRDepType='C'
     c                   Eval      Dependancy='Constraint'
     '*
     c                   When      DBRDepType='D'
     c                   Eval      Dependancy='Extracted Data'
     '*
     c                   When      DBRDepType='I'
     c                   Eval      Dependancy='Extracted Data(Shared AccPth)'
     '*
     c                   When      DBRDepType='O'
     c                   Eval      Dependancy='Extracted Data(Owned AccPth)'
     '*
     c                   When      DBRDepType='V'
     c                   Eval      Dependancy='SQL View'
     '*
     c                   Other
     c                   Eval      Dependancy='Unknown'
     c                   EndSL

     '* Print Dependent File Information
     C                   Except    DBRDtl
     c                   EndDo
     c                   EndIf
     c                   EndSR

     '* Termination
     c     Terminate     BegSR
     c                   Eval      *InLR=*On
     c                   Return
     c                   EndSR
     '* Output Specs...
     Oqsysprt   e            heads          1 03
     O                                              'Date:'
     O                       tmpdate             +1
     O                                           40 'File Name:'
     o                       filnam              +1
     o                                           +1 'In Library:'
     o                       RcdPFLib            +1
     O                                          123 'Time:'
     O                       utime              132 '  :  :  '
     '*
     O          e            heads          1
     O                                           42 'Rec. Format:'
     O                       RcdFmtName          +1
     o                       RcdPFText           +1
     O                                          123 'Page:'
     O                       page          z    132
     '*
     O          e            heads          0
     o                       lines
     '*
     O          e            head1          1
     O                                            8 'Seq. Nbr'
     O                                           +1 'Field Name'
     O                                           +1 'Description'
     O                                           89 'Buffer Pos.'
     O                                          109 'Attributes'
     '*
     O          e            detail         1
     o                       seq#          z      8
     o                       FldName             +1
     o                       FldDesc             +1
     o                       FldOutBuffPos z     +1
     o                                           +1 '-'
     o                       endbuf        z     +1
     o               10      FldDigits     z     +1
     o               10      FldDataType         +0
     o               10      FldDecimals         +2 '        0 '
     O              N10      FldLength     z    100
     o              n10      FldDataType        101
     '*
     o          e            keyhed      2  1
     O                                              'Keyed By'
     '*
     o          e            keyline        1
     O                       KeyExtName         +10
     '*
     o          e            mbrhed      2  1
     O                                              'Members In File:'
     '*
     o          e            mbrline        1
     O                       Member             +10
     O                       MbrText             +1
     '*
     O          e            BasedOnHdr     1
     o                                              'Based On:'
     '*
     o          e            BasedOnHdr     1
     o                                              'Physical File'
     o                                           25 'Library'
     o                                           35 'Member'
     o                                           53 'Record Format'
     '*
     o          e            BasedOnDtl     1
     o                       BOPFName
     o                       BOPFLib             27
     o                       BOPFMember          38
     o                       BORcdFmt            49
     '*
     o          e            DBRHeads       1
     o                                              'Dependent Files:'
     '*
     o          e            DBRHeads       1
     o                                              'File     '
     o                                           +1 'Library  '
     o                                           +1 'Dependancy Type'
     '*
     o          e            DBRDtl         1
     o                       DBRDepFile
     o                       DBRDepLib           +1
     o                       Dependancy          +1
     '*
     o          e            totals      2  1
     o                       lines
     '*
     o          e            totals         1
     o                                              'Number Of Fields:'
     o                       FldCnt              37 '        0 '
     '*
     o          e            totals         1
     o                                              'Number Of Keys:'
     o                       Key#OfKeys          37 '        0 '
     '*
     o          e            totals         1
     o                                              'Number Of Members:'
     o                       #OfMembers          37 '        0 '
     '*
     o          e    11      totals         1
     o                                              'Number Of Based On Files:'
     o                       Mbr#BasedOn         37 '        0 '
     '*
     o          e    12      totals         1
     o                                              'Number Of Dependent Files:'
     o                       #OfDepFiles         37 '        0 '

Thanks to Tommy Holden
阅读(1916) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~