The mkheader command allocates user memory for script variables.
Synopsis
mkheader
application_name
Description
The mkheader program creates an address in user memory for each script variable. This information is stored in an application_name def.h header file and is used in naming both the output file and the allocation program. The joint usage of the same header file enables the script to interact with the transaction state machine (TSM). The -e option specifies exact string matches.
The mkheader program prompts an operator to enter three types of information at the system console. The information may be entered interactively or batched together in a single file. Interactive entries are ended by entering CTRL+D. The system prompts for:
When mkheader is entered with an argument (limited to 7 characters) for application_name, an application_name def.h header file is created for the output information. The mkheader program prompts for three types of information that it uses in producing the output file. The mkheader program prompts the operator for the name of one of the variables: char, int, or short. Note that char is the only variable that requires a length (default = 1). The mkheader program allocates space for the variables at the beginning of the allowable user memory and places this information in the newly created header file.
The mkheader command prompts the operator to enter header files that are needed to make the files covered in the third section compile. They should be named in the order of dependence. For example, if information in the header file b.h is needed by the header file a.h, header file b.h must be entered before header file a.h.
Full pathnames must be given. The file mesg.h and the structure mbhdr are common to all scripts and are entered automatically.
The header files can be stored in a batch file. The batch file could contain the following header files:
#include "/att/msgipc/dbcom.h"
#include "/att/include/shmemtab.h"
#include "/att/msgipc/tsm stop.h"
#include "/att/msgipc/cdata.h"
The last prompt is used for allocating the space for each structure. The operator is prompted to enter each header file name and its structure names. For each header file, the operator enters all (if all structures are needed) or specific structure names.
The mkheader command recursively allocates memory and produces application-name def.h defines for structure members that are themselves structures (except for struct mbhdr).
As a shortcut, the input for the three prompts may be stored in another file (data file) and read in each time. For example:
mkheader application_name < data file
Once the header files have been entered, mkheader writes a program called application_name_ aloc.c to allocate the rest of user memory. The resulting source code is automatically compiled, using mkheader.a library functions, and executed. This adds the remaining structure definitions to the
application_name def.h header file. TSM does not allow a script to use more than 50,000 bytes of user memory. Scripts that exceed this limit are not run when data beyond the limit are accessed.
Files
The following files are associated with the mkheader command:
Examples
The following are examples of the prompts and the output for the mkheader program. This example shows a user who needs some space for 20 characters, 2 integers, and a short variable. The user also needs to have space declared for a structure called dowj, which is used by the script. The header file is found in /att/msgipc/tsmdipappl.h.
In the example, the structure size of SZDOWJ is 16, which is automatically supplied by mkheader.
console input: mkheader application_name
FIRST PROMPT: Type in the variables you need space for according
to the following format:
type name [length]
Example 1: int yn
Example 2: char dg 20
(End input with CTRL-D)
Variable?: char dg 20
Variable?: int yn
Variable?: short cid
Variable?: int iom
Variable?: (CTRL-D)
SECOND PROMPT: Please enter any dependency files that the header
files in the next section will need in order to compile. Use
full path names. (End input with CTRL-D)
File name? /u/factory/file.h
File name? (CTRL-D)
THIRD PROMPT: Enter the header file name and structure names
needed to create the def.h file. Use full path names. (End
input with CTRL-D)
Header file?: /att/msgipc/tsmdipappl.h
Structures or all?: dowj
Header file?: (CTRL-D)
Compiling: application-name aloc.c
Running: application-name aloc
Output is called: application-name def.h
The following is the final application-name def.h file produced by this example.
/*****PRE-ALLOCATION OF USER SPACE *****/
#define DG:0
#define YN:20
#define CID:24
#define IOM:26
/***** DOWJ STRUCTURE *****/
#define DOWJ:30
#define RCODE:30
#define TIMEDATE:31
#define CATNUM:42
#define MKTSTAT:43
#define DOWHOUR:44
#define SZDOWJ:16
In the second example, the command line includes a data file from which the system gets the information usually entered by the users in response to system prompts.
The data file, called data in this example, contains the following information:
char name 20
int answer
short reply
^D
/att/include/shmemtab.h
^D
/att/msgipc/cdata.h
Day_pntr cdata
^D
The following is displayed on the screen:
Interactive Response% mkheader test6 < data
Type in the variables you need space for according to the following format:
type name [length]
Example 1: int yn
Example 2: char dg 20
(End input with CTRL-D)
Variable?:
Variable?:
Variable?:
Variable?:
Please enter any dependency files that the header files in the next section will need in order to compile.
Use full path names.
(End input with CTRL-D)
File name?: File name?:
Enter the header file names and structure names needed to create the def.h file. Use full path names.
(End input with CTRL-D)
Header file?: List of structures or all?:Header file?:
Compiling /usr/has/another/test6_aloc.c
Running /usr/has/another/test6_aloc
Output is called /usr/has/another/test6def.h
I am now checking for any duplicate defines that will cause problems
The following is the contents of the test6def.h file:
/******* PRE-ALLOCATION OF USER SPACE *******/
#define NAME:0
#define ANSWER:20
#define REPLY:24
/******* DAY_PNTR STRUCTURE *******/
#define DAY_PNTR 26
#define FILE_FIRST 26
#define REC_FIRST 28
#define FILE_LAST 30
#define REC_LAST 32
#define SZDAY_PNTR 8
/******* CDATA STRUCTURE *******/
#define CDATA 34
#define SCRIPT 34
#define CHAN 50
#define EQUIP 52
#define STARTTIME 54
#define STOPTIME 58
#define EV0 62
#define EV1 66
#define EV2 70
#define EV3 74
-:
-:
-:
#define EV96 446
#define EV97 450
#define EV98 454
#define EV99 458
#define SZCDATA 428
Make sure that all variable names are unique without respect to case because lower case letters are changed to upper case for the final output.