Progress/400
Product Guide


Defining a User ID and Password at Startup

For security purposes, you might prefer to prompt the user for the user ID and password rather than use the User ID (-U) and Password (-P) connection parameters. The following code is an example of a routine that uses a user-supplied login to connect to DB2/400 database files:

DEFINE VARIABLE id AS CHAR FORMAT "x(8)" INITIAL [" "].
DEFINE VARIABLE password AS CHAR FORMAT "x(8)" INITIAL [" "].
DEFINE VARIABLE hostid AS CHAR FORMAT "x(10)" INITIAL [" "].
DEFINE VARIABLE args AS CHAR FORMAT "x(40)".

UPDATE SPACE (2) hostid SKIP SPACE (2) id LABEL "UserID" SKIP password 
BLANK WITH CENTERED ROW 8 SIDE-LABELS ATTR-SPACE
TITLE " Login to Database  ".

args = " -H " + hostid + " -U " + usrid + " -P " + password + -N TCP.

HIDE ALL.

/* Connect to the database schema holder */

CONNECT  schmhldr -1.

/* Connect to the DB2/400 DataServer database */

CONNECT as400db VALUE(args). 


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095