TERM

Category:

Data communication call (see Data Communication Calls)

Description:

Terminate programs and transaction operations.

Under ISPF Dialog, perform internal program cleanup, terminate the program via GOBACK statement, and return control to the calling program.

Syntax:
[TP-]TERM
Comments:
CICS

IMS DC

Use TERM after sending output messages (SEND or MSG-SW) with CONTINUE. Do not use TERM prior to sending at least one response; this causes a user terminal in response mode to remain locked, awaiting a response.

Example:

Terminate a program when SCRA-FUNCTION = 'E' or PF3 is pressed.

IF  SCRA-FUNCTION = 'E' OR PF3
    TERM

TERMINATE

Category:

Report Writer statement (see Report Writer Structures and the Report Writer chapter in your APS User's Guide)

Compatibility:

Batch environments

Description:

End report processing. TERMINATE:

Syntax:
TERMINATE reportname1 [,reportname2] ...
Parameter:

reportname

Identify the report. Define reportname in a RED statement in the Report Section of the Data Division.

 

Comments:


TP-BACKOUT

Category:

Data communication call (see Data Communication Calls)

Compatibility:

CICS and IMS DC targets

Pupose

ABEND the program.

Syntax:
CICS
TP-BACKOUT [ABORT[(name)]|NOABORT]
IMS DC
TP-BACKOUT [ABORT|NOABORT]
Parameters:
CICS

ABORT(name)

Invoke CICS ABEND to terminate task. Name specifies a formatted dump of main storage; can be literal or COBOL data name (maximum 4 characters).

NOABORT

Nonfunctional--allowed for compatibility with IMS.

IMS DC

ABORT

Cancel program and do not reschedule.

NOABORT

Default. Return next input message for processing.

Comments:
IMS DC

Examples:

The following three examples execute identically. Each terminates a task abnormally by invoking a CICS ABEND code.

TP-BACKOUT
TP-BACKOUT ABORT
TP-BACKOUT NOABORT

Specify a recovery option and code name to identify a main storage dump related to the task.

TP-BACKOUT ABORT('PGM1')

TP-COMMAREA

CICS

Description:

TP-COMMAREA generates a Working-Storage record for passing data between programs. This record contains APS information as well as user data.

There is no need to code a TP-COMMAREA call; APS generates it. The value of &TP-USER-LEN--the default is 80--determines the size of TP-USERAREA, the user portion of TP-COMMAREA. You can accept the APS default of a single Commarea field, TP-USERAREA, or redefine TP-USERAREA as multiple Commarea fields.

The following calls pass a Commarea.

SEND

Send a screen to the terminal and terminate the program. CICS saves the data stored in the TP-COMMAREA and makes it available to the next program when APS returns the screen to CICS.

LINK

Link to a subprogram, passing it the TP-COMMAREA address. Define COMMAREA identically in each program.

XCTL

Transfer control to another program, passing a copy of TP-COMMAREA. Define TP-COMMAREA identically in both programs.

You can redefine TP-USERAREA to fit program requirements.

Optionally, you can code the redefinition in a copybook or rule that you include.

Example:

Redefine TP-USERAREA in the Program Painter.

-KYWD-  12-*----20---*----30---*----40---*----50---*----60
 SYM1   % * SET THE LENGTH OF TP-USERAREA TO
        % * 21 BYTES
        % &TP-USER-LEN = 21
 CA     AACA-USERAREA
            CA-DATE                X8
            CA-TIME                X8
            CA-CUST-NUMBER         X5
-KYWD-  12-*----20---*----30---*----40---*----50---*----60
 SYM1   % * SET THE LENGTH OF TP-USERAREA TO
        % * 21 BYTES
        % &TP-USER-LEN = 21
 CA05   AACA-USERAREA
        10  CA-DATE                X8
        10  CA-TIME                X8
        10  CA-CUST-NUMBER         X5

Redefine TP-USERAREA in the Data Structure Painter.

AACA-USERAREA
    CA-DATE                X8
    CA-TIME                X8
    CA-CUST-NUMBER         X5

Each of the above generates:

01  TP-COMMAREA
          .
          .
          .
01  FILLER REDEFINES TP-COMMAREA.
    05  FILLER                PIC X(40).
    05  TP-USERAREA           PIC X(21).
    05  AACA-USERAREA   REDEFINES TP-USERAREA.
        10  CA-DATE           PIC X(08).
        10  CA-TIME           PIC X(08).
        10  CA-CUST-NUMBER    PIC X(05).

IMS DC

Description:

TP-COMMAREA coordinates the placement of the APS-generated Commarea structure with a user-provided redefinition of that structure. Use it only with conversational IMS programs--nonconversational IMS programs do not use a Commarea.

In IMS, the Commarea is called a SPA (Scratch Pad Area). Its reserved prefix includes an IMS LLZZ field, the input trancode, and the APS invocation mode flag.

There is no need to code a TP-COMMAREA call; APS generates it. The value of &TP-USER-LEN--the default is 0--determines the size of TP-USERAREA, the user portion of TP-COMMAREA. You can accept the APS default of a single Commarea field, TP-USERAREA, or redefine TP-USERAREA as multiple Commarea fields. You must define the Commarea in Working-Storage.

To redefine TP-USERAREA as a group-level data structure, the length must be the same as the value specified for &TP-USER-LEN. A CA01 keyword generates an 05-level REDEFINES TP-USERAREA statement.

To generate a single-field Commarea in Working-Storage called TP-USERAREA, assign a value to the APS variable &TP-USER-LEN. Code the following on one line.

-KYWD-  12-*----20---*----30---*----40---*----50---*----60
  SYM1   % &TP-USER-LEN = number

Example:
-KYWD-  12-*----20---*----30---*----40---*----50---*----60
 SYM1   % &TP-USER-LEN = 100 
 CA05   MY-REDEF
        10 CA-FLD-A            PIC X(10).
        10 CA-FLD-B            PIC S9(4) COMP.
        10 CA-FLD-C            PIC X(20).

Generated source:

% &TP-USER-LEN = 100
IDENTIFICATION DIVISION
          .
          .
WORKING-STORAGE SECTION.
$TP-WS-MARKER
$TP-COMMAREA
    05  MY-REDEF REDEFINES TP-USERAREA.
        10 CA-FLD-A            PIC X(10).
        10 CA-FLD-B            PIC S9(4) COMP.
        10 CA-FLD-C            PIC X(20).

ISPF Dialog

Description

TP-COMMAREA generates a Working-Storage record for passing data between programs. This record contains APS information and user data.

There is no need to code a TP-COMMAREA call; APS generates it. The value of &TP-USER-LEN - the default is zero - determines the size of TP-USERAREA, the user portion of TP-COMMAREA. You can accept the APS default of a single Commarea field, TP-USERAREA, or redefine TP-USERAREA as multiple Commarea fields. You must define the Commarea in Working-Storage.

To redefine TP-USERAREA as a group-level data structure, the length must be the same as the value specified for &TP-USER-LEN. A CA01 keyword generates an 05-level REDEFINES TP-USERAREA statement.

To generate a single-field Commarea in Working-Storage called TP-USERAREA, assign a value to the APS variable &TP-USER-LEN. Code the following on one line.

-KYWD-  12-*----20---*----30---*----40---*----50---*----60
 SYM1    % &TP-USER-LEN = number

Example:

Redefine TP-USERAREA.

-KYWD-  12-*----20---*----30---*----40---*----50---*----60
 SYM1   % &TP-USER-LEN = 49 
CA05   PGM-USERAREA
            10  CA-EMPLOYEE-NAME    PIC X(20).
            10  CA-EMPLOYEE-TITLE   PIC X(20).
            10  CA-EMPLOYEE-SSN     PIC X(09).

Generated source:

01 TP-COMMAREA.
   05  TP-USERAREA              PIC (X49).
   05  PGM-USERAREA REDEFINES TP-USERAREA.
       10  CA-EMPLOYEE-NAME     PIC X(20).
       10  CA-EMPLOYEE-TITLE    PIC X(20).
       10  CA-EMPLOYEE-SSN      PIC X(09).

TP-LINKAGE

Category:

Data communication call (see Data Communication Calls)

Compatibility:

CICS, IMS DC, and ISPF Dialog

Description:

Handle addressability of Linkage Section data records in a called program.

Syntax:
TP-LINKAGE linkdataname[/copybookname|macrofilename]
... [linkdataname[/copybookname|macrofilename] ...]
Parameters:

/copybookname

Name of copybook that you INCLUDE or COPY prior to this call. See also "Comments" below.

linkdataname

01-level Linkage Section data area identical to the linkdataname in the associated call.

/macrofilename

Name of macro file that you INCLUDE or COPY prior to this call. See also "Comments" below.

 

Comments:

CICS

IMS DC

ISPF Dialog

Examples:

Define records LINK-REC-1 and LINK-REC-2. Include definitions from USERMACS macro members LINKR1 and LINKR2.

TP-LINKAGE LINK-REC-1/LINKR1 LINK-REC-2/LINKR2

Define records LINK-REC-1 and LINK-REC-2 and copy their definitions from COPYLIB members LINKR1 and LINKR2.

% &TP-COPY-LINKAGE = 1
TP-LINKAGE LINK-REC-1/LINKR1 LINK-REC-2/LINKR2

Define records LINK-REC-1 and LINK-REC-2, coded in the Linkage Section.

TP-LINKAGE LINK-REC-1 LINK-REC-2

Define records LINK-REC-1 and LINK-REC-2. LINK-REC-1 has been coded in the Linkage Section; LINK-REC-2 is copied from COPYLIB member LINKR2.

% &TP-COPY-LINKAGE = 1
TP-LINKAGE LINK-REC-1 LINK-REC-2/LINKR2
LINK-REC-1       PIC X(100).
CICS

Linkage record containing 10,000 bytes.

-KYWD-  12-*----20---*----30---*----40---*----50---*----60
 SYLK   TP-LINKAGE LINK-REC
        ... DUMMY-LINK-REC-BLL1/DUMMY
        ... DUMMY-LINK-REC-BLL2/DUMMY
 LK01   LINK-REC.
        05  LINK-REC-1-4096       PIC X(4096).
        05  LINK-REC-2-8192       PIC X(4096).
        05  LINK-REC-3-10000      PIC X(1808).
 OPT    PROG
 NTRY
        CIC-GETMAIN
        ... SET(LINK-REC)
        ... LENGTH(10000)
        /* PROGRAM HAS ADDRESSABILITY TO
        /* THE FIRST 4,096 BYTES.
        ADD 4096 LINK-REC--P
        ... GIVING DUMMY-LINK-REC-BLL1--P
        ... GIVING DUMMY-LINK-REC-BLL2--P
        /* PROGRAM HAS ADDRESSABILITY TO 
        /* ALL 10,000 BYTES.
ISPF Dialog

Define a PARM area for use by TP-LINK and TP-ENTRY. The PROGRAM CONTROL TRANSFER option has been set to SELECT. PGM-PARM-DATA is coded inline. Note: You can place the PGM-PARM-DATA area in Linkage without the use of TP-LINKAGE.

-KYWD-  12-*----20---*----30---*----40---*----50---*----60
 SYLK   TP-LINKAGE PGM-PARM-DATA
 LK01   PGM-PARM-DATA.
            05  PGM-PARM-DATA-LEN   PIC S9(04) COMP.
            05  PGM-PARM-EMPNBR     PIC X(05).
            05  FILLER              PIC X(95).

TP-NULL

Category:

Data communication call (see Data Communication Calls)

Compatibility:

CICS, IMS DC, and ISPF Dialog targets

Description:

Move LOW-VALUES to all fields in a specified screen record.

Syntax:
TP-|SC-NULL screenname
Parameter:

screenname

Screen name; value must be literal.

 

Comment:

This call does not alter the field attributes.

Example:

Move LOW-VALUES to all fields on screen SCRA.

TP-NULL SCRA

TP-PERFORM

Category:

Data communication call (see Data Communication Calls)

Description:

Perform a paragraph, with or without passing arguments.

Syntax:

Format 1, perform a paragraph:

TP-PERFORM paragraphname

Format 2, perform a paragraph and pass arguments:

TP-PERFORM paragraphname actualargument1[[,]
... actualargument2[,] ... actualargument8]
          .
          .
          .
paragraphname ([+|-]formalargument1[[,]
... [+|-]formalargument2[,] ... [+|-]formalargument8])
Parameters:

+|-

A plus (+) or minus (-) sign preceding a formalargument passes values between actual arguments and formal arguments, as follows:

  • With a plus sign (+), PERFORM passes the actualargument value to formalargument after the paragraph executes. The program does not return the formalargument value to actualargument.

  • With a minus sign (-), PERFORM passes the formalargument value to the actualargument after the paragraph executes.

  • If there is no prefix, the PERFORM passes the actualargument to its corresponding formalargument. After the paragraph executes, PERFORM passes the formalargument back to its corresponding actualargument.

actualargument

Values you send or receive from a formalargument in the paragraph; can be literals, identifiers, arithmetic expressions, or index names.

formalargument

Values you receive from or send to an actualargument in the PERFORM statement.

paragraphname

Name of paragraph to perform.

 

Comments:


TRUE/FALSE

Category:

S-COBOL structure (see S-COBOL Structures)

Description:

Establish flags, set them to true and false, and then test them.

Syntax:
TRUE|FALSE dataname1 [dataname2 [... datanameN]]
Comments:

TRUE THERE-ARE-NO-ERRORS generates 
MOVE TRUE TO THERE-ARE-NO-ERRORS--FLG.

Example:

Set two undefined flags, THERE-ARE-NO-ERRORS and WITHIN-RANGE to TRUE (line 3030). Define these flags in Working-Storage (88-level condition name flags), because this is the first TRUE or FALSE statement for either flag in this program. If the condition in line 3060 is true, set the THERE-ARE-NO-ERRORS flag to FALSE. If either condition in line 3110 is true, set the WITHIN-RANGE flag to FALSE. As long as the value of the THERE-ARE-NO-ERRORS flag is TRUE, perform the loop. Inside the loop test the other flag, WITHIN-RANGE. If the value is TRUE, execute the subordinate statement block.

-LINE- -KYWD-  12-*----20---*----30---*----40---*----50---*
   .
003030         TRUE THERE-ARE-NO-ERRORS 
003031         ... WITHIN-RANGE
   .
003060         IF CODE-IN NOT NUMERIC
003070             FALSE THERE-ARE-NO-ERRORS
   .
003110         IF COUNT > 372 OR COUNT < 50
003120             FALSE WITHIN-RANGE
   .
003150         WHILE THERE-ARE-NO-ERRORS
003160             IF WITHIN-RANGE

TRUE, FALSE, ALWAYS, NEVER

Category:

S-COBOL flag (see S-COBOL Structures)

Description:

TRUE, FALSE, ALWAYS, NEVER are data names whose meanings are reserved and automatically provided by S-COBOL.

Syntax:

Automatically generated in Working-Storage

01  GENERATED-FLAGS.
    02  TRUX        PIC X  VALUE 'T'.
        88  ALWAYS         VALUE 'T'.
        88  NEVER          VALUE 'F'.
    02 FALSX        PIC X  VALUE 'F'.
Comment:

Because TRUE and FALSE are reserved words on some systems, S-COBOL changes every occurrence of TRUE and FALSE to TRUX and FALSX, and generates the flags accordingly.


TYPE

Category:

Report Writer statement (see Report Writer Structures and the APS User's Guide chapter Create Reports with Report Writer)

Compatibility:

Batch environments

Description:

Identify a report group, such as a header line, detail line, or footer line.

Syntax:

Format 1, page header:

TYPE [IS] PAGE HEADING|PH

    [LINE [NUMBER IS] number     ]  [.]
                      PLUS number

Format 2, page footer:

TYPE [IS] PAGE FOOTING|PF
    [LINE [NUMBER IS] number]

    [NEXT GROUP [IS] number     ]  [.]
                     PLUS number

Format 3, report header:

TYPE [IS] REPORT HEADING|RH

    [LINE [NUMBER IS] number     ]
                      PLUS number

                     number
    [NEXT GROUP [IS] PLUS number]  [.]
                     NEXT PAGE 

Format 4, report footer:

TYPE [IS] REPORT FOOTING|RF

                      number
    [LINE [NUMBER IS] PLUS number]  [.]
                      NEXT PAGE

Format 5, control headers and footers:

TYPE [IS] CONTROL HEADING|CH [FINAL] controldataname
          CONTROL FOOTING|CF
                      number
 
    [LINE [NUMBER IS] PLUS number]
                      NEXT PAGE
                     number

    [NEXT GROUP [IS] PLUS number]  [.]
                     NEXT PAGE

Format 6, detail lines:

detaildataname TYPE [IS] DE[TAIL]

                      number
    [LINE [NUMBER IS] PLUS number]
                      NEXT PAGE

                     number
    [NEXT GROUP [IS] PLUS number]  [.]
                     NEXT PAGE
Keywords/Parameters:

CONTROL FOOTING| CF

Print group totals immediately following the detail lines each time a control group ends, that is, when a control break occurs.

CONTROL HEADING| CH

Print heading line(s) before each detail group, that is, when a control break occurs.

controldataname

Designate control data name. Unless FINAL, code controldataname in the corresponding RED keyword CONTROL clause.

DETAIL|DE

Specify the body group, that is, lines containing data items of a report. See also "Comments" below.

detaildataname

Name of detail line.

FINAL

Specify the highest, most inclusive, control group. Implicit; does not have to be coded in order to be used in a CONTROL FOOTING.

LINE number

Designate the line number where the current header, footer, or detail line prints. Number (maximum 3 digits) must be within the defined page limits. Specify the RED keyword PAGE LIMIT clause.

LINE NEXT PAGE

Print the current header, footer, or detail line on a new page.

LINE PLUS number

Designate the line where the current header, footer, or detail line prints, and optionally insert blank lines. Number (maximum 3 digits) must be within the defined page limits.

PLUS increments the line number by number, causing blank lines. A simpler way to print blank lines, however, is to include them in your mock-up.

NEXT GROUP number

Designate the line number where the next TYPE entity prints (for example, a detail line, header, or footer). Number (maximum 3 digits) must be within the defined page limits. Specify the RED keyword PAGE LIMIT clause. See also "Comments" below.

NEXT GROUP PLUS number

Designate the line where the next TYPE entity prints, and optionally insert blank lines (for example, a detail line, header, or footer). Number (maximum three digits) must be within the defined page limits.

PLUS increments the line number number, causing blank lines. A simpler way to print blank lines, however, is to include them in your mock-up. See also "Comments" below.

NEXT GROUP NEXT PAGE

Print the next TYPE entity on a new page (for example, a detail line, header, or footer). Do not code NEXT PAGE with PAGE FOOTING.

PAGE HEADING|PH

First line(s) on each page. APS processes PAGE HEADING as the first report group on each page, unless a REPORT HEADING, that is not on a page by itself, precedes it. APS ignores PAGE HEADING on a page that contains only a REPORT HEADING or REPORT FOOTING. See also "Comments" below.

PAGE FOOTING|PF

Last line(s) on each page. APS processes PAGE FOOTING as the last report group on each page of a report, unless a REPORT FOOTING, that is not on a page by itself, follows it. APS ignores PAGE FOOTING on a page that contains only a REPORT HEADING or REPORT FOOTING. See also "Comments" below.

REPORT FOOTING|RF

Last line(s) of the report. The TERMINATE statement processes REPORT FOOTING as the last report group.

REPORT HEADING|RH

First line(s) of the report. It is the first report group and processes once per report.

 

Comments:

Examples:
01     TYPE IS REPORT HEADING    
           NEXT GROUP IS NEXT PAGE.   
01     TYPE IS PAGE HEADING.  
       SOURCE IS PAGE-COUNTER        PIC ZZZ9
01     PART-DETAIL TYPE IS DETAIL. 
       MOCKUP LINES 5 THRU 6   
       SOURCE IS PM-PART-NO          PIC XXXXXXXX
       SOURCE IS PD-LONG-DESC        PIC X(50) 
       SOURCE IS PM-UNIT-BASE-PRICE  PIC $$$,$$9.99
01     TYPE IS CONTROL FOOTING.  
       MOCKUP LINES 7    
       SUM PM-UNIT-BASE-PRICE        PIC $$$$,$$9.99

Print a report heading on line 20.

-KYWD- 12-*----20---*----30---*----40---*----50---*----60
 01    TYPE IS REPORT HEADING LINE 20.

Insert blank lines in the report by incrementing the line number by two before printing the footer.

-KYWD- 12-*----20---*----30---*----40---*----50---*----60
 01    TYPE IS REPORT FOOTING LINE PLUS 2.

Print two blank lines between groups. Indentation causes continuation when coding NEXT GROUP PLUS 2.

-KYWD- 12-*----20---*----30---*----40---*----50---*----60
 01    TYPE IS CONTROL FOOTING WS-LOCATION-CODE
          NEXT GROUP PLUS 2.

Increment the page counter after printing a line.

-KYWD- 12-*----20---*----30---*----40---*----50---*----60
 01   TYPE IS REPORT HEADING
          NEXT GROUP NEXT PAGE.

UNION

Category:

Database access clause

Compatibility:

SQL target

Description:

Unite a DB-DECLARE or DB-PROCESS call with one or more DB-OBTAIN calls via the UNION keyword, which collects similar columns from two or more tables into one new table. The DB-OBTAIN calls in a union can select rows from one or many tables; the union results in a single table containing the rows selected by each call.

Syntax:

With DB-DECLARE:

DB-DECLARE cursorname [correlname1.]copylibname-REC
          .
          .
... UNION [ALL]
DB-OBTAIN REC copylibname-REC
          .
          .
          .
... [ORDER 
... column1 [ASC|DESC] [...columnN [ASC|DESC]]]

With DB-PROCESS

DB-PROCESS REC [correlname1.]copylibname-REC
          .
          .
          .
... UNION [ALL]
DB-OBTAIN REC copylibname-REC 
          .
          .
          .
... [ORDER
... column1 [ASC|DESC] [...columnN [ASC|DESC]]]
Parameters:

See the applicable database call for parameter descriptions.

Comments:

Examples:

Unite DB-DECLARE with one DB-OBTAIN; eliminate duplicate rows; sort the combined table in ascending order by PM_PART_NO, then in descending order by PM_UNIT_BASE_PRICE and PM_UNITS. Note that the column literals STMT1 and STMT2 identify which call retrieves each row.

DB-DECLARE D2MAST-CURSOR D2TAB-REC
... DISTINCT
... PM_PART_NO PM_UNIT_BASE_PRICE PM_UNITS 'STMT1'
... WHERE PM_PART_SHORT_DESC = :WS-PART-SHORT-DESC
... AND PM_UNIT_BASE_PRICE BETWEEN 50 AND 150
... UNION
DB-OBTAIN REC D2TAB-REC
... PM_PART_NO PM_UNIT_BASE_PRICE PM_UNITS 'STMT2'
... WHERE PM_PART_SHORT_DESC = :WS-PART-SHORT-DESC
... AND PM_UNIT_BASE_PRICE > 300
... AND PM_UNITS > 1000
... ORDER 1,2 DESC, 3 DESC

Unite DB-PROCESS with one DB-OBTAIN call. Sort the combined table in ascending order by PM_PART_NO, then in descending order by PM_UNIT_BASE_PRICE and PM_UNITS.

DB-PROCESS REC D2TAB-REC
... DB-PROCESS-ID D2UNION-ID
... DISTINCT
... PM_PART_NO PM_UNIT_BASE_PRICE PM_UNITS
... WHERE PM_PART_SHORT_DESC = :WS-PART-SHORT-DESC
... AND PM_UNIT_BASE_PRICE > 50
... AND PM_UNIT_BASE_PRICE < 150
... DB-LOOP-MAX=500
... UNION
DB-OBTAIN REC D2TAB-REC
... PM_PART_NO PM_UNIT_BASE_PRICE PM_UNITS
... WHERE PM_PART_SHORT_DESC = :WS-PART-SHORT-DESC
... AND PM_UNIT_BASE_PRICE > 300
... AND PM_UNITS > 1000
... ORDER 1,2

Because return-fields are not specified for JOB_NAME and PROC_NAME, the host variables of those same names are used. In the case of the literal P, no host variable exists so a return-field must be specified. Specify return-fields only in the DB-DECLARE or DB-PROCESS statements.

DB-PROCESS
... REC A.HTJCLD-REC
... DB-PROCESS-ID SHARED-ID
... JOB_NAME
... PROC_NAME
... REC B.HTJOBR-REC
... 'P'  (WS-HOLD-ACTION)
... WHERE B.RESOURCE = :WS-RESOURCE AND 
... B.JOB_NAME = :WS-JOB-NAME
... UNION ALL
DB-OBTAIN REC A.HTJCLD-REC
... DISTINCT JOB_NAME
... PROC_NAME
... REC B.HTJSTEP-REC
... 'A'
... WHERE B.JOB_NAME = :WS-JOB-NAME
... ORDER 01 03 02

UNTIL/WHILE

Category:

S-COBOL structure (see S-COBOL Structures)

Description:

Form a loop with a test at the beginning that allows a subordinate statement block to execute repeatedly, either until or while a single or compound condition is satisfied.

Syntax:

Format 1:

REPEAT
        .
        .
        .
UNTIL|WHILE condition1 [AND|OR condition2 
... [... AND|OR conditionN]]
    statementblock

Format 2:

REPEAT
    statementblock1
UNTIL condition
      statementblock2

Format 3:

REPEAT
    statementblock1
UNTIL condition
      statementblock2
statementblock3
Comments:

Examples:

Find the first X in a string of characters.

-KYWD-  12-*----20---*----30---*----40---*----50---*----60
 PARA   FIND-X
            A-SUB = 1
            UNTIL A-SUB > 100
            ... OR CHAR (A-SUB) = "X"
                A-SUB = A-SUB + 1
            IF A-SUB <= 100  
                CHARACTER-COUNT = A-SUB
            ELSE
               .
               .
               .

Use WHILE to achieve the same results.

        WHILE A-SUB <= 100
        ... AND CHAR (A-SUB) NOT = 'X'

USE BEFORE REPORTING

Category:

Report Writer clause (see Report Writer Structures and the APS User's Guide chapter Create Reports with Report Writer)

Compatibility:

Batch environments

Description:

Code declarative procedures to modify any heading or footing report group before it prints. You can specify special processing requirements, including calculations in addition to those specified in the SUM clause, and edits to a report line.

Syntax:
USE BEFORE REPORTING identifier
Parameters:

identifier

Designate a HEADING or FOOTING report group. Identifier cannot appear in more than one USE BEFORE REPORTING.

 

Comments:

Example:
-KYWD- 12-*----20---*----30---*----40---*----50---*----60
 NTRY  OPEN INPUT
       OPEN OUTPUT
       PERFORM MAIN-PARA
 DPAR  SUPPRESS-CH-REGION SECTION
       USE BEFORE REPORTING CH-REGION
 DPAR  SUPPRESS-CH-REGION-PARA
          IF FIRST-FLG = TRUE
             SUPPRESS PRINTING

User Help

Category:

User application Help

Description:

Create the help source file.

Procedure

To create the help source file, follow these steps,

  1. From the APS Main Menu, enter option 2 in the Command field. Then enter option 6 in the Command field. APS displays the User Help Facility screen.

  2. From the User Help Facility screen, enter 1 in the Command field. APS displays the User Help Source Utility screen.

  3. Select a utility to create your help source file. If you select , Applications, APS displays the Applications Utility screen. If you select Data Elements, APS displays the Data Elements Utility screen. If you select Screens, APS displays the Screens Utility screen.

  4. Complete the fields for the utility selected.

    Field
    Screen
    Description

    Context Name

    Data Elements

    Enter the context name associated with the field to display all the fields with that context. Leave this field blank to display the fields with no context. Enter all to display all the fields with their contexts.

    Context List

    Data Elements

    Display a context list.

    Application Name

    Applications

    Enter the user application name, or leave this field blank and press Enter to display a selection list. Select a name from the selection list by entering s next to it.

    Field Name

    Data Elements

    Type a field name or leave this field blank to display a selection list.

    Screen Name

    Screens

    Type a screen name, or leave this field blank to display a selection list.

    Edit Business Name

    All

    Select to assign a business name a descriptive name that easily identifies the user application and its components). If you do not assign a business name, it defaults to the user application name.

    Edit text

    All

    Select to create help text.

    Include Screens

    Applications

    Select to create screen help.

    Include Fields

    Applications

    Select to create field help.

    Local Fields

    Applications and Screens

    Select to create field help.

    Create Values

    All

    Select to create field value help.

    Help Source File Name

    All

    Help source file name, TMP.APSEXT. If this file already exists, it is overlaid. Note: Do not use an extension with this filename.

Examples:


USERNAME

Category:

S-COBOL structure (see S-COBOL Structures)

Description:

Direct either the current APS paragraph name or one you designate to name a procedure generated by the APS Precompiler, so that your program follows the conventions, requirements or preferences of a given application or installation.

Syntax:
USERNAME paragraphname
Comments:


VALUE (Data Structure)

Category:

Data Structure Painter construct (see Data Structures)

Description:

Code VALUE clauses in your data structures.

Syntax:
dataname PICformat
[...] [VALUE|V] 'valueclause'
Comments:

Examples:

Data Structure Painter format:

-LINE- ----- Data Structure Painter ----------
000001  WRK1-FIELD-7 X(120)
000002  ... VALUE 'A LONG LITERAL MAY BE
000003  ...  CONTINUED ON ONE OR
000004  ...  MORE LINES'
000005  WRK1-FIELD-8 X(80)
000006  ... V 'A VALUE CLAUSE THAT SPANS
000007  ...  TWO OR MORE LINES MUST BEGIN
000008  ...  ON ITS OWN LINE'

Generated COBOL code:

01  WRK1-FIELD-7    VALUE 'A LONG LITERAL MAY BE CONT
    'INUED ON ONE OR MORE LINES'
                           PIC X(120).
 01  WRK1-FIELD-8    VALUE 'A VALUE CLAUSE THAT SPANS
   'TWO OR MORE LINES MUST BEGIN ON ITS OWN LINE'
                           PIC X(80).

Data Structure Painter format:

-LINE- ------- Data Structure Painter ---------
000001  WRK1-FIELD-5 x(18) V'18 CHARACTERS LONG'
000002  WRK1-FIELD-6 x(13)
000003  ... V'13 CHARS LONG'

Generated COBOL code:

01  WRK1-FIELD-5 PIC X(18)
                 VALUE '18 CHARACTERS LONG'.
01  WRK1-FIELD-6 VALUE '13 CHARS LONG'
                 PIC X(13).

VALUE (Report Writer)

Category:

Report Writer clause (see Report Writer Structures and the APS User's Guide chapter Create Reports with Report Writer)

Compatibility:

Batch environments

Description:

Designate, as literals, any values that can be interpreted as PIC characters, such as embedded Xs and 9s to a mock-up text field.

APS considers two or more consecutive COBOL PIC characters a COBOL PIC clause and all other strings as literals, with the following exceptions.

To distinguish literals from PIC strings, such as the literal EXXON, which would be interpreted as the literal E, followed by the PIC string XX, and the literal ON, paint the word as a data field in the report mock-up and use the VALUE clause when coding the detail line data item description in your program.

Syntax:
VALUE "characterstring" [PIC picclause]
    [DATA-NAME [IS] fieldname]
Keywords/Parameters:

"character
string
"

Designate a literal as follows.

  • Enter the text field on the mock-up as a data field (that is, a series of Xs).

  • Code VALUE "characterstring", where characterstring is the literal value of the text field.

DATA-NAME fieldname

Name a sum accumulator established by a SUM or REFERENCE clause. Do not define fieldname in Working-Storage. At generation, APS inserts fieldname after the level number in the generated report group. DATA-NAME moves the value of the internal SUM accumulator to fieldname.

Code DATA-NAME when a SUM UPON clause references DETAIL report group, when the program references a sum accumulator, or when a sum accumulator requires a data name for qualification.

PIC clause

Specify the format of characterstring.

 

Example:

Create the report heading QUARTERLY REPORT FOR EXXPERT.

====
QUARTERLY REPORT FOR XXXXXXX
====
-KYWD- 12-*----20---*----30---*----40---*----50---*----60
 01    TYPE IS PAGE HEADING.
       MOCKUP LINE 1
       VALUE 'EXXPERT' PIC X(7)

Values, Conversion Values, and Value Ranges

Category:

Screen Painter feature (see Field Edits)

Description:

Ensure that the end user enters only certain values in a screen field by assigning values and value ranges or conversion values to that field.


Note: You can assign values or conversions, but not both.


Procedure:

To assign values to a field, follow these steps.

  1. From the Screen Painter, access the Field Edit Facility.

  2. Access the Values or Conversions screen by selecting the Values or Conversions prompt on any Field Edit screen.

  3. Assign a specific value or a range of values using the following syntax formats.

    value
    lowvalue TO|THRU highvalue
    lowvalue UP
    highvalue DOWN

  4. Assign conversion values using the following syntax format.

    (input1, input2, ..., inputN, I=internalvalue, O=outputvalue)

  5. To specify that the listed conversions are the only valid input values, select the Verify Conversion Values option.

Comments:

Follow these rules when you specify values.


Variable Length File Support

Compatibility:

VSAM batch target

Description

APS locates a variable length record description directly under the associated FD and places the fixed length record descriptions in Working-Storage.


WRITE ROUTINE

Category:

Report Writer clause (see Report Writer Structures and the APS User's Guide chapter Create Reports with Report Writer)

Compatibility:

Batch environments

Description:

Override the COBOL WRITE statement and execute your own routine.

Syntax:
WRITE ROUTINE [IS] paragraphname
Comments:

Example:
-KYWD- 12-*----20---*----30---*----40---*----50---*----60
 FD    INPUT-FILE
       LABEL RECORDS ARE STANDARD
       BLOCK CONTAINS 0 RECORDS.
 01    PART-STOCK-REC                 PIC X(80).
 FD    REPORT-OUTPUT-FILE
       LABEL RECORDS ARE STANDARD
 01    USER-REPORT-RECORD.
       03  USER-REPORT-APS-PART       PIC X(248).
       03  USER-REPORT-USER-PART      PIC X(7).
   .
 RED   STOCK-REPORT
   .
       WRITE ROUTINE IS USER-DEFINED-PARA
   .
 NTRY
   .
 PARA  USER-DEFINED-PARA
   .
       MOVE STOCK REPORT RECORD TO 
       ...USER-REPORT-APS-PART

WS

Category:

Program Painter and Specification Editor keyword (see Keywords)

Description:

Define or include data structures in the Working-Storage Section.

Syntax:
-KYWD-  12-*----20---*----30---*----40---*----50---*----60
 WS
 kywd   associated data structure
Comment:

Associated data structure keywords are 01, DS, REC, or ++.

Example:

Use Section keywords to code Working-Storage data structures.

-KYWD-  12-*----20---*----30---*----40---*----50---*----60
 IO     INPUT-FILE ASSIGN TO UT-S-INPUT
 IO     OUTPUT-FILE ASSIGN TO UT-S-OUTPUT
 SPNM   C01 IS TOP-OF-PAGE
 FD     INPUT-FILE
        LABEL RECORDS ARE STANDARD
        BLOCK CONTAINS 0 RECORDS
 01     INPUT-REC         PIC X(80).
 DS01   INPUT-REC
 FD     OUTPUT-FILE
        LABEL RECORDS ARE STANDARD
        BLOCK CONTAINS 0 RECORDS
 REC    OUTPUT-REC       X80
 01     OUTPUT-REC-R REDEFINES OUTPUT-REC.
        ... COPY OUTREC.
 WS 
 REC     WS-INPUT-REC
            WS-IN-PART-NO       N8
            WS-IN-DESC          X50
            WS-IN-BASE-PRICE    N6V2
 01     WS-OUT-REC
 DS05   WSOUTREC

XCTL

Category:

Data communication call (see Data Communication Calls)

Compatibility:

CICS, ISPF Dialog, and ISPF Prototyping, targets

Description:

Transfer control from a program at one logical level to an APS or non-APS application program at the same level, and pass the Commarea.

Syntax:
CICS

Transferring to a APS program:

[TP-]XCTL programname [errorpara]
... [LENGTH(value)]
... [DLIUIB pcbname [pcbname ...]]
... [userparm [userparm] ...]

Transferring to a non-APS program:

[TP-]XCTL programname(NONAPS) [errorpara]
... [LENGTH(value)]
ISPF Prototyping
[TP-]XCTL programname[(NONAPS)]
... [LENGTH(value)]
Parameters:

DLIUIB pcbname

DLI interface block and the Program Control Block required by the next program.

errorpara

User-defined error routine to perform when an abnormal condition occurs. Errorpara is positional; if omitted, code an asterisk (*) in its place.

LENGTH(value)

Maximum length of data; can be a literal or COBOL data name defined as S9(04)COMP. Can also be a partial length.

(NONAPS)

The program is not an APS program.

NOTERM

Do not terminate the screen display for the calling program, that is, display screens for both the called and the calling program.

programname

Program name; can be a literal, variable, or combination. If you precede a variable name with a slash (/), APS moveS the literal to it.

 

Comments:

ISPF Dialog

XCTL, which calls a subprogram at the next lower level, operates identically to LINK. XCTL invokes LINK, providing no additional functionality and does not pass the COMMAREA; XCTL is provided for upward compatibility.

Examples:

Transfer control to PGM001. There is no active PSB and no passing of arguments.

XCTL PGM001

Transfer control to the program whose name is stored in WS-PROGNAME. There is no active PSB and no passing of arguments.

XCTL /WS-PROGNAME

Move the value PGM003 to WS-PROGNAME and transfer control to that program. There is no active PSB and no passing of arguments.

XCTL PGM003/WS-PROGNAME

Transfer control to PGM004; execute an error routine for an abnormal condition. There is no active PSB and no passing of arguments.

XCTL PGM004 ERR-PARA

Transfer control to PGM005. A PSB is scheduled and the transferred-to program uses PCB ABC-PCB.

XCTL PGM005 * DLIUIB ABC-PCB

Transfer control to a non-APS program, PROG001.

XCTL PROG001(NONAPS)

 


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