Home
Using FSS
Function Reference
SCRUPLES
#defines
3270 Attribute Chars
 
Downloads
 

FSS - TSO Full Screen Services

Using FSS

  1. Initialize the environment with fssInit()
  2. Define static fields using fssTxt(...)
  3. Define dynamic fields using fssFld(...)
  4. Update the contents dynamic fields using fssSetField(...)
  5. Update field attributes using fssSetAttr(...), fssSetColor(...), or fssSetXH(...)
  6. Display the FSS screen on the TSO terminal and get input using fssRefresh();
  7. Process Input
    1. Get field contents using fssGetField(...)
    2. Get the AID using fssGetAid()
  8. The current screen environment may be discarded using fssReset()
  9. The FSS environment is terminated using fssTerm()

Example Programs

Hello World

Here is a quick example of how to write a simple Hello World program. It will display the message on the screen. When enter is pressed the program will terminate.
 
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "fss.h"

int main(int argc, char ** argv)
{
	// Initialize the FSS Environment
	// Place TSO Terminal Into Full Screen Mode
	fssInit();

	// Add a Text Field to the Screen
	fssTxt( 10, 20, fssPROT, "Hello, World!");

	// Display the Screen and Wait for Input
	fssRefresh();

	// Terminate the FSS Environment
	// Remove the Terminal from Full Screen Mode
	fssTerm();

	return 0;
} 


Hello World - Advanced Version

This is a slightly more advanced example showing how to change the color of a field. We have to define our field using fssFld( ) instead of fssTxt( ) so we can associate a name with the field. We can still define it as a non-input field.
Each time enter is pressed the color of the field is changed. The program will exit when either PFK03 or PFK15 is pressed.
 
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "fss.h"

int main(int argc, char ** argv)
{
	int color;
	int aid;

	color = fssBLUE;

	// Initialize the FSS Environment
	// Place TSO Terminal Into Full Screen Mode
	fssInit();

	// Add a Text Field to the Screen
	fssFld( 10, 20, fssPROT, "hello", 15 ,"Hello, World!");

	// Loop until PFK03 or PFK15
	do
	{
		switch(color)
		{
		case fssBLUE:
			color = fssRED;
			break;
		case fssRED:
			color = fssPINK;
			break;
		case fssPINK:
			color = fssGREEN;
			break;
		case fssGREEN:
			color = fssTURQ;
			break;
		case fssTURQ:
			color = fssYELLOW;
			break;
		case fssYELLOW:
			color = fssWHITE;
			break;
		case fssWHITE:
			color = fssBLUE;
			break;
		default:
			color = fssBLUE;
		}

		// Set Field Color
		fssSetColor("hello", color);

	    // Display the Screen and Wait for Input
	    fssRefresh();

		// Get AID value
		aid = fssGetAID();
	} while(aid != fssPFK03 && aid != fssPFK15);

	// Terminate the FSS Environment
	// Remove the Terminal from Full Screen Mode
	fssTerm();

	return 0;
}

Multiple Screens

This example demonstrates creating multiple screens. It is important that any input data from a screen be saved before issuing the fssReset() call to start a new screen.
 
#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;
}