|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "fss.h"
int main(int argc, char ** argv)
{
int aid;
int exit;
char userid[9];
char password[9];
char work[64];
exit = 0;
// Initialize the FSS Environment
// Place TSO Terminal Into Full Screen Mode
fssInit();
// Add Fields to the Screen
fssFld( 1, 2, fssPROT+fssHI, "msg", 40, "");
fssTxt( 10, 20, fssPROT, "USERID ");
fssTxt( 10, 28, fssPROT+fssHI, "===>");
fssFld( 10, 33, 0, "userid", 8, "");
fssTxt( 11, 20, fssPROT, "PASSWORD");
fssTxt( 11, 28, fssPROT+fssHI, "===>");
fssFld( 11, 33, fssNON, "password", 8 ,"");
// Set default location for Cursor
fssSetCursor("userid");
// Loop until PFK03 or PFK15 or Userid & Password Supplied
do
{
// Display the Screen and Wait for Input
fssRefresh();
// Get AID value
aid = fssGetAID();
if(aid == fssPFK03 || aid == fssPFK15)
{
exit = 1;
break;
}
// Clear Error Message
fssSetField("msg", "");
// If a required field is blank,
// Set the error message and place
// the cursor in that field.
if(fssIsBlank(fssGetField("userid")))
{
fssSetField("msg", "Please Enter Your USERID");
fssSetCursor("userid");
}
else if(fssIsBlank(fssGetField("password")))
{
fssSetField("msg", "Please Enter Your Password");
fssSetCursor("password");
}
else
{
break; // All required data supplied
}
} while(1);
if(!exit)
{
//---------------------------------------------------------
// Save User Input Data - It will be lost with fssReset()
//---------------------------------------------------------
strcpy(userid, fssGetField("userid"));
strcpy(password, fssGetField("password"));
fssReset(); // Create New Screen
fssTxt(10, 30, fssPROT+fssPINK+fssREVERSE, "+------------------------------+");
fssTxt(11, 30, fssPROT+fssPINK+fssREVERSE, "|");
fssFld(11, 32, fssPROT+fssYELLOW, "hello", 27, "");
fssTxt(11, 61, fssPROT+fssPINK+fssREVERSE, "|");
fssTxt(12, 30, fssPROT+fssPINK+fssREVERSE, "+------------------------------+");
// Set default cursor location
fssSetCursor("hello");
// Build & Set Dynamic Field Contents
strcpy(work, "Hello: ");
strcat(work, userid);
fssSetField("hello", work);
// Display and Wait for Input
fssRefresh();
}
// Terminate the FSS Environment
// Remove the Terminal from Full Screen Mode
fssTerm();
return 0;
}
|