Fileshare セキュリティがアクティブな場合は、最初の入出力操作を実行する前に、ユーザー プログラムでユーザー ID とパスワードを指定する必要があります。
セキュリティがアクティブでない場合でも、プログラムで Fileshare クライアントにユーザー ID とパスワードを指定することができます。このように設定しておくと、セキュリティがアクティブであるかどうかにかかわらず、プログラムを変更しないで Fileshare を使用できます。
ユーザー ID とパスワードを登録するには、プログラムで FHRdrLngPwd モジュールまたは FHRdrPwd モジュールを呼び出す必要があります。FHRdrLngPwd モジュールは、短いユーザー名およびパスワード用、または長いユーザー名およびパスワード用のいずれかに構成された Fileshare で使用できますが、FHRdrPwd モジュールは短いユーザー名およびパスワード用に構成された Fileshare でしか使用できません。
短いユーザー名およびパスワードまたは長いユーザー名およびパスワードをサポートする Fileshare システムで FHRdrLngPwd モジュールを呼び出すには、pic x(100) として定義された user-ID および user-password を使用します。
call "fhrdrlngpwd" using function-code, user-ID, user-password end-call
パラメーターは次のとおりです。
01 function-code pic x comp-x. 01 user-ID pic x(100). 01 user-password pic x(100).
ユーザー ID とパスワードを登録するためのファンクション コードは 1 です。
ユーザー ID とパスワードを登録する方法の例を、次に示します。
working-storage section. 01 function-code pic x comp-x. 01 user-name pic x(100). 01 user-password pic x(100). ... procedure division. ... move 1 to function-code move "UserID" to user-name move "Password" to user-password call "fhrdrlngpwd" using function-code, user-name, user-password end-call ... open output testfile ...
Fileshare システムに付属する FHRdrLngPwd モジュールをユーザー独自のモジュールに置き換えることができます。そのため、アプリケーション プログラム以外からユーザー ID とパスワードを取得することが可能になります。詳細については、「Writing Your Own FHRdrLngPwd Module」セクションを参照してください。
短いユーザー名およびパスワード用に構成された Fileshare システムで FHRdrPwd モジュールを呼び出すには、pic x(20) として定義された user-ID および user-password を使用します。
call "fhrdrpwd" using function-code, user-ID, user-password end-call
パラメーターは次のとおりです。
01 function-code pic x comp-x. 01 user-ID pic x(20). 01 user-password pic x(20).
ユーザー ID とパスワードを登録するためのファンクション コードは 1 です。
ユーザー ID とパスワードを登録する方法の例を、次に示します。
working-storage section. 01 function-code pic x comp-x. 01 user-name pic x(20). 01 user-password pic x(20). ... procedure division. ... move 1 to function-code move "UserID" to user-name move "Password" to user-password call "fhrdrpwd" using function-code, user-name, user-password end-call ... open output testfile ...