Last updated 18 Nov 97
FACGEN is a FORTRAN preprocessor that generates programs capable of creating new task factors. New task factors are computed by mathematically interacting available task factor data, conditional expressions, and data constants. Some examples of factors that might be created are a factor where each task value is the sum of some other task factors, or a factor where all task values are set to zero when the percent time spent value for the task falls below a certain value. Virtually any mathematical computation may be performed to produce the new factor.

Program Invocation
The specific syntax for program invocation varies between operating systems. This document diplays the code for the AIX version.
opt: N NOGO option, perform control card check, generate source code,
compile, list errors, stop
L List generated source code, compile, and map
C Copy input factors to output FACSET file
ssss: The study number
FS1: Input FACSET file
TFf: Output Task Factor file, required if the created task factors
are to be saved.
FS2: Output FACSET file (optional)
FACGEN Control Card
FACGEN: cc 01-06 The literal 'FACGEN' stdy: cc 08-11 The study number for this run title: cc 13-72 The title to be used on the output report
Factor Description Cards
This set of control cards must contain one card for each task factor to be used for input or output during the FACGEN run. The information contained on these cards directs FACGEN to the proper source for acquiring the factors, and provides a means of assigning meaningful names to each of the factors used. The names provided on this set of cards are used in the user specified logic to refer to the numeric values associated with that factor.
The cards used in this section must be in one of the following two forms. The form used depends on whether the factor is to be input from the input FACSET file, or output onto either of the two output files.
Factors Input from the FACSET File
This format is used for input task factors which are to be found on the input FACSET file. This card allows the user to name any of the values desired for use in computations. The task factor value, mean, standard deviation, minimum value, and maximum value are all available for use in computations. It is only necessary to provide names for the values which are to be used in computations. These names must begin with a letter.
I: cc 01 The literal 'I' value: cc 03-08 A name to reference this task factor. =: cc 09 The literal '=' factor: cc 10-12 The factor number from the FACSET file mean: cc 14-19 The name of the mean value for this factor. s.d.: cc 21-26 The name of the standard deviation for this factor. min: cc 28-33 The name of the minimum value for this factor. max: cc 35-40 The name of the maximum value for this factor.
Factors Created For Output
This format is used for task factors which are to be generated. Like the input factors cards, these cards provide a means of naming the task factor for use in the user logic section of this run. Values stored into this factor in the logic section may be used as input for other computations. This card also captures a title for the generated output factor.
O: cc 01 The literal 'O' (not zero)
value: cc 03-08 A name for this task factor, one to six characters long.
The first character must be alphabetic.
=: cc 09 The literal '='
title: cc 10-62 The title for the output factor
min: cc 64-71 The minimum acceptable value (default = actual min)
max: cc 73-80 The maximum acceptable value (default = actual max)
These cards are terminated by an '@eof' image.
User Logic Specification Cards
The cards in this section determine the values assigned to the generated task factors. All input and output task factors must be defined as described in the previous sections. All names assigned to the factors in the previous sections are floating point decimal values. Any variables created with the cards described in this section will be treated as integers if the first character of the variable name is one of the letters I through N. Any variable name which begins with a letter other than I through N will be treated as a floating point decimal number. The cards will be executed once for each task in the inventory.
A special feature exists for statements which are too long to fit on a card. The statement may be continued on subsequent cards by adding a '#' character as the last non-blank character of the card. The '#' character is called a continuation sentinel and must occur before column 67 on the card containing the unfinished statement. This forces FACGEN to append the statement on the next card to the unfinished statement. As statement may be contained on as many as 25 cards using the continuation sentinel. The continuation sentinel is not used on comment cards.
There are several useful variables available for computations. These variables are the number of tasks (N$TASK), number of duties (N$DUTY), number of cases (N$CASE), task number (I$TASK), and the CODAP invalid value (BADVAL).
Spaces are ignored by FACGEN, but it is recommended that spaces be used to improve the readability of the cards. All information on the cards in this set must be contained in card columns 1-66. Any information outside of these columns will be ignored. The three sections which follow the general card format contain detailed information about the three specific types of statements permitted on these cards.
*: cc 01 If an asterisk is placed in column 1 the information on the
card will be regarded as comments.
statement:cc 01-66 Any expression or statement which conforms to the
specifications given in the next three sections.
#: The # character can be used to force the next statement to
be regarded as a continuation of the current card
Computation Cards
Computation cards contain mathematical expressions which assign a value to a variable. Any mathematical operation or function available to the FORTRAN compiler may be used on these cards. The general form for computation cards is as follows.
The expressions used on these cards may contain more than one operation. If multiple operations are used, the order in which the operations are evaluated conforms to the rules set forth in your installation's current Fortran Manual. Parentheses may be used to change the order of evaluation. Any mathematical expression constructed to the specifications above and valid according to the FORTRAN manual is acceptable.
Condition Specification Cards
The condition specification cards are used to cause or prevent the performance of a statement or a group of statements. The user may build IF-THEN-ELSE constructs as long as the statements are acceptable to the FORTRAN compiler.
Do not use GOTO statements or any statement with a label.
These cards are terminated by an end-of-file or an '@eof' image.
Example
@codap facgen c ssss fs001 tf100 fs002 FACGEN ssss The C option copies input factors to the output file I VAR001=002 I VAR002=004 I VAR003=007 I VAR004=009 O NUMB01=Factor #2 squared O NUMB02=This is GP0010 PTS * GP0010 PMP O NUMB03=This is ST0028 PTS weighted by factor 2 O NUMB04=This is a calculation @EOF NUMB01=BADVAL NUMB03=BADVAL IF (VAR001.NE.BADVAL) NUMB01=VAR001*VAR001 *This is a comment line in a FACGEN run NUMB02=VAR002*VAR003 IF (VAR001.NE.BADVAL) NUMB03=VAR001*VAR004 NUMB04=SQRT(VAR004)-3.1416 @EOF
This FACGEN does simple computations to create four new factors based on calculations on input factors. The factors will be written onto both the output Task Factor file (tf100) and the output FACSET file (fs002).