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

2013年(15)

2012年(17)

2011年(17)

2010年(135)

2009年(85)

2008年(18)

分类: 系统运维

2010-06-04 16:47:40

List Open Files ** Program . . : CBX502 ** Description : List job's open files ** Author . . : Carsten Flensburg ** Published . : Club Tech iSeries Programming Tips Newsletter ** Date . . . : March 11, 2004 ** ** ** Program description: ** ** This program was intended to ease the process of retrieving the ** current job's list of open files. The information returned is the ** file names and file library names that are displayed by the DSPJOB ** or WRKJOB command's open files panel. Running the command DSPJOB ** OPTION( *OPNF ) will show the information referred to above. ** ** QDMLOPNF was introduced at V5R1. ** ** Program CBX502T is provided to examplify the use of this program. ** ** ** Parameters: ** ** PxEntNbr BOTH The maximum number of open file entries ** to return in the output array. A maximum ** of 128 open file entries can be returned. ** ** On return this parameter specifies the ** actual number of open file entries loaded ** in the second parameter. ** ** PxFilEnt OUTPUT The retrieved open file entries are returned ** in this parameter. Both the file name and the ** file library name is returned for each open ** file entry as illustrated below: ** ** 1 21 41 ** | entry 1 | entry 2 | entry 3 | -- ** ** 1 11 21 31 41 51 ** | file | lib | file | lib | file | lib | -- ** ** **-- Compilation specification: ** ** CrtBndRpg Pgm( 'library'/CBX502 ) ** SrcFile( 'library'/QRPGLESRC ) ** DbgView( *LIST ) ** **-- Control spec: -----------------------------------------------------** H Option( *SrcStmt ) **-- API error data structure: -----------------------------------------** D ApiError Ds D AeBytPrv 10i 0 Inz( %Size( ApiError )) D AeBytAvl 10i 0 D AeMsgId 7a D 1a D AeMsgDta 256a **-- Global variables: -------------------------------------------------** D Eix s 10i 0 **-- Job identification format JIDF0100: -------------------------------** D JiJobInf Ds Inz D JiJobNam 10a Inz( '*' ) D JiUsrNam 10a D JiJobNbr 6a D JiIntJobId 16a D 2a Inz( *Allx'00' ) D JiThrInd 10i 0 Inz( 1 ) D JiThrId 8a Inz( *Allx'00' ) **-- List open files header: -------------------------------------------** D OfRcvVar Ds D OhOpnFilHdr D OhBytRtn 10i 0 Overlay( OhOpnFilHdr: 1 ) D OhBytAvl 10i 0 Overlay( OhOpnFilHdr: *Next ) D OhNbrFilAvl 10i 0 Overlay( OhOpnFilHdr: *Next ) D OhOfsFilLst 10i 0 Overlay( OhOpnFilHdr: *Next ) D OhNbrFilRtn 10i 0 Overlay( OhOpnFilHdr: *Next ) D OhFilEntLen 10i 0 Overlay( OhOpnFilHdr: *Next ) D OhJobNamUsd 10a Overlay( OhOpnFilHdr: *Next ) D OhUsrNamUsd 10a Overlay( OhOpnFilHdr: *Next ) D OhJobNbrUsd 6a Overlay( OhOpnFilHdr: *Next ) D OhThrIdUsd 8a Overlay( OhOpnFilHdr: *Next ) D OhFilLst 32000a **-- File information D OfFilInf Ds Based( pFilInf ) D OeFilNam 10a D OeFilLib 10a D OeMbrNam 10a D OeFilTyp 10a D OeRcdFmt 10a D OeActGrpNam 10a D OeThrId 8a D OeOpnOpt 1a D 3a D OeActGrpNbr 20i 0 D OeWrtCnt 20i 0 D OeReadCnt 20i 0 D OeWrtReadCnt 20i 0 D OeOthIoCnt 20i 0 D OeRelRcdNbr 20i 0 D OeNbrShrOpn 20i 0 **-- List open files: --------------------------------------------------** D LstOpnF Pr ExtPgm( 'QDMLOPNF' ) D LfRcvVar 32767a Options( *VarSize ) D LfRcvVarLen 10i 0 Const D LfRcvInfFmt 8a Const D LfJobId 32767a Const Options( *VarSize ) D LfJobIdFmt 8a Const D LfError 32767a Options( *VarSize ) **-- Parameters: -------------------------------------------------------** D PxEntNbr s 5p 0 D PxFilEnt s 20a Dim( 128 ) ** C *Entry Plist C Parm PxEntNbr C Parm PxFilEnt ** **-- Mainline: ---------------------------------------------------------** ** C CallP LstOpnF( OfRcvVar C : %Size( OfRcvVar ) C : 'OPNF0100' C : JiJobInf C : 'JIDF0100' C : ApiError C ) ** C If AeBytAvl = *Zero C Eval pFilInf = %Addr( OfRcvVar ) + C OhOfsFilLst ** C For Eix = 1 to OhNbrFilRtn ** C Eval PxFilEnt(Eix) = OeFilNam + OeFilLib ** C If Eix = PxEntNbr Or C Eix = OhNbrFilRtn Or C Eix = %Elem( PxFilEnt ) ** C Leave C EndIf ** C Eval pFilInf = pFilInf + OhFilEntLen C EndFor C EndIf ** C Eval PxEntNbr = Eix ** C Eval *InLr = *On C Return And the calling program: **-- Compilation specification: ----------------------------------------** ** ** CrtBndRpg Pgm( 'library'/CBX502T ) ** SrcFile( 'library'/QRPGLESRC ) ** DbgView( *LIST ) ** **-- Header specifications: --------------------------------------------** H Option( *SrcStmt ) **-- Global variables: -------------------------------------------------** D Eix s 10i 0 **-- File information----------------------------------------------------** D FilInf Ds D FiFilNam 10a D FiFilLib 10a **-- Parameters: -------------------------------------------------------** D PxEntNbr s 5p 0 Inz( %Elem( PxFilEnt )) D PxFilEnt s 20a Dim( 64 ) ** C Call 'CBX502' C Parm PxEntNbr C Parm PxFilEnt ** C For Eix = 1 to PxEntNbr ** C Eval FilInf = PxFilEnt(Eix) C EndFor ** C Return Thanks to Carsten Flensburg and Club Tech iSeries Programming Tips Newsletter
阅读(1057) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~