3270 Designer.

The 3270 Designer is a C code generating program written in Visual Basic which allows simple screen editing to build complex panels for use within TSO.

The interface to the 3270 Designer is quite simple. Just place the cursor where you want to write text, and type the text you want. Options allow for input/output variables, output-only variables, changing colours & attributes and a special vertical label generator.

A line of text may be moved by using the mouse to select the text and pressing the move button followed by the cursor keys. Note: this may also move text which isn't selected when space doesn't exist for the text which is selected and is being moved. Also, the attribute byte is recalculated on every move and may result in the end-character being lost in the selected text to preserve screen colours etc.

This program isn't fast! It is, after all, written in Visual Basic... Calculations for each character entered are performed to allow the screen to show what a real 3270 screen will use - the generation speed and time saved in coding a 3270 screen from scratch is quite good however.

The filename of the .D37 designer save-file is used as the filename and function name of the generated program. In the example this is called test1.D37, test1.h and test1 (); Refer to the example for more information on using the generated code. From the example it can be seen that a return code from 1-24 is a function key value and 0 is the <enter> key. -1 indicates an error.

Refer also to the readme.txt file in the src\3270 directory for more information.


In the example.c program, it may not be clear that the order of variables passed to the generated function (ie. within the two arrays) is based on left-to-right top-to-bottom order of the fields placed on the 3270 screen.

As an enhancement to the JCC library, a program can now use the socket library to allow a new 3270 terminal to connect and display 3270 designer panels. Up to 256 connections are supported per JCC program (the thread limit in JCC) but multiple JCC programs can be started using the spawn system function if more are needed. Each different program would need to use a different socket server-port however due to TCP/IP requirements.

The main idea here is that a program being used as a started task can create a thread that allows a 3270 terminal to connect and configure the started task settings while it is running. In this instance only 1 socket connection would be needed. See example2.c for more info.

This is the aux3270.h include file from the JCC library:

/*

  Auxiliary 3270 C-Library Include File for MVS-OS/390-zOS

  (C)2009 Jason Paul Winter, All Rights Reserved.

*/

#ifndef __AUX3270H
#define __AUX3270H /* Prevent multiple includes */

/* "#define NOAUX3270 1" to use only the original routines [which are now part */
/* of the aux3270.obj library member, ie. No longer pre-link the TSO .obj code] */
/* before including this file.  That is the same as the old 3270 designer code. */

#define THIS_THREAD -1
/* This can be used as threadid in SetNative below: */

int SetNative (int threadid, int value);
/* SetNative selects which thread of a JCC program is
   selected to use the TSO terminal IO methods instead
   of going through the emulated terminal IO routines.

   When this module is linked, the default is no TSO.
 
   threadid may be 0 for the main program, or the handle
   value returned from _beginthread - but note that you
   must control access (using a critical section) to all
   emulated IO functions between TERM-ON and OFF before
   this function is used.  Once connected, -1 is returned
   if this function is called for the connected thread.

   A 'value' of 0 turns off the TSO option for a thread.
 */

extern int panel_port;    /* '3278' is the default port to listen on */

extern int panel_running; /* Set to 0 to shutdown right away, OR */ 
                          /* Set to 2 to shutdown once users have logged off */

/* New re-routing functions for terminal IO: */

long MYTERMONi (void);   /* Will wait until a 3270 client connects */
long MYTERMFFi (void);   /* Cleans up / disconnects a client */
long MYTERMOi  (void *); /* Sends 3270 stream output */
long MYTERMIi  (void *); /* Reads 3270 stream input */

/* Use these short (original) assembler routines now provided by JCC: */

long MYTERMON (void);
long MYTERMFF (void);
long MYTERMO  (void *);
long MYTERMI  (void *);

#ifndef NOAUX3270

/* Alter the original 3270 designer API commands to use the new ones available: */

#define MYTERMON MYTERMONi
#define MYTERMFF MYTERMFFi
#define MYTERMO  MYTERMOi
#define MYTERMI  MYTERMIi

#endif

/* JCC 3270-stream helper macros */

/* Macros to set properties */
#define attr_init(a) memset (a, 0x00, sizeof (a)); /* Use defaults */
#define attr_color(a, c) a [0] = c
#define attr_colour(a, c) a [0] = c
#define attr_style(a, c) a [1] = c
#define attr_protect(a, c) a [2] = c /* Only for in/out's */

/* Colour values */
#define attr_c_default    0x00
#define attr_c_bwhite     0xF7
#define attr_c_bcyan      0xF5
#define attr_c_byellow    0xF6
#define attr_c_bgreen     0xF4
#define attr_c_bpurple    0xF3
#define attr_c_bred       0xF2
#define attr_c_bblue      0xF1

/* Style values */
#define attr_s_default    0x00
#define attr_s_normal     0xF0
#define attr_s_underscore 0xF4
#define attr_s_blink      0xF1
#define attr_s_reverse    0xF2

/* Protection values */
#define attr_p_default    0x00
#define attr_p_unprotect  0x00
#define attr_p_protected  0x01

#endif