如何擷取系統 NetServer 的名稱, 網域, 說明及狀態(with API API QZLSLSTI)
Netserver 是將 AS/400 的目錄分享出來, 可以當成 windows 的網路磁碟機, 詳細資訊參照 Netserver
你可以直接在 windows 中 開始->執行-> 輸入 \\yours-as400ip\ 此時若 Netserver 有啟動, 就會出現輸入
user 及 password 的視窗, 輸入 as400 user 及 password 即可進入 as400 的 目錄分享區,預設至少會有 QIBM,
你可以使用 Client Access Navigator 或 使用 GO NETS command tool
來管理 Netserver.
File : QCLSRC
Member: RTVSVRNAMC
Type : CLP
Usage : CRTCLPGM RTVSVRNAMC
pgm
dcl &NSName *char 15 /* NetServer ServerName */
dcl &DomName *char 15 /* NetServer DomainName */
dcl &TextDesc *char 50 /* NetServer TextDescription */
dcl &NSDate *char 13 /* NetServer start date */
dcl &X00 *char 1 value( x'00' )
dcl &a_pos *char 4 /* Data Start Pos.-Binary */
dcl &InfoQual *char 15 value( '*ALL ' )
/* Create a *usrspc to work with... */
call QUSCRTUS ( +
'NETS QTEMP ' +
'TMPLST ' +
x'00001000' +
X'00' +
'*ALL ' +
'Temporary IFS space ' +
'*YES ' +
x'0000000000000000' +
)
/* List NetServer status info into our *usrspc... */
call QZLSLSTI ( +
'NETS QTEMP ' +
'ZLSL0201' +
&InfoQual +
x'0000000000000000' +
)
/* Get the starting position of the list from the header... */
call QUSRTVUS ( +
'NETS QTEMP ' +
x'0000007D' +
x'00000004' +
&a_pos +
)
/* NetServer ServerName is at offset 68 into the list... */
chgvar %bin( &a_pos ) ( %bin( &a_pos ) + 68 + 1 )
/* Get the NetServer ServerName from the *usrspc... */
call QUSRTVUS ( +
'NETS QTEMP ' +
&a_pos +
/* len(15) */ x'0000000F' +
&NSName +
)
/* NetServer DomainName is at offset 98 into the list... */
chgvar %bin( &a_pos ) ( %bin( &a_pos ) + 30 )
/* Get the NetServer DomainName from the *usrspc... */
call QUSRTVUS ( +
'NETS QTEMP ' +
&a_pos +
/* len(15) */ x'0000000F' +
&DomName +
)
/* NetServer TextDesc is at offset 128 into the list... */
chgvar %bin( &a_pos ) ( %bin( &a_pos ) + 30 )
/* Get the NetServer TextDesc from the *usrspc... */
call QUSRTVUS ( +
'NETS QTEMP ' +
&a_pos +
/* len(50) */ x'00000032' +
&TextDesc +
)
/* Display NetServer properties... */
sndusrmsg ( 'NetServer ServerName:' *bcat &NSName) tomsgq( *EXT )
sndusrmsg ( 'NetServer DomainName:' *bcat &DomName) tomsgq( *EXT )
sndusrmsg ( 'NetServer TextDesc:' *bcat &TextDesc) tomsgq( *EXT )
/* Create a *usrspc to work with... */
call QUSCRTUS ( +
'NETS QTEMP ' +
'TMPLST ' +
x'00001000' +
X'00' +
'*ALL ' +
'Temporary IFS space ' +
'*YES ' +
x'0000000000000000' +
)
/* List NetServer status info into our *usrspc... */
call QZLSLSTI ( +
'NETS QTEMP ' +
'ZLSL0400' +
&InfoQual +
x'0000000000000000' +
)
/* Get the starting position of the list from the header... */
call QUSRTVUS ( +
'NETS QTEMP ' +
x'0000007D' +
x'00000004' +
&a_pos +
)
/* NetServer ServerName is at offset 68 into the list... */
chgvar %bin( &a_pos ) ( %bin( &a_pos ) + 60 + 1 )
/* Get the NetServer ServerName from the *usrspc... */
call QUSRTVUS ( +
'NETS QTEMP ' +
&a_pos +
/* len(13) */ x'0000000D' +
&NSDate +
)
/* Display NetServer properties... */
sndusrmsg ( 'NetServer Start date:' *bcat &NSDate) tomsgq( *EXT )
/* If the StartDate is binary zeroes, then NetServer isn't started.. */
if ( %sst( &NSDate 1 1 ) *eq &X00 ) do
sndpgmmsg 'NetServer is NOT active.' topgmq( *EXT )
enddo
/* ..otherwise NetServer is stareted... */
else do
sndpgmmsg 'NetServer IS active. ' topgmq( *EXT )
enddo
return
endpgm
Usage: Call RTVSVRNAMC
Display as following:
Display Program Messages
NetServer ServerName: QS65B04CB
*N
NetServer DomainName: S65B04CB
*N
NetServer TextDesc: iSeries
*N
NetServer Start date: 1070129040437
*N
NetServer IS active.
Press Enter to continue.
F3=Exit F12=Cancel
A blog about IBM i (AS/400), MQ and other things developers or Admins need to know.
星期二, 11月 07, 2023
2007-01-30 如何擷取系統 NetServer 的名稱, 網域, 說明及狀態(with API API QZLSLSTI)
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言