Chapter 2: Structures

This chapter lists the structures you can use to customize APS.


% BEGIN

Description:

Use in conditional or looping statement blocks to control the number of columns that APS moves the blocks during processing. The number of columns that % BEGIN is indented from a conditional or looping construct is the same number of columns that APS moves the subordinate block to the left. For example, if % BEGIN is indented four columns from an IF statement, all lines subordinate to % BEGIN move four columns to the left during processing. Any text at the same or lesser indentation than % BEGIN stops the effect of % BEGIN, and default processing resumes. Default processing moves the block to the starting column of the controlling conditional or looping construct.

Syntax:
% BEGIN
Comments:

Do not use the Customization Facility function &columnnumber+source with % BEGIN.

Examples:

Override default processing to shift the IF statement's subordinate statement block to start at column 12. Default processing shifts the block instead to the starting column of the IF statement--column 8--as shown below:

Input:

Column:  8...12..16
         % IF &TYPE = 'NEW'
             01  INV-ITEM.
                 05  PART-CLASS.
                     10  PART-NUMBER PIC X(5).

Default output:

Column:  8...12..16
         01  INV-ITEM.
             05  PART-CLASS.
                 10  PART-NUMBER PIC X(5).

Use % BEGIN to force the statement block to start at column 12:

Input:

Column:  8...12..16
         % IF &TYPE = 'NEW'
             % BEGIN
             01  INV-ITEM.
                 05  PART-CLASS.
                     10  PART-NUMBER PIC X(5).

Output:

Column:  8...12..16
             01  INV-ITEM.
                 05  PART-CLASS.
                     10  PART-NUMBER PIC X(5).
Related Topics:
See...
For more information about...

Functions, Customization Facility

Specifying the column number to place source code in the output

% REPEAT

% UNTIL/WHILE

Placement of looping structure output


Comments

Description:

Document Customization Facility source code with Comments.

Syntax:
%* comment text
Comments:
Example:
% DEFINE $SAMPLE-MACRO( ARG1, ARG2)
%* comment text
%* more comment text
Related Topics:
See...
For more information about...

APS Reference
Comments

Documenting APS source with Comments


Continuation

Description:

Continue Customization Facility statements on additional lines.

Description:
Statement
Continuation Method

Macro definition

Break the line after any comma in the argument list; skip to the next line and code a percent symbol, space, ellipsis, and at least one space (% ... ).

Macro call

Break the line after any comma in the argument list; skip to the next line and code an ellipsis and at least one space (... ).

Literal string in a variable assignment statement

Break the line anywhere in the string by coding a hyphen; skip to the next line and code a percent symbol, space, ellipsis, and at least one space (% ... ).

All other statements

Break the line after a blank space by coding a hyphen; skip to the next line and code a percent symbol, space, ellipsis, and at least one space (% ... ).

Examples:

Continue a macro definition.

% DEFINE $SAMPLE-MACRO( &ARG1, &ARG2, &ARG3, 
% ... &ARG4)

Continue a macro call.

$TABLE-MAKER( 3, 4, 'ENTRY', 'ITEM', 
... 'X(4) VALUE SPACES')

Continue a literal string variable value by coding a hyphen anywhere in the string.

% &VARIABLE = 'THIS WORKS-
% ... FINE'
% &VARIABLE = 'THIS WORKS FI-
% ... NE TOO'

Continue other statements where a space occurs.

% REPEAT VARYING &IM-TARG FROM -
% ... 1 TO 20
% IF &APS-IDENT < 8 -
% ... OR &APS-INDENT > 11
Related Topics:
See...
For more information about...

APS Reference:
"About Data Communication Calls"
"About Data Structures"
"About Database Calls"
"About S-COBOL Structures"

Continuing APS statements


% DECLARE

Description:

Define a % DECLARE table made of variable assignments that can be referenced either directly (after assigning values to its subscripts), or by searching with the % LOOKUP structure. Help access a loaded table made of variable assignments.

Syntax:
 % DECLARE &fieldname(&subscript1)[...(&subscriptN)]  
   [ % &declarepart1      [Xn|Nn|REDEFINES]
   .
   .
   .
     % &declarepartN       [Xn|Nn|REDEFINES]]
[% END]
Parameters:

&declarepart

Subscript-part of &fieldname. Indentation indicates subordination. Note the following:

  • Do not use an &declarepart as a &subscript.

  • If an alphanumeric or numeric picture clause (Xn or Nn) assigns a fixed length to a &declarepart, and &fieldname has more than one &declarepart, each &declarepart needs a picture clause.

  • The maximum &declareparts sum in one DECLARE structure level is 78 bytes.

  • The maximum number of &declareparts per table is 1000.

&fieldname

Name-assignment statement with zero or more subscripts and up to 78 &declareparts in each structure level.

&subscript

Set members of single- or multi-dimensional arrays. Values are numbers or strings (maximum 12 characters). For numeric values, the counter starts at 1 and increments until the end of the numeric value. The maximum number of &subscripts per program is 300.

Comments:
Examples:
Related Topics:
See...
For more information about...

% LOOKUP

Referencing a % DECLARE table


% DEFINE

Description:

Specify the name and formal arguments when defining a macro in a USERMACS file or APS program.

Syntax:
% DEFINE $macroname [(&formalarg1[, &formalarg2,
% ... &formalarg3, ..., &formalarg1000])]
  statementblock
[% END]
Parameters:

&formalarg

Formal argument list. Formal arguments receive their values from actual arguments in a macro call. Separate arguments with a comma and optionally one or more spaces. Enclose the argument list in parentheses.

$macroname

Valid COBOL name.

Examples:

Define a macro with three formal arguments whose values are supplied by a call that invokes the macro.

% DEFINE $ITEM-MAKER( &MM, &DATANAME, &TAIL)
.
.
.
% END

Macro call:

$ITEM-MAKER( 12, 'TEST-ITEM', 'S9(9) COMP SYNC VALUE -1')
Related Topics:
See...
For more information about...

Macro Call

Calling macros


Error Handling, Macros

Compatibility

All targets

Description:

APS writes error messages to a temporary file, passes them to the APS Precompiler, and displays them in the final APS message report of the compile.

Sending Messages

Send your own messages to the report, classified with a severity level, by coding one of the following SET statements:

% SET FATAL messagetext
% SET ERROR messagetext
% SET WARNING messagetext
% SET INFO messagetext

% SET FATAL ends all translation. Enclose variables in the message text within evaluation brackets.

Error Trace

% SET TRACE ERROR is an error trace mechanism that appears by default in the APS CNTL file APSDBDC. The trace identifies:

The severity codes of errors traced are: F(atal), E(rror), W(arning), and I(nformation). To exclude Information messages, append the keyword NOINFO to the % SET TRACE ERROR statement. To trace a selected section of your macro or program, code % SET TRACE ERROR and the beginning of the section, and % SET NOTRACE at the end.

Debugging with WRITE-CONTROL

% SET WRITE-CONTROL prints all Customization Facility input source in the output source, enabling you to view both the input and output source together, in context. It prints all error messages immediately below the source lines in error; they appear as COBOL Comments. This feature is especially helpful when examining complicated evaluation bracket processing.

Related Topics:
See...
For more information about...

% SET Statements

Coding other % SET statements

Evaluation Brackets

Processing with evaluation brackets


% ESCAPE

Description:

Stop processing the remaining lines of a macro and resume processing with the line immediately following the macro call.

Syntax:
% ESCAPE
Related Topics:
See...
For more information about...

APS Reference:
"ESCAPE"
"STOP RUN"

Terminating APS programs

APS Reference:
"MSG-SW"
"LINK"
"XCTL"

Calling or linking to other programs or subprograms


Evaluation Brackets

Description:

Specify the order in which the Customization Facility evaluates variable values.

Syntax:

Format 1:

... <% source> [...]

Format 2:

... <source> [...]
Parameters:

source

Can include:

  • An arithmetic expression; can include variables, numbers, and literals.

  • Variables

Comments:
Examples:

Before Customization Facility processing:

% &VAR = 6
% &XVAR = 7
    .
    .
    .
    ... <% &VAR + 3 + &XVAR>
    .
    .
    .
    ... <&VAR + 3 + &XVAR>

After Customization Facility processing:

The Customization Facility processor replaces the variables in the first set of brackets with their values, but does not calculate the result because the source is a Customization Facility statement, as indicated by the % symbol inside the brackets. At the next processing step--APS generation--the APS generator calculates the result.

The Customization Facility processor replaces the variables in the second set of brackets with their values and calculates the result, because the source is not a Customization Facility statement.

    .
    .
    .
    ... <6 + 3 + 7>
    .
    .
    .
    ... <16>

Before Customization Facility processing:

% &ITEM-COUNT = 75
% &PKG-COUNT = <&ITEM-COUNT + 50> / 50

After Customization Facility processing:

The Customization Facility adds 75 to 50 and divides the result by 50; assigns the result--2--as the value of &PKG-COUNT.

Related Topics:
See...
For more information about...

% SET Statements

Defining evaluation bracket characters

Macro Call

Using evaluation brackets to code in-line macros


Functions, Customization Facility

Description:

Perform predefined processes in a Customization Facility macro or APS program.

Syntax:
&APS-EPILOGUE
 
&APS-FULL
&APS-HALF
 
&APS-INDENT
 
&APS-PROGRAM-ID
 
&APS-PSB-NAME
 
&columnnumber+source
 
&COMPILETIME
 
&DEFINED( $macroname|&variablename)
 
&DEFVAL
 
&INDEX( 'wholestring', 'characterstring')
 
&LENGTH( string)
 
&NUMERIC( &variablename)
                 "literalstring"
&PARSE( &string[, &variable      ])
                 number
 
&SUBSTR( string, startcolumn[, length])
 
&dataname+-suffix
Description:

&APS-EPILOGUE

Returns the last macro call in the EPILOGUE queue. For information about calling macros with % SET EPILOGUE, see % SET Statements.

&APS-FULL

Returns a full-word binary PIC, a string containing a 4-byte (full-word) binary picture specification: PIC S9(9) COMP.

&APS-HALF

Returns a half-word binary PIC, a string containing a 2-byte (half-word) binary picture specification: PIC S9(4) COMP.

&APS-INDENT

Returns the indentation level for the current macro. Contains the column position of the $ of the invoking macro; otherwise, contains the column position of the left margin (usually column 7 for COBOL).

&APS-PROGRAM-ID

Returns the PROGRAM-ID name from the Identification Division.

&APS-PSB-NAME

Returns the user-specified PSB or subschema name for your program.

&columnnumber+source

Specifies the column number at which to place source code in the output.

&COMPILETIME

Returns the date and time of the compile:
dd mmm yy hh.mm.ss.

&DEFINED

Determines whether a specific macro or variable has a defined value. Returns a true value (1) if defined, and a false value (0) if not defined.

&DEFVAL

Returns the string or number value of the last &DEFINED variable, the string or number in &variablename.

&INDEX

Searches a string left to right for the first occurrence of a character-string. Returns a number identifying its character position; return 0 if no character string. Delimiting quotes are not included in the character position. (See also &SUBSTR below.)

&LENGTH

Returns a number specifying the length of the argument string. Leading and trailing blanks are included as part of a string; delimiting quotation marks are not.

&NUMERIC

Determines whether a variable is numeric. Returns a true value (1) if numeric and a false value (0) if non-numeric.

&PARSE

Parses a Customization Facility text string. &String must be a variable with a string value. The second argument can be either a literal text string, a variable with a string value, or a number (the number turns into a string).

The second argument is matched against the first argument (the string value of &string). The part of the &string value following the match is stored back into &string with the leading and trailing spaces eliminated. Then, the part of the &string value preceding the match returns as the value of the parsing function, again with no leading and trailing spaces. In matching the second string inside the first string, the match does not begin within a string that is embedded (quoted) within the first string.

&SUBSTR

Extracts a substring from a string, starting with startcolumn and continuing for substringlength.

String can be an alphanumeric literal string delimited with quotation marks, or a variable with a string value.

Startcolumn and substringlength can be a number or variable; if substringlength is omitted, the substring includes all characters from startcolumn onward.

Note the following:

  • If startcolumn is greater than substringlength, or if substringlength is 0, the result is an empty string.

  • If startcolumn plus substringlength is greater than substringlength, the result begins with string start character and ends with its last character; the substring is not padded with blanks.

&dataname+suffix

Appends a literal suffix to a variable data name by coding a plus symbol (+) in the space between them. During processing, the plus symbol disappears (it is not replaced with a space), and the suffix appends onto the resolved variable value.

Comments:
Examples:

Extract a substring from the string value of &PREFIX, starting with column 1 and continuing for 23 characters.

% &PREFIX = &SUBSTR( &PREFIX, 1, 23)

Extract substring values from the values of &RANDOM and &STUFF, and assign the result to MY-LANGUAGE. Note that &QT defines the delimiter character as the apostrophe; the quotation marks delimiting the string values are not considered part of the string and are stripped from the output.

Input source:

% &QT = "'"
% &RANDOM = &SUBSTR( "MEANINGLESS", 1, 4)
% &STUFF = &SUBSTR( "EXAMPLE", 3, 5)
MY-LANGUAGE = &QT&RANDOM&STUFF&QT

Output source:

MY-LANGUAGE = 'MEANAMPLE'
Related Topics:
See...
For more information about...

% DECLARE
% LOOKUP

Associative memory structures

% SET Statements

Calling EPILOGUE macros

Sample Macros

Examples: of functions


% IF/ELSE-IF/ELSE

Description:

Evaluate a condition.

Syntax:
 % IF condition1
  statementblock
 % ELSE-IF condition2
  statementblock
 % ELSE-IF conditionN
  statementblock
 % ELSE
  statementblock
[% END]
Parameters:

condition

Can be a:

Number, literal enclosed in apostrophes or quotation marks, or variable; followed by a space and a relational operator; followed by a space and a value. To specify multiple conditions, use the Boolean operators AND or OR with no parentheses.

Relational operator can be: =, NOT =, <, >, NOT <, NOT >, <=, >=.

Value can be a number, a literal enclosed in apostrophes or quotation marks, or a variable.

Comments:
Examples:

Test a variable for a numeric condition.

% IF &LEN = 80
% IF &APS-INDENT < 8

Test a variable for multiple conditions.

% IF &APS-INDENT < 8 OR &APS-INDENT > 11

Test a variable for a true condition, represented by the value 1.

% &EMPLOYEE-TYPE-A = 0
% &EMPLOYEE-TYPE-B = 1
% IF &EMPLOYEE-TYPE-B
    statementblock

Nest conditional statements.

% IF condition1
  statementblock1
    % IF condition2
        % IF condition3
  statementblock2
        % ELSE-IF condition4
        % ELSE-IF condition5
  statementblock3
        % ELSE
  statementblock4
    % ELSE
  statementblock5
        % IF condition6
            % IF condition7
  statementblock6
  statementblock7
Related Topics:
See...
For more information about...

% REPEAT
% UNTIL/WHILE

Conditional processing

% IF Structure Example

Examples: of conditional processing


% INCLUDE

Description:

Open, read, and process a user-defined macro, copybook, or other file in an APS program.

Syntax:
% INCLUDE ddname[(membername)] [submember]
Parameters:

ddname

Data set containing the file to include. Can be a partitioned data set, sequential file, or instream data set.

membername

Member of ddname

submember

Submember of membername

Comments:
Examples:
Related Topics:
See...
For more information about...

SY* Keywords

Specifying in an APS program the location where the Customization Facility places source code


Limits, Customization Facility

APS enforces the following size and programming limitations.

Item
Max

Indents

50

Nested macros

139

Macro call arguments

1000

Nested % INCLUDEs

10

% DECLARE statements:

 

Subscripts

300

Length of subscript

12

Tables

200

Parts per table

1000

Length of a table part

78

System limits:

 

Work files (beginning with WORK4)

8

LRECL of INCLUDE library

80

LRECL of extended INCLUDE library

140

Related Topics:
See...
For more information about...

APS Reference:
Limits

APS limits


% LOOKUP

Description:

Reference a % DECLARE table.

Syntax:
 % LOOKUP &declarepart oper searchval 
          [FROM value [valueN ...]]
  statementblock
[% ELSE-IF condition
  statementblock
   .
   .
   .
[% ELSE
  statementblock
[% END]
Parameters:

&declarepart

Name of variable assignment in % DECLARE table

condition

Condition can be a number or variable, followed by a space and a relational operator, followed by a space and a value. To specify multiple conditions, use the Boolean operators AND or OR with no parentheses.

Relational operator can be: =, NOT =, <, >, NOT <, NOT >, <=, >=.

Value can be a number, a literal enclosed in apostrophes or quotation marks, or a variable.

oper

Valid operator: =, NOT =, <, >, NOT <, NOT >, <=, >=.

searchval

Customization Facility term.

value

Starting value(s) of the low-order &subscript of the &fieldname associated with the &declarepart.

Comments:
Examples:
Related Topics:
See...
For more information about...

% DECLARE

Defining % DECLARE tables


Macro Call

Description:

Invoke a macro.

Syntax:
Format 1:
$macroname [(actualarg1[, actualarg2,
% ... actualarg3, ..., actualarg1000])]
Format 2:
sourcecode <$macroname( actualarg1, ... actualarg1000)> 
[... sourcecode]
Parameters:

actualarg

Actual argument list that corresponds to the formal argument list in the called macro's % DEFINE statement. Actual arguments pass values to their corresponding formal arguments.

Actual arguments are positional; if you omit any argument but the last one, code a comma in its place. Omitted arguments are called empty arguments.

Actualarg is a local variable and retains the values passed to it only from the time it is invoked until it ends.

Note: A variable defined outside the scope of a macro definition is global in scope.

An actual argument can be a:

  • Number (maximum 7 digits), positive (default) or negative

  • String enclosed by apostrophes or quotation marks

  • Variable whose value is assigned in a variable assignment statement (see Variable Assignment Statements)

  • Function (see Functions, Customization Facility)

  • Comma, indicating an empty argument. You can assign a default value to an empty argument, as shown in the example below.

  • Code the list according to the following rules:

  • Separate arguments with a comma and optionally one or more spaces.

  • Actual arguments are positional; if you omit any argument but the last one, code a comma in its place. Omitted arguments are called empty arguments.

  • Enclose the argument list in parentheses.

  • The maximum number of arguments in a list is 1000.

$macroname

Macro to be invoked; the macro must be defined in the USERMACS PDS or data set in your Project and Group

Comments:
Examples:

Pass the actual argument value 1 to the formal argument variable &ARG1 in the macro, and the actual argument value 3 to &ARG3. In the macro, give &ARG2 a default value of 0. Note that the extra comma between the actual arguments 1 and the 3 is a placeholder, indicating that the call does not pass an actual argument to &ARG2; it is an undefined, or empty argument. Rather than leave the empty argument undefined, assign to it the default value 0. Also note that the call does not pass an actual argument to &ARG4. It, however, needs no placeholder because it is the last argument in the list; the macro assumes it is undefined.


Note: Another way to assign a default value to an empty argument is to hard-code a variable assignment statement in the formal argument list as follows:

% DEFINE $SAMPLE-MACRO( &ARG1, &ARG2 = defaultvalue,
% ... &ARG3, &ARG4)

Pass a new value to &NEXT-VALUE each time that the in-line macro $CNTR is called.

% &CNTR = 0
% DEFINE $CNTR
    % &CNTR = &CNTR + 1
% END 
    .
    .
% &VALUE-<$CNTR> = &NEXT-VALUE
    .
    .
% &VALUE-<$CNTR> = &NEXT-VALUE
Related Topics:
See...
For more information about...

% DEFINE

Writing a macro % DEFINE statement


% REPEAT

Description:

Establish a loop and test a condition.

Syntax:
Format 1:
 % REPEAT
  statementblock
 % UNTIL|WHILE condition
[ statementblock]
[% END]
Format 2:
 % REPEAT VARYING|R-V &variable
 % ... [FROM &variable|literal|arithmeticexpr]
 % ... [BY &variable|literal|arithmeticexpr]
  statementblock
 % ... UNTIL|WHILE condition
[ statementblock]
[% END]
Format 3:
 % REPEAT VARYING|R-V &variable
 % ... [FROM &variable|literal|arithmeticexpr]
 % ... [BY &variable|literal|arithmeticexpr]
 % ... THRU|TO &variable|literal|arithmeticexpr
[% ... OR THRU|TO &variable|literal|arithmeticexpr]
[% ... OR THRU|TO &variable|literal|arithmeticexpr]
[% ... OR THRU|TO &variable|literal|arithmeticexpr]
  statementblock
[% END]
Parameters:

condition

Condition can be a number or variable, followed by a space and a relational operator, followed by a space and a value. To specify multiple conditions, use the Boolean operators AND or OR with no parentheses.

Relational operator can be: =, NOT =, <, >, NOT <, NOT >, <=, >=.

Value can be a number, a literal enclosed in apostrophes or quotation marks, or a variable.

statementblock

Can contain any Customization Facility, COBOL or COBOL/2, or S-COBOL statements.

variable

Customization Facility variable with valid COBOL name.

Comments:
Related Topics:
See...
For more information about...

% UNTIL/WHILE

Testing % REPEAT loops

Evaluation Brackets

Specifying the order in which the Customization Facility evaluates variable values

Looping Example

Examples: of looping


% SET Statements

Description:
Syntax:
Description:

NORMAL-OUTPUT | AUXILIARY-OUTPUT

NORMAL-OUTPUT (default) directs all source code to the file with the external name POSTSOUT.

AUXILIARY-OUTPUT directs all source code to the file with the external name MACRO.

Note: You must define MACRO and its accompanying DD name in your JCL.

BLANK | NOBLANK

BLANK (default) prints all blank lines that appear in the input.

NOBLANK suppresses blank lines from printing.

COMMUNICATION [SECTION]

Moves all source code appearing between this statement and the next % SET statement from the Procedure Division to the end of the Communication Section.

PRESERVE LOWER-CASE | CONVERT-LOWER-CASE

PRESERVE-LOWER-CASE (default) allows developers to use both upper and lower case characters in Customization Facility structures.

CONVERT-LOWER-CASE converts lower case characters in Customization Facility structures to upper case.

DATA [DIVISION]

Moves all source code appearing between this statement and the next % SET statement from the Procedure Division to immediately after the Data Division header.

DELIMITERS-REQUIRED | DELIMITERS-OPTIONAL

DELIMITERS-REQUIRED (default) requires developers to delimit strings with apostrophes or quotation marks, depending on the value you set on the APS Precompiler Options window.

DELIMITERS-OPTIONAL allows developers to omit delimiters around all strings except those that consist of all numbers or include special characters.

END-WORKING-STORAGE

Marks a spot in Working-Storage to place source code that you move from the Procedure Division to Working-Storage using the % SET WORKING-STORAGE statement. Non-APS preprocessors can reserve the end of Working-Storage for their constructions.

ERROR | FATAL | WARNING | INFO messagetext

Sends a message to the final message report of the compile. Enclose variables in messagetext with evaluation brackets.

EPILOGUE [$macroname]

Calls macroname after all other Customization Facility processing finishes. Although you can specify only one macro call per EPILOGUE statement, you can write multiple statements. APS stores all EPILOGUE macro calls in an EPILOGUE queue, and invokes them in "last in, first called" order. The variable &APS-EPILOGUE contains the name of the macro call that is currently last in the EPILOGUE queue. Assuming that you code the EPILOGUE statement anywhere in the Procedure Division, APS places the invoked macros at the end of the Procedure Division. To eliminate the current "last in" macro from the queue, follow the last % SET EPILOGUE statement with a % SET EPILOGUE statement, without specifying the macro name; APS gets the macro name value from &APS-EPILOGUE.

Important: The results of calling APS macros in an EPILOGUE macro can be unpredictable. We recommend that you call only user-defined macros in an EPILOGUE macro.

EVAL-BRACKETS 'leftright'

Defines the characters to use as evaluation brackets. Default is < and >. We recommend using the default because that is what the APS macros use; we do not recommend using the parentheses characters as brackets.

EVAL-BRACKETS-AUX 'leftright'

Defines an auxiliary set of evaluation bracket characters to supplement the primary set defined by % SET EVAL-BRACKETS. Ensure that % SET EVAL-BRACKETS is also defined.

FILE-CONTROL

Moves all source code appearing between this statement and the next % SET statement from the Procedure Division to the end of the File-Control paragraph. APS generates the Input-Output Section and File-Control headers unless they are in the input source or if the macro is an EPILOGUE (see EPILOGUE above).

FILE [SECTION]

Moves all source code appearing between this statement and the next % SET statement from the Procedure Division to the end of the File Section. APS generates the File Section header unless it is in the input source or if the macro is an EPILOGUE (see EPILOGUE above).

LEFT-MARGIN columnnumber RIGHT-MARGIN columnnumber

Default: columns 1-72. Overrides the LANG option on the APS Precompiler Options window, which specifies the columns for the Customization Facility to process. Use these statements to specify the leftmost and rightmost columns to process, within the parameters of the value of LANG.

LINKAGE [SECTION]

Use in the Procedure Division to move all source code appearing between this statement and the next % SET statement to the end of the Linkage Section. APS generates the Linkage Section header unless it is in the input source or if the macro is invoked by % SET EPILOGUE (see EPILOGUE above).

LOOP-LIMIT

Overrides the internal loop counter default (500) in the APS CNTL file APSDBDC. Override with a number as high as 999999. Because some APS libraries reset LOOP-LIMIT to 200, you might need to reset the limit after an % INCLUDE statement.

PROCEDURE

Mark the end of the preceding relocation statement and return to the location of the statement (not the beginning or end of the Procedure Division).

SPECIAL-NAMES

Use in the Procedure Division to move all source code appearing between this statement and the next % SET statement to the end of the Special-Names paragraph. APS generates the Special-Names header unless it is in the input source or if the macro is an EPILOGUE (see EPILOGUE above).

TRACE ERROR [NOINFO]

TRACE ERROR traces all source code appearing between this statement and NOTRACE and reports on all errors of all severity levels--F(atal), E(rror), W(arning), and I(nformation). TRACE ERROR displays error messages and other information including: the line of source that caused the error; active % INCLUDE statements; active macros; and the number of loops completed at the time of error (if applicable)

TRACE ERROR NOINFO traces all levels of errors except I(nformation).

WORKING-STORAGE

Use in the Procedure Division to move all source code appearing between this statement and the next % SET statement to the end of the Working-Storage Section or immediately in front of the % SET END-WORKING-STORAGE statement, if coded.

WRITE-CONTROL
[-LIMIT number] and NOWRITE-CONTROL

WRITE-CONTROL prints in the output all Customization Facility source code appearing between this statement and % SET NOWRITE-CONTROL; default is 5000 lines.

Examples:

Store three macro calls in the EPILOGUE queue, but invoke just $MACRO-1.

% SET EPILOGUE $MACRO-1
% SET EPILOGUE $MACRO-2
% SET EPILOGUE $MACRO-3
    %* Current value of &APS-EPILOGUE is $MACRO-3.
    .
    .
    .
% SET EPILOGUE
    %* $MACRO-3 (the current value of &APS-EPILOGUE) is
    %* elminated from the EPILOGUE queue; 
    %* the new current value of &APS-EPILOGUE is $MACRO-2.
    .
    .
    .
% SET EPILOGUE
    %* $MACRO-2 (the current value of &APS-EPILOGUE) is
    %* eliminated from the EPILOGUE queue; 
    %* the new current value of &APS-EPILOGUE is $MACRO-1.
    %* $MACRO-1 (the current value of &APS-EPILOGUE) is
    %* invoked.
Related Topics:
See...
For more information about...

SY* Keywords

Specifying in an APS program the location where the Customization Facility places source code

Evaluation Brackets

Specifying the order in which the Customization Facility evaluates variable values

Program Location Statements Example

Examples: of program location statements


SY* Keywords

Description:

Specify in an APS program the location where the Customization Facility places source code.

Syntax:
-KYWD-  12-*----20---*----30---*----40---*----50---*----60
 SYBT   macrocode
 
 SYEN   macrocode
 
 SYDD   macrocode
 
 SYFD   macrocode
 
 SYIO   macrocode
 
 SYLT   macrocode
 
 SYLK   macrocode
 
 SYM1   macrocode
 
 SYM2   macrocode
 
 SYRP   macrocode
 
 SYWS   macrocode
Locations in Generated Code

SYM1

At the beginning of the program, before macro libraries that you include at the beginning of the program

SYM2

After macro libraries that you include at the beginning of the program

Environment Division

SYEN

In the Environment Division, after the Special-Names paragraph

SYIO

In the Input-Output Section, after macro libraries that you include at the beginning of the Input-Output Section

Data Division

SYDD

At the beginning of the Data Division

SYFD

In the File Section, after macro libraries that you include at the beginning of the File Section

SYWS

In the Working-Storage Section, after macro libraries and data structures that you include in Working-Storage

SYLT

In the Linkage Section, after macro libraries and data structures that you include at the beginning of Linkage

SYLK

In the Linkage Section, after source code that you include with the SYLT keyword

SYRP

In the Report Section, after any macro libraries that you include at the beginning of the Report Section

Procedure Division

SYBT

At the end of the program

Comments:
Examples:
Related Topics:
See...
For more information about...

% SET Statements

Specifying the program location where the Customization Facility places source code

% INCLUDE

Including macros or copybooks in a macro

APS Reference:
"Keywords"

Other APS keywords


% UNTIL/WHILE

Description:

Establish a loop and test a condition to execute a subordinate statement block either until or while a single or compound condition is satisfied.

Syntax:
 % UNTIL|WHILE condition
  statementblock
[% END]
Parameter:

condition

Valid values:

  • Constant numeric term

  • Relational operator can be: =, NOT =, <, >, NOT <, NOT >, <=, >=.

  • Variable that has a numeric true/false value

AND or OR may connect multiple logical terms. Do not use parentheses.

Comments:
Related Topics:
See...
For more information about...

% REPEAT

Using % UNTIL or % WHILE with a % REPEAT loop

Looping Example

Examples: of looping


Variable Assignment Statements

Description:

Assign a value to a Customization Facility variable.

Syntax:
% &variable = stringterm|numericterm
Parameters:

numericterm

Numeric term can be one or a combination of:

  • A number (maximum 7 digits), positive (default) or negative

  • A number that is a true/false representation of a variable, where 0 = false and nonzero = true

  • An arithmetic expression with arithmetic operators listed in order of processing: * (multiplication), / (division), + (addition), - (subtraction)

  • A Customization Facility number function

variable

Valid COBOL name

stringterm

String term can be:

  • Text enclosed by apostrophes or quotation marks

  • A &variable with a string value

  • A Customization Facility string function

Examples:
Related Topics:
See...
For more information about...

Functions, Customization Facility

Using Customization Facility functions

 


Copyright © 2002 Micro Focus International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.