Database Calls

Compatibility:

All targets

Description:

APS Logical View Database (DB) calls are predefined, easy-to-use statements with common syntax that allows transparent access to a variety of databases. The APS Logical View DB calls let you focus on what needs to be accomplished, rather than the mechanics of the target environment. To address environment-specific requirements, you can extend these calls with keywords; no native coding is required. These calls facilitate both generic processing and specialized requests.

APS supports the following database targets:

Code database calls in the APS Program Painter for batch, report, or complex online programs, or in the Online Express Specification Editor for an Express program.

IDMS DB

The APS/IDMS calls include the following:

DB-BIND

Bind all records and the run-unit.

DB-CLOSE

Close a record.

DB-ERASE

Delete a record.

DB-GET

Move data into Working-Storage.

DB-OBTAIN

Read a record.

DB-OPEN

Open a record.

DB-MODIFY

Update a record.

DB-STORE

Add a record.

DB-PROCESS

Obtain and loop records.

IDM-COMMIT

Write a commit checkpoint.

IDM-CONNECT

Connect a record to a set.

IDM-DISCONNECT

Disconnect a record from set.

IDM-IF

Test a conditional.

IDM-PROTOCOL

Specify the program execution mode.

IDM-RETURN

Return the database key from an indexed set.

IDM-ROLLBACK

Write an abort checkpoint to an IDMS journal file.

IMS DB

The APS/IMS DB calls include the following:

DB-ERASE

Delete a record.

DB-MODIFY

Update a record.

DB-OBTAIN

Read a record.

DB-PROCESS

Read multiple records in a loop.

DB-STORE

Add a record.

$IM-FSA

Build a Field Search Argument.

$IM-POS

Access Data Entry Data Bases.

SQL

The APS/SQL DB calls include the following:

DB-CLOSE

Close a cursor set.

DB-COMMIT

Perform the SQL COMMIT function.

DB-DECLARE

Declare a cursor set.

DB-ERASE

Delete a row.

DB-FETCH

Obtain a row from a cursor set.

DB-MODIFY

Update a row.

DB-OBTAIN

Read a table.

DB-OPEN

Open a cursor set.

DB-PROCESS

Read a table and loop on it.

DB-ROLLBACK

Perform the SQL ROLLBACK function.

DB-STORE

Add a record.

VSAM Online

The APS/VSAM online DB calls include the following:

DB-ERASE

Delete a record.

DB-FREE

Release file resources.

DB-MODIFY

Update a record.

DB-OBTAIN

Read a file.

DB-PROCESS

Read a file and loop on it.

DB-STORE

Add a record.

VSAM Batch

The APS/VSAM batch DB calls include the following:

DB-CLOSE

Close a file.

DB-ERASE

Delete a record.

DB-MODIFY

Update a record.

DB-OBTAIN

Read a file.

DB-OPEN

Open a file.

DB-PROCESS

Read a file and loop on it.

DB-STORE

Add a record.

Coding Conventions

APS Logical View DB calls can consist of a call name, keywords, and arguments. Observe the following conventions when you code a DB call:

Related Topics:

See...
For more information about...

Error Handling

ID Parameters

IDMS

IDMS DB Sample Programs

Using IDMS database calls in program logic

CCODE

Error Handling

GSAM Calls

SUPPRESS (IMS DB Option)

System Service Calls

Using IMS DB database calls in program logic

Error Handling

Fields and Flags, Data Communication

Variable Length File Support

Using VSAM Batch database calls in program logic

Error Handling

Fields and Flags, Data Communication

Using VSAM Online database calls in program logic

Error Handling

Expressions, SQL

Functions, SQL

GROUP BY

Joins

NULL Indicator Field

Special Registers

Subselect Clause

UNION

Using SQL database calls in program logic

Control Files

Controlling certain target-specific functions

Comments

Entering comments in your program

Reserved Words

Avoiding use of APS reserved words

Limits

Recognizing size limitations


Data Communication Calls

Compatibility:

All targets

Description:

APS Logical View Data Communication (DC) calls are predefined, easy-to-use statements that let you focus on what needs to be accomplished, rather than the mechanics of the target environment. To address environment-specific requirements, you can extend these calls with keywords; no native coding is required. These calls facilitate both generic processing and specialized requests.

APS supports the following data communication targets:

Code data communication calls in the APS Program Painter for batch, report, or complex online programs, or in the Online Express Specification Editor for an Express program.

List of DC Calls
CICS

The APS/CICS DC calls include the following:

ATTR

Override default I/O screen field attributes at run time.

CIC-ADDRESS

Access CICS storage areas.

CIC-ASSIGN

Assign values defined outside the program to a data area in Working-Storage.

CIC-CANCEL

Cancel a CIC-START or CIC-DELAY.

CIC-DELAY

Suspend a task.

CIC-DELETEQ-TD

Delete all transient data in a transient data queue.

CIC-DELETEQ-TS

Delete temporary data in a temporary storage queue and free all storage in the queue.

CIC-FREEMAIN

Release storage acquired by a CIC-GETMAIN call.

CIC-GETMAIN

Obtain and initialize main storage.

CIC-LOAD

Load programs, tables, or maps from a resident system library to main storage.

CIC-READQ-TD

Read transient data from a transient data queue.

CIC-DELETEQ-TS

Read a temporary storage queue in main or auxiliary storage.

CIC-RELEASE

Delete from main storage any programs, tables, or maps loaded by CIC-LOAD.

CIC-SCHEDULE-PSB

Schedule an IMS PSB.

CIC-SEND-TEXT

Clear the screen and unlock the keyboard before terminating a program.

CIC-SERVICE-RELOAD

Establish addressability to a data area in the Linkage Section following an address change in its BLL cell.

CIC-START

Start a task on a local or remote system.

CIC-TERM-PSB

Terminate the currently scheduled IMS PSB.

CIC-WRITEQ-TD

Write transient data to a predefined data queue.

CIC-WRITEQ-TS

Write temporary records to a temporary storage queue.

CLEAR

Move spaces to all screen fields.

CLEAR-ATTRS

Reset screen field attributes to their original values.

LINK

Transfer control to a subprogram and optionally send Commarea data.

RESET-PFKEY

Simulate screen invocation.

SCRNLIST

Enable the program to receive multiple screens.

SEND

Send a screen to the monitor.

TERM

Terminate the program.

TP-BACKOUT

ABEND the program.

TP-COMMAREA

Generate a Working-Storage record for data that the program can send to and receive from other programs.

TP-LINKAGE

Handle addressability of Linkage Section records.

TP-NULL

Move LOW-VALUES to all fields of a specified screen.

TP-PERFORM

Perform a paragraph and optionally pass arguments.

XCTL

Transfer program control to another program at the same logical level, and send Commarea data.

IMS DC

The APS/IMS DC calls include the following:

ATTR

Override default I/O screen field attributes at run time.

CLEAR

Move spaces to all screen fields.

CLEAR-ATTRS

Reset screen field attributes to their original values.

$IM-CHNG

Issue a change call to another IO PCB.

$IM-CMD

 

$IM-GCMD

 

$IM-GN

Issue a read of the next IMS message.

$IM-GU

Issue a unique read of an IMS message.

$IM-ISRT

Insert an IMS message.

$IM-PURG

Issue a purge for a PCB.

LINK

Transfer control to a subprogram and optionally send Commarea data.

MSG-SW

Transfer control to another program and optionally send screen data.

RESET-PFKEY

Simulate screen invocation.

SCRNLIST

Enable the program to receive multiple screens.

SEND

Send a screen to the monitor.

TERM

Terminate the program.

TP-BACKOUT

ABEND the program.

TP-COMMAREA

Generate a Working-Storage record for data that the program can send to and receive from other programs.

TP-LINKAGE

Handle addressability of Linkage Section records.

TP-NULL

Move LOW-VALUES to all fields of a specified screen.

TP-PERFORM

Perform a paragraph and optionally pass arguments.

ISPF Dialog

The APS/ISPF Dialog DC calls include the following:

ATTR

Override default I/O screen field attributes at run time.

CLEAR

Move spaces to all screen fields.

CLEAR-ATTRS

Reset screen field attributes to their original values.

DLG-ISPEXEC

Invoke services through ISPEXEC calls.

DLG-ISREDIT

Invoke services through ISREDIT calls.

DLG-SETMSG

Display a message on the next panel.

DLG-VCOPY

Copy an ISPF Dialog variable value to a COBOL variable.

DLG-VDEFINE

Link an ISPF Dialog variable and a COBOL variable.

DLG-VDELETE

Delete an ISPF Dialog variable from the function pool.

DLG-VREPLACE

Move a COBOL variable value to the function pool.

DLG-VRESET

Reset function pool variables.

LINK

Transfer control to a subprogram and optionally send Commarea data.

RESET-PFKEY

Simulate screen invocation.

SCRNLIST

Enable the program to receive multiple screens.

SEND

Send a screen to the monitor.

TERM

Terminate the program.

TP-COMMAREA

Generate a Working-Storage record for data that the program can send to and receive from other programs.

TP-LINKAGE

Handle addressability of Linkage Section records.

TP-NULL

Move LOW-VALUES to all fields of a specified screen.

TP-PERFORM

Perform a paragraph and optionally pass arguments.

XCTL

Execute the LINK call.

ISPF Prototyping

The APS/ISPF prototyping DC calls include the following:

ATTR

Override default I/O screen field attributes at run time.

LINK

Transfer control to a subprogram and optionally sends Commarea data.

MSG-SW

Transfer control to another program and optionally send screen data.

See RESET-PFKEY

Simulate screen invocation.

SCRNLIST

Enable the program to receive multiple screens.

SEND

Send a screen to the monitor.

TERM

Terminate the program.

TP-COMMAREA

Generate a Linkage Section record for data that the program can send to and receive from other programs.

See TP-PERFORM

Perform a paragraph and optionally pass arguments.

XCTL

Transfer program control to another program at the same logical level, and send Commarea data.

Coding Conventions

APS Logical View DC calls can consist of a call name, keywords, and arguments. Observe the following conventions when you code a DC call:

Related Topics

 

See...
For more information about...

Error Handling

PF Key Values

Program Specification Blocks

TP-COMMAREA

Using CICS data communication calls in program logic

Error Handling

$IM- Data Communication Calls

Program Control Blocks, IO

System Service Calls

TP-COMMAREA

Using IMS DC data communication calls in program logic

ISPF Dialog Compatibility with IMS DC, CICS

PF Key Values

TP-COMMAREA

Using ISPF Dialog data communication calls in program logic

Comments

Entering comments in your program

Control Files

Controlling certain target-specific functions

Reserved Words

Avoiding use of APS reserved words

Limits

Recognizing size limitations


Data Structure Definition (DS01)

Category:

APS-generated report (see Application Reports)

Description:

The Data Structure Definition Reports displays data structure components exactly as painted, together with the following supplementary information.

The report documents this aspect of your application to support future maintenance and enhancement efforts.

Comment:

Produce the Data Structure Definition Report from the Report Generator, Painter Menu, or Application Painter.

Example:
REPORT CODE: REPT      APS ENTITY REPORT FACILIY                          PAGE     1
                              CLSAPS.CLS2                             07/18/92 14:49
REPORT CRITERIA: 2
 ALL MEMBERS OF LIBRARY TYPE : DS
*****************************************************************************************

 LIBRARY      ENTITY
 TYPE         NAME              STATUS           REMARKS
 -------      --------          -------------    ----------------------------
      DS      APFIELDS          REPORTED
      DS      BATCH1            REPORTED
      DS      COM               REPORTED
      DS      CONDATA           REPORTED
      DS      COST              REPORTED
      DS      DSFRD1            REPORTED
      DS      FORD2DS           REPORTED
      DS      HBSPA             REPORTED
      DS      PARTDATA          REPORTED
      DS      PARTMSTR          REPORTED
      DS      P2COMM            REPORTED
      DS      RECORD1           REPORTED
      DS      SBAPPL            REPORTED
      DS      STR1A             REPORTED
      DS      TOTCOST           REPORTED
      DS      TOTCST            REPORTED
      DS      TRAAPL            REPORTED
      DS      TRADATA           REPORTED
      DS      TRFIELDS          REPORTED
      DS      TR3RECD           REPORTED
      DS      TR6APPL           REPORTED
      DS      TR7APPL           REPORTED
      DS      TR8PART           REPORTED

REPORT CODE: DS01      APS APPLICATION PAINTER                            PAGE     1
                  DATA STRUCTURE DEFINITION REPORT                    07/18/92 14:49
                             CLSAPS.CLS2
SELECTION CRITERIA:
   APFIELDS


**********************************************************************************************
DATA STRUCTURE: APFIELDS                                           CREATED: 06/06/90
TITLE                                                              UPDATED: 06/06/90
**********************************************************************************************

START DATA     STATEMENT                                           LINE NO
COL------------------------------------------------------------------------------------------
 8             PART-MASTER-REC                                     00010000
10                     PM-PART-NO                             9(8) 00020000
10                     PM-NEW-PART-NO                         9(8) 00030000
10                     PM-OLD-PART-NO                         9(8) 00040000
10                     PM-PART-SHORT-DESC                     X13  0050000
10                     PM-UNITS                               9(8) 00060000
10                     PM-UNIT-BASE-PRICE                     S6V2 00070000
10                     PM-DIMENSIONS                          X(8) 00080001

 


Data Structures

Description:

APS lets you code reusable data structures for programs and copy libraries, using a shorthand format in the Data Structure Painter. Or, you can code these data structures specifically for your program in the Program Painter. The shorthand format substitutes indentation for level numbers and allows shorthand picture formats. The APS Generators insert level numbers for indentation levels, expand the shorthand formats to full COBOL formats, and insert the necessary punctuation. Alternately, you can code data structures in the standard COBOL format.

Constructs:

VALUE (Data Structure)

Specify a VALUE clause.

RED

Specify a REDEFINES clause.

OCCURS

Specify an OCCURS clause.

88

Assign a value(s) to an 88-level variable.

66 . . . RENAMES

Designate a 66-level RENAMES clause.

Edit Mask Characters

Code the following COBOL edit mask characters in your data structures.

A  P  Z  +  -  *  B  $  0 

For example:

APS Code
Generated Code
A(12)000B
PIC A(12)000B.
PPP999
PIC PPP999.
ZZZ9.99
PIC ZZZ9.99
+999.99
PIC +999.99.
****.**
PIC ****.**.
S999PPP
PIC S999PPP.
Picture Formats

Code data structures in the Data Structure Painter format, which is a shorthand syntax.

Format
Generated COBOL
9
PIC 9.
99
PIC 99
999
PIC 999
9999
PIC 9999
9(n)
PIC 9(n)
9n
PIC 9(n)
9&variable
PIC 9(&variable)
A
PIC A.
AA
PIC AA.
AAA
PIC AAA.
A(n)
PIC A(n).
An
PIC A(n).
A&variable
PIC A(&variable).
C
PIC S9 COMP.
C(n)
PIC S9(n) COMP.
Cn
PIC S9(n) COMP.
C-3
PIC S9 COMP-3.
Cn-3
PIC S9(n) COMP-3.
C&variable
PIC S9(&variable) COMP.
C&variable+-3
PIC S9(&variable) COMP-3.
F|FULL
PIC S9(9) COMP.
H|HALF
PIC S9(4) COMP.
I|INDEX
INDEX.  (For [USAGE IS] INDEX)
N
PIC 9.
N(n)
PIC 9(n).
Nn
PIC 9(n).
N&variable
PIC 9(&variable).
P|POINTER
POINTER.
 
(For COBOL/2 only:  [USAGE IS] POINTER.])
R|REDEF| REDEFINES
REDEFINES dataname.
S
PIC S9.
S(n)
PIC S9(n).
Sn
PIC S9(n).
S&variable
PIC S9(&variable).
SYNC
SYNCHRONIZED
V(n)
PIC V9(n).
Vn
PIC V9(n).
V&variable
PIC V9(&variable).
Vvalueclause
VALUE valueclause.
X
PIC X.
XX
PIC XX.
XXX
PIC XXX.
XXXX
PIC XXXX.
Xn
PIC X(n).
X(n)
PIC X(n).
X&variable
PIC X(&variable).
... 

Continuation of a format

Comments:

Example:

The following illustrates using indentation to create level numbers.

Data Structure Painter code:

-LINE- ------------------ Data Structure Painter -----------
000001        PROG-SPECIFIC-WORKING-DATA
000002          PGWS-FIELD1
000003              PGWS-FIELD2
000004                  PGWS-FIELD3
000005                      PGWS-FIELD4
000006                          PGWS-FIELD5
000007                              PGWS-FIELD6
000008                                  PGWS-FIELD7 X13 
 
000009                                  ... V'ABCDEFGHIJKL'
000010                  PGWS-FIELD8
000011                      PGWS-FIELD9
000012                          PGWS-FIELD10  N13

Generated COBOL code:

01  PROG-SPECIFIC-WORKING-DATA.
    05  PGWS-FIELD1.
        10  PGWS-FIELD2.
            15  PGWS-FIELD3.
                20  PGWS-FIELD4.
                    25  PGWS-FIELD5.
                        30  PGWS-FIELD6.
                            35  PGWS-FIELD7
                                PIC X(13)
                                VALUE 'ABCDEFGHIJKL'.
            15  PGWS-FIELD8.
                20  PGWS-FIELD9.
                    25  PGWS-FIELD10
                     PIC 9(13).

Date and Time Field Edits

Category:

Screen Painter feature (see Field Edits)

Description:

Specify the storage format, the format and data requirements that the end user must adhere to when entering data into a date or time screen, and specify the format requirements for displaying the date or time.

Procedure:

To assign internal, input, or output edits to a date screen, follow these steps.

  1. Access the Screen Painter, then access the Field Edit Facility. From the Edit Selection window, select the Special Edits option.

  2. From the Special Edits Screen Painter, select one of the following.

    Option
    Description

    Date--Predefined Edits

    Gregorian, Julian, or system date storage format and a predefined list of input/output formats

    Date--User-Defined Edits

    Storage, input, and output date format that you define

    Time--User-Defined Edits

    Storage, input, and output formats that you define

  3. Assign date edits to fields as listed in the following Predefined Dates, User-Defined Dates, and Time Field tables or procedures.

Predefined Dates

Field
Description and Values

Storage Format

Specify the internal storage format as follows.

 

J Julian--generates X(5)

 

JP Julian packed--generates 9(5) COMP-3

 

G Gregorian--generates X(6)

 

GP Gregorian packed--generates 9(6) COMP-3

 

If you do not specify a Storage Format, you must select the System Data Displayed option to capture the system date.

In/Out Format

Select the format. All formats are valid input formats. The field length determines if the special characters are assigned. For example, if you select the MM/DD/YY format, and the field length is 8, then APS assigns MM/DD/YY to the field; if the field length is 6, APS assigns MMDDYY to the field.

Date Required

Select to indicate that the end user must enter a value in the field.

Error Processing

Select to transfer to the Error Processing window to specify error messages and attributes when the field fails input edits.

System Data Displayed

Select to capture the system date. Select this option if you do not specify a storage format.

Application Editing

Select to transfer to the Application Editing window to specify your own edits in a paragraph, subprogram, or APS rule for input or output.

User-Defined Dates

Field
Description and Values

Internal Picture

Select to transfer to the Internal Picture window to specify the COBOL picture characteristics.

Storage Format Input Format Output Format

Type the internal storage format mask, input format mask, and output format mask. Valid mask characters are Y (year), M (month), D (day), and special characters if the field is not defined numeric. Restrictions are

 

Y Can be 2 or 4 characters, where:

  • 2 Ys indicate a numeric year, such as 93.
  • 4 Ys indicate a numeric century and year, such as 1993.

M Can be 2, 3, or 9 characters, where:

  • 2 Ms indicate a numeric month, such as 12.
  • 3 Ms indicate a short character month, such as DEC.
  • 9 Ms indicate a long character month, such as DECEMBER.

D Can be 3 characters if you do not define Month, otherwise it must be 2 characters, where:

  • 2 Ds indicate a numeric Gregorian day, such as 30.
  • 3 Ds indicate a numeric Julian day, such as 360.

 

The storage length must equal the Internal Picture length. Month, day, and year must be in the same order in both the Input and Output Formats.

 

Example:

Storage Format YYYYMMDD

Input Format MMDDYY

Output Format MMMMMMMMM DD, YYYY

Date Required

Select to indicate that the end user must enter a value in the field.

Error Processing

Select to transfer to the Error Processing window to specify error messages and attributes when the field fails input edits.

System Date Data

Select one of the following.

I

During input editing, insert the system date only if the field is blank.

IR

During input editing, always insert the system date, regardless of the field contents.

O

During output editing, insert the system date only if the field is blank.

OR

During output editing, always insert the system date, regardless of the field contents.

Application Editing

Select to transfer to the Application Editing window to specify your own edits in a paragraph, subprogram, or APS rule for input or output.

Time Fields

Field
Description

Internal Picture

Select to transfer to the Internal Picture window to specify the COBOL picture characteristics.

Storage Format

Specify the internal storage format mask. Valid characters are HH (hour), MM (minute), SS (second), *s and special characters if the field is not defined numeric. The storage format must equal the Internal Picture length. Seconds are optional. For example, HH:MM**

Input Format and Output Format

Type the input and output format masks. Valid mask characters are HH (hour), MM (minute), SS (second), *s, and special characters if the field is not defined numeric. Seconds are optional.

 

Append your format with asterisks to indicate the AM and PM indicators that you specify, using a one-to-one correspondence. For example, if your indicators are A.M. and P.M., you would append **** to your format; if they are AM and PM, you would append ** to your format.

 

Hours, minutes, and seconds must be in the same order in both the Input and Output Formats. For example:

Input Format HHMMSS

Output Format HH.MM.SS**

Input Required

Select to indicate that the end user must enter a time value in the field.

Error Processing

Select to transfer to the Error Processing window to specify error messages and attributes when the field fails input edits.

Application Editing

Select to transfer to the Application Editing window to specify your own edits in a paragraph, subprogram, or APS rule for input or output.

System Time Data

Select one of the following:

I

During input editing, insert the system time only if the field is blank.

IR

During input editing, always insert the system time, regardless of the field contents.

O

During output editing, insert the system time only if the field is blank.

OR

During output editing, always insert the system time, regardless of the field contents.

AM Indicator

Type the AM time indicator, such as a.m. or am.

PM Indicator

Type the PM time indicator, such as p.m. or pm.


Note: In a report mock-up, use PIC clauses instead of COBOL masks when formatting dates and times containing / $ or :. See Report Mock-Ups.


DB/DC Target Combinations

Description:

The following table shows all valid DB/DC combinations for generating executable programs.

DC Target
DB Target

CICS

DB2

 

IMS

 

VSAM

 

 

IMS

DB2

 

IDMS

 

IMS

 

 

ISPF

DB2

 

VSAM

 

 

DLG (ISPF Dialog)

IDMS

 

DB2

 

VSAM

 

 

MVS (batch)

DB2

 

IMS

 

VSAM


DB-BIND

Category:

Database call (see Database Calls)

Compatibility:

IDMS target

Description:

Bind all records copied into a program subschema via a COPY IDMS statement; bind the run unit.

Syntax:

Format 1:

DB-BIND REC [recordname]

Format 2:

DB-BIND RUN-UNIT
... SUBSCHEMA name|NODENAME name|DBNAME name
Parameters:

DBNAME name

Database name from the IDMS database name table.

NODENAME name

IDMS network node.

REC [recordname]

Retrieve record. Recordname is optional because the record is previously located by a DB-OBTAIN REF.

RUN-UNIT

Specify binding, if IDMS run unit.

SUBSCHEMA name

Bind the run unit with the subschema.

Comments:

Example:
-KYWD-  12-*----20---*----30---*----40---*----50---*----60
 SYEN   IDM-PROTOCOL BATCH-AUTOSTATUS MANUAL
   .
   .
   .
 PROC
        DB-BIND RUN-UNIT DBNAME TESTDB
        DB-BIND REC EMPLOYEE
        DB-OPEN MODE RETRIEVAL
        PERFORM 100-PROCESS-RTN

DB-CLOSE

Category:

Database call (see Database Calls)

Compatibility:

IDMS DB, SQL, and VSAM batch targets

Description:

Close IDMS files and subschema areas; close SQL cursor sets; close VSAM batch files.

Syntax:
IDMS DB
DB-CLOSE ALL
VSAM Batch

Format 1:

DB-CLOSE FILE filename1 [ ... filenameN]

Format 2:

DB-CLOSE FILE ALL
SQL
DB-CLOSE CUR[SOR] cursorname
Parameters:

ALL

Specify all files and ready all areas defined in the subschema.

CUR[SOR] cursorname

Specify cursor. Cursorname must be previously named by DB-DECLARE or DB-PROCESS-ID.

FILE filename

File(s) to process.

Comments:
IDMS DB

SQL

A cursor set can be opened, processed, and closed multiple times in the same program; you must code DB-CLOSE before you invoke another DB-OPEN.

VSAM Batch

DB-CLOSE is required.


DB-COMMIT

Category:

Database call (see Database Calls)

Compatibility:

SQL target

Description:

Perform database commit functions.

Syntax:
DB-COMMIT [HOLD]
Parameters:

HOLD

Do not release resources; do not close open cursors; preserve prepared SQL statements; release locks on specific rows acquired during the transaction.

Comments:

Any SQL program running under ISPF prototype or ISPF Dialog generates DB2 COMMITs upon normal termination of the program (for example, through TP-SEND, TP-XCTL, TP-TERM). In addition, APS provides two variables you can code that generate COMMITs for DB calls under either ISPF prototyping or ISPF Dialog.


DB-DECLARE

Category:

Database call (see Database Calls)

Compatibility:

SQL target

Description:

Designate a set of rows as a logical group, that is, a cursor set. The call declares:

Syntax:

Format 1, unqualified, select all columns:

DB-DECLARE cursorname copylibname-REC
... [FETCH ONLY]
... [WITH HOLD]
... [OPTIMIZE number]
... [UPDATE|ORDER
... column1 [ASC|DESC] [...columnN [ASC|DESC]]]

Format 2, qualified, select all columns:

DB-DECLARE cursorname copylibname-REC
... [FETCH ONLY]
... [WITH HOLD]
... [OPTIMIZE number]
... WHERE column operator [[:]altvalue]|column
... [AND|OR column operator [[:]altvalue]|column]
... [UPDATE|ORDER
... column1 [ASC|DESC] [...columnN [ASC|DESC]]]

Format 3, select specific columns:

DB-DECLARE cursorname copylibname-REC
... [DISTINCT]
... [FETCH ONLY]
... [WITH HOLD]
... [OPTIMIZE number]
... column1 [(altvalue)] [... columnN [(altvalue)]]
... [WHERE column operator [[:]altvalue]|column
... [AND|OR correlname.]column operator [[:]altvalue]|column]
   .
   .
   .
... [AND|OR correlname.]column operator [[:]altvalue]|column]]
... [UPDATE|ORDER
... column1 [ASC|DESC] [...columnN [ASC|DESC]]]

Format 4, join columns from two or more tables:

DB-DECLARE cursorname correlname.copylibname-REC
... [DISTINCT]
... [FETCH ONLY]
... [WITH HOLD]
... [OPTIMIZE number]
... [column1 [(altvalue)] [... columnN [(altvalue)]]]
... [correlname.copylibname-REC
... [column1 [(altvalue)] [... columnN [(altvalue)]]]
   .
   .
   .
... [WHERE correlname.column operator [:]altvalue|correlname.column
... [AND|OR correlname.column oper [:]altvalue|correlname.column]
   .
   .
   .
... [AND|OR correlname.column operator [:]altvalue|correlname.col]]
... [ORDER
... column1 [ASC|DESC] [...columnN [ASC|DESC]]]

Format 5, specify a UNION:

DB-DECLARE cursorname copylibname-REC
... [DISTINCT]
... [FETCH ONLY]
... [WITH HOLD]
... [OPTIMIZE number]
... [column1 [(altvalue)] [... columnN [(altvalue)]]]
... [WHERE column operator [[:]altvalue]|column
... [AND|OR column operator [[:]altvalue]|column]
   .
   .
   .
... [AND|OR column operator [[:]altvalue|]column]]
... UNION [ALL]
DB-OBTAIN REC copylibname-REC
   .
   .
   .
... [ORDER
... column1 [ASC|DESC] [...columnN [ASC|DESC]]]
Parameters:

[:](altvalue)

Alternate value; can be a literal, column name, or host-variable, as follows.

  • A host-variable is any COBOL data item referenced in your APS/SQL code; can a be data item generated automatically by APS/SQL to match a DB2 column name.

  • An alternate host-variable is one you instruct APS/SQL to use instead of the automatically generated one for a column.

  • Precede host-variables and alternate host-variables with a colon. APS generates a # symbol for the colon.

AND col op col|[:]altval

Value can be a literal or data name. See also the altvalue parameter above.

copylibname-REC

Copybook library name of source data.

correlname.

Correlation name; maximum 18 characters, ending with a period. Required if columnname is in a select list or if the WHERE clause appears in multiple joined tables.

cursorname

Cursor name (maximum 12 characters) must be unique, and cannot be the same as the subschema copylib names.

DISTINCT

Eliminate all but one row from each set of duplicate rows. Duplicate rows have identical selected columns from the results table.

FETCH ONLY

Specify that the table is read-only and therefore the cursor cannot be referred to in positioned UPDATE and DELETE statements. Do not code in a call that contains an UPDATE clause.

OPTIMIZE number

Specify estimated maximum number of rows that call will retrieve. If the call retrieves no more than number rows, performance could be improved. Specifying this keyword does not prevent all rows from being retrieved.

OR col op col|[:]altval

Value can be a literal or data name. See also the altvalue parameter above.

ORDER [ASC|DESC] [col1 colN]

Sort the results table in ascending (default) or descending order, based on the values in the columns specified. Specify the column either by name or by relative position in the column selection list. Specify at least one column. Do not code with UPDATE.

UPDATE col1 colN

Modify columns during cursor processing. In cursor processing, you cannot modify a column unless you code UPDATE first. Do not code UPDATE with UNION, DISTINCT, GROUP BY, or if call specifies a join or selects column functions.

WHERE col op [:]altval

Column is the column on which to qualify the selection. Operator can be =, ^=, >, <, >=, <=, native SQL predicates (such as LIKE and BETWEEN). See also the altvalue parameter above.

WITH HOLD

Prevent the closing of a cursor as a consequence of a commit operation. See also "Comments" below.

Comments:

Examples:

Declare cursor set D2MAST-CURSOR; define to include all rows and columns in D2MASTER table; allow updating for PM_COLOR and PM_NEW_PART_NO columns.

DB-DECLARE D2MAST-CURSOR D2TAB-REC
... UPDATE PM_COLOR PM_NEW_PART_NO

Declare cursor set consisting of entire rows selected by evaluating two columns; if duplicate rows, select only one row where PM_PART_SHORT_DESC equals Working-Storage variable WS_PART_SHORT_DESC and PM_UNIT_BASE_PRICE is greater than 10 and less than 50.

DB-DECLARE D2MAST-CURSOR D2TAB-REC
... DISTINCT
... WHERE PM_PART_SHORT_DESC = 
... :WS-PART-SHORT-DESC
... AND PM_UNIT_BASE_PRICE BETWEEN 10 AND 50

Declare cursor and define its set to include two columns; select only rows that meet selection criteria; for column PM_PART_NO, move data to default destination; for column PM_COLOR, move data to alternate host-variable WS-COLOR.

DB-DECLARE D2MAST-CURSOR D2TAB-REC
... PM_PART_NO
... PM_COLOR (WS-COLOR)
... WHERE PM_PART_SHORT_DESC = 
... :WS-PART-SHORT-DESC
... AND PM_UNIT_BASE_PRICE BETWEEN 10 AND 50

Declare cursor and define its set to include two columns; select only one row that meets selection criteria. Sort columns by position within selection list; sort cursor first by PM_COLOR (second column in selection list), then within PM_COLOR by PM_PART_NO (first column).

DB-DECLARE D2MAST-CURSOR D2TAB-REC
... DISTINCT
... PM_PART_NO PM_COLOR
... WHERE PM_PART_SHORT_DESC = 
... :WS-PART-SHORT-DESC
... ORDER 2, 1

Declare a cursor set to include three columns drawn from two separate select statements, UNIONed together. Select two columns from D2TAB-REC and one column from D2INVEN-REC in the first UNION. Base selection criteria on PM_PART_NO matching IN_PART_NO, with PM_COLOR equal to the Working-Storage field WS-COLOR and IN-COLOR equal to 'BLUE'.

Select three columns from D2TAB-REC in the second UNION. Base selection criteria on PM_COLOR not equal to 'BLUE' and PM_UNITS less than 50. Sort the result table (consisting of rows returned from both select statements) by PM_PART_NO within PM_COLOR.

DB-DECLARE JOIN-CUR A.D2TAB-REC
... DISTINCT
... PM_PART_NO PM_COLOR
... B.D2INVEN_REC IN_QTY_ONHAND
... WHERE A.PM_PART_NO = B.IN_PART_NO
... AND A.PM_COLOR = :WS-COLOR
... AND B.IN_COLOR = 'BLUE'
... UNION
DB-OBTAIN REC D2TAB-REC
... PM_PART_NO PM_COLOR PM_UNITS
... WHERE PM_COLOR ^= 'BLUE'
... AND PM_UNITS < 50
... ORDER 1 ASC, 2 ASC

DB-ERASE

Category:

Database call (see Database Calls)

Description:

Delete a record or records.

Under IDMS, the call deletes:

Under IMS, the call deletes:

Under SQL, the call deletes:

Under VSAM, the call deletes:

Syntax:
IDMS DB
DB-ERASE REC recordname [PERM|SELECT|ALL]
IMS DB

Format 1:

DB-ERASE REC segment [FROM dataarea]
... [VIEW pcbname|PCB pcbname]

Format 2:, records obtained by path calls:

DB-ERASE REC|REF segment1 [FROM dataarea]
... [VIEW pcbname|PCB pcbname]
... REC|REF segment2 [FROM dataarea]
... [VIEW pcbname|PCB pcbname]
   .
   .
   .
... REC segmentN [FROM dataarea]
... [VIEW pcbname|PCB pcbname]
SQL

Format 1:

DB-ERASE REC copylibname-REC
... [WHERE column operator [:]altvalue
... [AND|OR column operator [:]altvalue
  .
  .
  .
... AND|OR column operator [:]altvalue]]

Format 2:

DB-ERASE REC copylibname-REC
... [WHERE CURRENT [OF] cursorname]
VSAM Batch

Format 1, key-qualified:

DB-ERASE REC recordname
 ... WHERE primarykeyname = value
 ... [SUB value] [OF dataarea]

Format 2, unqualified:

DB-ERASE REC recordname
VSAM Online

Format 1, key-qualified:

DB-ERASE REC recordname
... WHERE primarykeyname = value
... [SUB value] [OF dataarea] [KLEN value]
... [SYSID systemname] [DDN ddname]

Format 2, unqualified:

DB-ERASE REC recordname
Parameters:

[:](altvalue)

Alternate value; can be a literal, column name, or host-variable, as follows.

  • A host-variable is any COBOL data item referenced in your APS/SQL code; can a be data item generated automatically by APS/SQL to match a DB2 column name.

  • An alternate host-variable is one you instruct APS/SQL to use instead of the automatically generated one for a column.

  • Precede host-variables and alternate host-variables with a colon. APS generates a # symbol for the colon.

ALL

Same as PERManent, but delete all optional records.

AND col op [:]altval

Value can be a literal or data name. See also the altvalue parameter above.

DDN ddname

File data description name; supply a value to the name option of CICS DATASET option. Ddname can be a literal or data name defined as PIC X(8).

FROM dataarea

Alternate I/O area where program deletes, modifies, or adds a record. Required for a record obtained from an I/O area other than the default I/O area, such as by DB-OBTAIN INTO. See also "Comments" below.

IMSREC segmentname

Specify that the segment name (maximum 8 characters) is in a Working-Storage variable for the program to read, modify, add, or delete.

KLEN value

or

KEYLENGTH value

Specify number or characters in key length; full or partial length is valid. Value can be a number or a data name defined as PIC S9(4) COMP. APS generates the CICS GENERIC option for a partial key length.

OF dataarea

Qualify the I/O area moving to the value field, when more than one structure in the Data Division contains the field. Optionally code IN instead of OF.

OR col op [:]altval

Value can be a literal or data name. See also the altvalue parameter above.

PCB pcbname

Synonymous with VIEW. Specify PCB used when PSB contains multiple PCBs for the same database.

PERM[ANENT]

Disconnect optional records and delete

  • Named record

  • Mandatory member records owned by the named record

  • Mandatory member records, if a mandatory member record is an owner

SELECT[IVE]

Same as PERMANENT, but delete optional records if they are not members of another set.

SUB[SCRIPT] (value)

Move the subscripted field value to a specified field. Value can be a data name, literal, or, under VSAM Batch or Online, an integer.

SYSID systemname

Process records stored on remote systems. Name a file residing in a remote data set. Systemname can be a 4-character literal region name or a Working-Storage field containing a 4-character region name.

VIEW pcbname

Synonymous with PCB. Specify the PCB used when the PSB contains multiple PCBs for the same database. See also "Comments" below.

WHERE col op [:]altval

Not valid for cursor processing. Column is the column on which to qualify the selection. Operator can be =, ^=, >, <, >=, <=, native SQL predicates (such as LIKE and BETWEEN). See also the altvalue parameter above.

WHERE primarykey = val

Value can be literal, data name, or an asterisk (*). An asterisk indicates the segment record description contains the key value.

WHERE CURRENT [OF] cursor

Valid for cursor processing only. Act upon the row retrieved from cursor.

Comments:
IDMS DB

Record to be deleted must be current of run unit.

IMS DB

Examples:
IDMS DB

Record type ORDER is current of run unit. Delete it from the database; disconnect it from all set occurrences in which the record participates; delete all mandatory and optional member records.

DB-ERASE REC ORDER ALL
IMS DB

Delete only RECORD-B and RECORD-C. First, issue the following DB-OBTAIN call.

 DB-OBTAIN REC RECORD-A WHERE KEY-A = VALUE-A
 ... REC RECORD-B WHERE KEY-B = VALUE-B
 ... REC RECORD-C WHERE KEY-C = VALUE-C HOLD

Then, name all segments accessed by the prior path call DB-OBTAIN. Because the children of a deleted segment are also deleted, there is no need to code beyond the highest level segment being deleted (RECORD-B).

DB-ERASE REF RECORD-A
... REC RECORD-B
... REC RECORD-C
SQL

Delete any row in table D2MASTER where PM_PART_NO equals 123 or 567.

DB-ERASE REC D2TAB-REC
... WHERE PM_PART_NO = '123'
... OR PM_PART_NO = '567'
VSAM Batch

Delete a record where ORDR-NUMBER equals the value in the Working-Storage variable CUST-ORDR-NUMBER.

DB-ERASE REC ORDR-RECORD
... WHERE ORDR-NUMBER = CUST-ORDR-NUMBER

Read a CUST-RECORD for deletion.

DB-OBTAIN REC CUST-RECORD
... WHERE CUST-KEY = SCREEN-CUST-KEY
IF OK-ON-REC
    DB-ERASE REC CUST-RECORD
VSAM Online

Delete a group of ORDR-RECORD records; use partial key length. For successful deletes, store the number of actual records in APS data field APS-VSAM-NUMREC.

DB-ERASE REC ORDR-RECORD
... WHERE ORDR-NUMBER = SCREEN-PARTIAL-ORDR-NUMBER
... KLEN 6
IF  OK-ON-REC
    SCREEN-MSG = 
... 'ORDER RECORDS DELETED, NUMBER ORDERS = '
    SCREEN-NBR-RECS = APS-VSAM-NUMREC

Hold a CUST-RECORD for deletion.

DB-OBTAIN REC CUST-RECORD
... WHERE CUST-KEY = SCREEN-CUST-KEY
... HOLD
IF OK-ON-REC
    DB-ERASE REC CUST-RECORD

DB-FETCH

Category:

Database call (see Database Calls)

Compatibility:

SQL target

Description:

Sequentially retrieve rows from the cursor set defined by DB-DECLARE.

Syntax:
DB-FETCH CUR[SOR] cursorname
... [INTO dataname]
Parameters:

CUR[SOR] cursorname

Specify cursor. Cursorname must be previously named by DB-DECLARE or DB-PROCESS-ID.

INTO dataname

Move host variable structure into the alternate data structure data name. Data moves after the actual SQL call via a MOVE statement. Generated code is:

IF OK-ON-REC
    MOVE hostname TO dataname
Comments:

Example:

DB-FETCH CURSOR D2MAST-CURSOR
... INTO WS-D2MAST-RECORD

DB-FREE

Category:

Database call (see Database Calls)

Compatibility:

VSAM online target

Description:

Release file resources and:

Syntax:
DB-FREE REC recordname|ALL
... [VIEW keyname]
... [ENDBR] [UNLOCK] [REQID number]
... [SYSID systemname] [DDN ddname]
Parameters:

ALL

Process all subschema records. When coded with SYSID, all files must reside on the same region.

DDN ddname

Specify file ddname; can be a literal or data name defined as PIC X(8). Supply a value to the name option of CICS DATASET.

ENDBR

End active browse; generate CICS ENDBR command. See also "Comments" below.

REC recordname

COBOL record to process.

REQID number

Unique browse identifier for performing a simultaneous browse on the same key; is a single integer (0 - 9). Assign &VS-ENDBR-CONTROL = "USER" in the APS CNTL file APVSAMIN.

SYSID systemname

Remote system name (maximum 4 characters); can be a literal region name or a Working-Storage field.

UNLOCK

Unlock file; generate CICS UNLOCK command. See also "Comments" below.

VIEW keyname

Specify primary or alternate key.

Comments:

Examples:

Release a record held by a direct DB-OBTAIN; deactivate ENDBR.

DB-OBTAIN REC ORDR-RECORD
... WHERE ORDR-NUMBER = SCREEN-ORDR-NUMBER
... HOLD
DB-FREE REC ORDR-RECORD UNLOCK

Terminate a sequential DB-OBTAIN; specify the key used; deactivate UNLOCK.

DB-OBTAIN REC CUST-RECORD
... VIEW CUST-NUMBER
DB-FREE REC CUST-RECORD
... VIEW CUST-NUMBER ENDBR

DB-GET

Category:

Database call (see Database Calls)

Compatibility:

IDMS DB target

Description:

Move data from a previously located record (via a DB-OBTAIN REF) into Working-Storage.

Syntax:
DB-GET REC [recordname]
Parameter:

recordname

Retrieve record. Recordname is optional because the record is previously located by a DB-OBTAIN REF.

Example:

Record type ORDER is current of record type. After a successful DB-GET make ORDER data available to the program Working-Storage.

DB-GET REC ORDER

DB-MODIFY

Category:

Database call (see Database Calls)

Description:

Modify a record.

Under IDMS DB, the call rewrites the object record in the database from Working-Storage.

Under SQL, the call updates row contents in a table or cursor set, as follows.

Syntax:
IDMS DB
DB-MODIFY REC recordname
IMS DB
DB-MODIFY
... REC|REF recordname1 [FROM dataarea]
... [VIEW pcbname|PCB pcbname]
   .
   .
   .
... REC|REF recordnameN [FROM dataarea]
... [VIEW pcbname|PCB pcbname]
SQL
DB-MODIFY REC copylibname-REC
... [column1 [(altvalue)] [... columnN [(altvalue)]]]
... [FROM dataname]
... [WHERE column1 operator [:]altvalue
   .
   .
   .
... AND|OR columnN operator [:]altvalue]
... [END[WHERE]]]
... [WHERE CURRENT [OF] cursorname]
VSAM Batch
DB-MODIFY REC recordname [FROM dataarea]
VSAM Online
DB-MODIFY REC recordname [FROM dataarea]
... [SYSID systemname] [DDN ddname]
Parameters:

[:](altvalue)

Alternate value; can be a literal, column name, or host-variable, as follows.

  • A host-variable is any COBOL data item referenced in APS/SQL code; can a be data item generated by APS/SQL to match DB2 column name.

  • Iinstruct APS/SQL to use an alternate variable instead of the variable automatically generated for a column. If you name alternate host-variables for specific columns, do not code FROM, which names an entire alternate host structure.

  • Precede host-variables and alternate host-variables with a colon. APS generates a # symbol for the colon.

AND col op [:]altval

Value can be a literal or data name. See also the altvalue parameter above.

DDN ddname

Specify file ddname; can be a literal or data name defined as PIC X(8). Supply a value to the name option of CICS DATASET.

END[WHERE]

Terminate a WHERE clause. Required if you code WHERE before FROM.

FROM dataarea

Alternate I/O area where program deletes, modifies, or adds a record. Required for a record obtained from an I/O area other than the default I/O area, such as by DB-OBTAIN INTO.

FROM dataname

Move alternate data structure to the host variable structure name. Data moves prior to the actual SQL call via MOVE statement.

Preferred format is to code FROM before WHERE, otherwise you must separate the WHERE and FROM with ENDWHERE. See also "Comments" below.

IMSREC segmentname

Specify that the segment name (maximum 8 characters) is in a Working-Storage variable for the program to read, modify, add, or delete.

OR col op [:]altval

Value can be a literal or data name. See also the altvalue pararameter above.

PCB pcbname

Synonymous with VIEW. Specify the PCB used when the PSB contains multiple PCBs for the same database.

REC
copylib-REC

Specify the 01-level name of the COBOL row layout in the DCLGEN or copybook information. Cannot be the same as any cursor names or DB-PROCESS-ID names.

REC recordname

COBOL record or IMS segment to process.

REF recordname

Specify a COBOL record to reference. Under IMS, the program uses the referenced segment for navigating the database. See also "Comments" below.

SYSID systemname

Remote system name (maximum 4 characters); can be a literal region name or a Working-Storage field.

VIEW pcbname

Synonymous with PCB. Specify the PCB used when the PSB contains multiple PCBs for the same database. See also "Comments" below.

WHERE col
op
[:]altval

Not valid for cursor processing. Column is the column on which to qualify the selection. Operator can be =, ^=, >, <, >=, <=, native SQL predicates (such as LIKE and BETWEEN). See also the altvalue parameter above.

WHERE CURRENT [OF] cursor

Valid for cursor processing only. Act upon the row retrieved from cursor.

Comments:
IDMS DB

The object record must be current of run unit. If a CALC key is modified, the object record can be accessed by the new CALC key value.

IMS DB

VSAM Batch and Online

Before modifying a record, retrieve it with a DB-OBTAIN or DB-PROCESS call.

Examples:
IDMS DB

Rewrite record type ORDER, which is current of run unit, from Working-Storage.

DB-MODIFY REC ORDER
IMS DB

Modify only RECORD-C.

DB-OBTAIN REC RECORD-A WHERE KEY-A = VALUE-A
... REC RECORD-B WHERE KEY-B = VALUE-B
... REC RECORD-C WHERE KEY-C = VALUE-C HOLD
DB-MODIFY REF RECORD-A
... REF RECORD-B
... REC RECORD-C
SQL

Update specific columns of specific rows using selection criteria and alternate data from different areas for each column.

DB-MODIFY REC D2TAB-REC
... PM_UNIT_BASE_PRICE (25.99)
... PM_UNITS (:WS-UNITS)
... WHERE PM_PART_SHORT_DESC = 'WIDGET'
... AND PM_COLOR = 'RED'
... AND PM_UNIT_BASE_PRICE < 50
VSAM Batch

Hold CUST-RECORD for modification; specify an alternate storage area to contain the data that updates the record.

DB-OBTAIN REC CUST-RECORD
... WHERE CUST-NUMBER = SCREEN-CUST-NUMBER
IF  OK-ON-REC
    DB-MODIFY REC CUST-RECORD
    ... FROM CUST-RECORD-UPDATE-AREA
VSAM Online

Hold CUST-RECORD for modification; specify an alternate storage area to contain the data that updates the record.

DB-OBTAIN REC CUST-RECORD
... WHERE CUST-NUMBER = SCREEN-CUST-NUMBER
... HOLD
IF  OK-ON-REC
    DB-MODIFY REC CUST-RECORD
    ... FROM CUST-RECORD-UPDATE-AREA

DB-OBTAIN

Category:

Database call (see Database Calls)

Description:

Read and retrieve a database record.

Under IDMS DB, DB-OBTAIN:

Under IMS, DB-OBTAIN retrieves segments at any level and performs:

Under SQL, DB-OBTAIN:

Under VSAM, DB-OBTAIN:

Syntax:
IDMS DB

Format 1, based on a CALC key or an indexed or sorted set:

DB-OBTAIN REC|REF recordname
... WHERE keyname = value [NEXT]
... [HOLD] [EXCLUSIVE]

Format 2, where the most recently retrieved occurrence of a record type is current of run unit:

DB-OBTAIN REC|REF recordname CURRENT
... [HOLD] [EXCLUSIVE]

Format 3, where the most recently retrieved occurrence of any record in the set or area is current of run unit:

DB-OBTAIN REC|REF IDMSREC
... SET setname|AREA areaname CURRENT
... [HOLD] [EXCLUSIVE]

Format 4, based on database address:

DB-OBTAIN REC|REF IDMSREC|recordname
... WHERE DBKEY = value
... [HOLD] [EXCLUSIVE]

Format 5, where the set owner is obtained when record is unknown:

DB-OBTAIN REC|REF IDMSREC
... SET setname OWNER
... [HOLD] [EXCLUSIVE]

Format 6, based on a CALC key or an indexed or sorted set, using a valid operator:

DB-OBTAIN [REF recordname1] REC|REF recordname2
... WHERE sortkey operator value
... [SET setname [RESET]]|[RESET]
... [HOLD] [EXCLUSIVE]

Format 7, based on position within set:

DB-OBTAIN [REF recordname1] REC|REF recordname2
... [SET setname]
... [WHERE SEQUENCE = number|FIRST|LAST|PREV|NEXT]
... [HOLD] [EXCLUSIVE]

Format 8, based on position within the set when the record is unknown:

DB-OBTAIN REC|REF IDMSREC SET setname|AREA areaname
... [WHERE SEQUENCE = number|FIRST|LAST|PREV|NEXT]
... [HOLD] [EXCLUSIVE]

Format 9, based on position within area:

DB-OBTAIN REC|REF recordname [AREA areaname]
... [WHERE SEQUENCE = number|FIRST|LAST|PREV|NEXT]
... [HOLD] [EXCLUSIVE]
IMS DB

Format 1, unqualified:

DB-OBTAIN REC recordname [HOLD] [RESET]

Format 2, qualified:

DB-OBTAIN REC recordname
... WHERE fieldname1 operator value
... [AND|OR fieldname2 operator value [FIRST|LAST]
... [INTO dataarea]
        .
        .
... [AND|OR fieldnameN operator value] [FIRST|LAST]
... [INTO dataarea] [HOLD]]] [RESET]

Format 3, qualified on secondary index values:

DB-OBTAIN REC recordname
... WHERE fieldname operator (value1 [ ... valueN])
... [INTO dataarea]
... [FIRST|LAST] [HOLD] [RESET]

Format 4, qualified compound retrieval:

DB-OBTAIN REF segmentname1 WHERE fieldname1 operator value
... REC|REF segmentname2 WHERE fieldname2 operator value
        .
        .
        .
... [REC segmentnameN WHERE fieldnameN operator value
... [FIRST|LAST] [HOLD]]
... [RESET]

Format 5, retrieve next segment:

DB-OBTAIN NEXT[REC] INTO dataarea 
...VIEW pcbname|PCB pcbname [HOLD] [RESET]

Format 6, retrieve segment specified in program at run time:

MOVE 'segmentname' TO segmentname
DB-OBTAIN IMSREC segmentname FROM dataarea
... VIEW pcbname|PCB pcbname

Format 7, retrieve dependent of current record:

DB-OBTAIN REF recordname1 CURRENT
... REC recordname2 [WHERE fieldname operator value]

Format 8, retrieve segment from PSB with multiple PCBs:

DB-OBTAIN REC recordname
... [WHERE fieldname operator value]
... VIEW pcbname|PCB pcbname

Format 9, retrieve qualified or subscripted field:

DB-OBTAIN REC recordname
... WHERE keyname operator fieldname
... OF dataarea|SUB (number)

Format 1, retrieve dependent record via concatenated key:

DB-OBTAIN REC recordname CKEYED dataname

Format 1, qualified, select all columns:

DB-OBTAIN REC copylibname-REC
... WHERE column operator [:]altvalue|column
... [AND|OR column operator [:]altvalue|column]
        .
        .
        .
... [AND|OR column operator [:]altvalue|column]
... [INTO dataname]

Format 2, unqualified, select all columns:

DB-OBTAIN REC copylibname-REC
... [INTO dataname]

Format 3, join all columns from two tables:

DB-OBTAIN REC correlname1.copylibname-REC
... REC correlnameN.copylibname-REC
... [WHERE correlname.column oper [:]altvalue|correlname.column
... [AND|OR correlname.column op [:]altvalue|correlname.column]
        .
        .
... [AND|OR correlname.column oper [:]altvalue|correlname.col]]

Format 4, select specific columns:

DB-OBTAIN REC copylibname-REC [DISTINCT]
... column1 [(altvalue)] [... columnN [(altvalue)]]
... [WHERE [correlname.]column operator [:]altvalue|column]
VSAM Batch

Format 1, sequential:

DB-OBTAIN REC recordname 
... [VIEW keyname] [INTO dataarea] [RESET]

Format 2, direct:

DB-OBTAIN REC recordname
... WHERE keyname operator value [SUB value]
... [OF dataarea] [INTO dataarea]

Format 3, positional:

DB-OBTAIN REF recordname
... WHERE keyname operator value [SUB value] [OF dataarea]
VSAM Online

Format 1, sequential:

DB-OBTAIN REC recordname 
... [VIEW keyname] [INTO dataarea]
... [HOLD] [PREV] [REQID number] [RESET]
... [SYSID systemname] [DDN ddname]

Format 2, direct:

DB-OBTAIN REC recordname
... WHERE keyname operator value [SUB value]
... [OF dataarea] [INTO dataarea] [KLEN value]
... [HOLD] [REQID number]
... [SYSID systemname] [DDN ddname]

Format 3, positional:

DB-OBTAIN REF recordname
... WHERE keyname operator value [SUB value] [OF dataarea]
... [KLEN value] [RESETBR] [REQID number]
... [SYSID systemname] [DDN ddname]
Parameters:

[:](altvalue)

Alternate value; can be a literal, column name, or host-variable, as follows.

  • A host-variable is any COBOL data item referenced in your APS/SQL code; can a be data item generated automatically by APS/SQL to match a DB2 column name.

  • An alternate host-variable is one you instruct APS/SQL to use instead of the automatically generated one for a column.

  • If you name alternate host-variables for specific columns, do not code INTO, which names an entire alternate host structure.

  • Precede host-variables and alternate host-variables with a colon. APS generates a # symbol for the colon.

AND col op xol|[:]altval

Value can be a literal or data name. See also the altvalue parameter above.

AREA areaname

IDMS area name.

CKEYED dataname

Single data area containing concatenated key information.

correlname.

Correlation name (maximum 18 characters); end with a period. Required if columnname is in a select list or if the WHERE clause appears in multiple joined tables.

CURRENT

Under IDMS DB, process the last record of the type accessed. See also "Comments" below.

Under IMS DB, establish positioning at the specified dependent of the current, previously-read parent.

DBKEY=value

Assign value to DB key.

DDN ddname

Specify file ddname; can be a literal or data name defined as PIC X(8). Supply a value to the name option of CICS DATASET.

DISTINCT

Eliminate all but one row from each set of duplicate rows. Duplicate rows have identical selected columns from the results table.

EXCLUSIVE

IDMS keep exclusive; place an exclusive lock on the record.

FIRST

Under IDMS DB, retrieve the first record in the set.

Under IMS DB, establish positioning at the first occurrence of the specified segment; generate IMS code F.

FROM dataarea

Alternate I/O area where program deletes, modifies, or adds a record. Required for a record obtained from an I/O area other than the default I/O area, such as by DB-OBTAIN INTO.

HOLD

Hold a record for modification or deletion. Code only once, at end of call. Do not code with PREV or KLEN. See also "Comments" below.

Under IDMS DB, keep DML; place an explicit shared lock on the record.

IDMSREC

Retrieve IDMS record; do not specify a record name.

IMSREC segmentname

Specify that the segment name (maximum 8 characters) is in a Working-Storage variable for the program to read, modify, add, or delete. See also "Comments" below.

INTO dataarea

Specify I/O area where the program reads a record.

INTO dataname

Move host variable structure into the alternate data structure dataname. Can code before or after WHERE.

Data moves after the actual SQL call via a MOVE statement. Generated code:

IF OK-ON-REC
    MOVE hostname TO dataname

KLEN value

or

KEYLENGTH value

Specify number or characters in key length; full or partial length is valid. Value can be a number or a data name defined as PIC S9(4) COMP. APS generates the CICS GENERIC option for a partial key length. Do not use with HOLD.

LAST

Under IDMS DB, retrieve last record in set.

Under IMS DB, establish positioning at the last occurrence of the specified segment; generate IMS code L.

NEXT

Under IDMS DB, retrieve next record in the set (default).

Under IMS DB, sequentially read forward in database.

OF dataarea

Qualify the I/O area moving to the value field, when more than one structure in the Data Division contains the field. Optionally code IN instead of OF.

OR col op col|[:]altval

Value can be a literal or data name. See also the altvalue parameter above.

OWNER

Specify owner record.

PCB pcbname

Synonymous with VIEW. Specify the PCB used when the PSB contains multiple PCBs for the same database. Must be last keyword in call. See also "Comments" below.

PREV[IOUS]

Perform a reverse sequential browse starting at the last record in file. Do not code with HOLD or KLEN.

REC copylib-REC

Specify the 01-level name of the COBOL row layout in the DCLGEN or copybook information. Copybook library name of source data. Cannot be the same as any cursor names or DB-PROCESS-ID names. See also "Comments" below.

REC recordname

COBOL record or IMS segment to process.

REF recordname

Specify a COBOL record to reference. Under IMS, the program uses the referenced segment for navigating the database. See also "Comments" below.

REQID number

Unique browse identifier for performing a simultaneous browse on the same key; is a single integer (0 - 9). Assign &VS-ENDBR-CONTROL = "USER" in the APS CNTL file APVSAMIN.

RESET

Reset database or file positioning to the beginning. Code only once, at end of call. Code with PREV or KLEN, to reset file position to end.

Alternate reset method: prior to retrieving under VSAM Batch or Online, set RESET-OBTAIN flag to TRUE; under IMS DB, set RESET-POSITION flag to TRUE.

RESETBR

Reset active browse on key name; generate CICS RESETBR.

SEQUENCE = number

Specify sequence number.

SET setname

Specify IDMS set name. See also "Comments" below.

SUB[SCRIPT] (value)

Move the subscripted field value to a specified field. Value can be a data name, literal, or, under VSAM Batch or Online, an integer.

SYSID systemname

Remote system name (maximum 4 characters); can be a literal region name or a Working-Storage field.

VIEW keyname

Specify key primary or alternate key.

VIEW pcbname

Synonymous with PCB. Specify the PCB used when the PSB contains multiple PCBs for the same database. Must be last keyword in call. See also "Comments" below.

WHERE column op [:]altval

Column is the column on which to qualify the selection. Operator can be: =, ^=, >, <, >=, <=, native SQL predicates (such as LIKE and BETWEEN). See also the altvalue parameter above.

WHERE fld|key op val|fld

Under VSAM Batch or Online, operator can be: =, EQ, >=, GTEQ; otherwise operator can be: =, EQ, >, GT, <, LT, >=, GE, <=, LE, <>, NE, ^=.

Value can be literal, data name, or an asterisk (*). An asterisk indicates the segment record description contains the key value.

Comments:
IDMS DB

IMS DB

VSAM Online

Always follow a DB-OBTAIN HOLD with a DB-MODIFY or DB-ERASE.

Examples:
IDMS DB

Retrieve records with complex key.

MOVE SCR1-LAST-NAME TO CUSTOMER-LAST-NAME
MOVE SCR1-FIRST-NAME TO CUSTOMER-FIRST-NAME
DB-OBTAIN REC CUSTOMER WHERE CUSTOMER-NAME-KEY = *

Make recent occurrence of any record current of run unit.

DB-OBTAIN REC IDMSREC AREA CUST-REGION
... CURRENT

Obtain record based on database address.

DB-OBTAIN REC CUSTOMER WHERE DBKEY = WS-DBKEY

Obtain fifth record in the set.

DB-OBTAIN REF CUSTOMER REF ORDER WHERE SEQUENCE = 5
IMS DB

Do a compound DB-OBTAIN to obtain SEGMENT-C.

DB-OBTAIN REF SEGMENT-A WHERE KEY-A = VALUE-A
... REF SEGMENT-B WHERE KEY-B = VALUE-B
... REC SEGMENT-C WHERE KEY-C = VALUE-C HOLD

Do a path call to retrieve three segments. Use REC at each level to indicate that each record is retrieved.

DB-OBTAIN REC SEGMENT-A WHERE KEY-A = VALUE-A
... REC SEGMENT-B WHERE KEY-B = VALUE-B
... REC SEGMENT-C HOLD

Do a path call to retrieve specific records (SEGMENT-A, SEGMENT-C) at certain levels. Specify that SEGMENT-B is used for qualification only and is not retrieved.

DB-OBTAIN REC SEGMENT-A WHERE KEY-A = VALUE-A
... REF SEGMENT-B WHERE KEY-B = VALUE-B
... REC SEGMENT-C HOLD

Using position, qualify database access. First, retrieve RECORD-A. Then, retrieve RECORD-B; restrict the retrieval of RECORD-B to children of the previously retrieved RECORD-A.

DB-OBTAIN REC RECORD-A WHERE FIELD-1 = VALUE-1
DB-OBTAIN REF RECORD-A CURRENT
... REC RECORD-B WHERE FIELD-2 = VALUE-2

Retrieve the last occurrence of RECORD-B under a specific RECORD-A.

DB-OBTAIN REF RECORD-A WHERE FIELD-1 = VALUE-1
... REC RECORD-B LAST

Reference the next occurrence of RECORD-A; retrieve the first occurrence of RECORD-B under RECORD-A and read it into DATAAREA-B. Also, retrieve the first occurrence of RECORD-C under RECORD-B and read it into DATAAREA-C.

DB-OBTAIN REF RECORD-A
... REC RECORD-B INTO DATAAREA-B
... REC RECORD-C INTO DATAAREA-C

Retrieve RECORD-A based on the value of the data name FIELD-X, which is found in DATAAREA-Z.

DB-OBTAIN REC RECORD-A
... WHERE KEY-A = FIELD-X OF DATAAREA-Z

Assume FIELD-X is an array as shown. First, retrieve RECORD-A based on the value of the seventh occurrence of FIELD-X. Then, obtain a dependent record by specifying its concatenated key.

01  FIELD-X OCCURS 10 TIMES PIC X(10).
        .
        .
        .
DB-OBTAIN REC RECORD-A
... WHERE KEY-A = FIELD-X SUB(7)
        .
        .
        .
DB-OBTAIN REC RECORD-C
... CKEYED WS-FIELD
SQL

Select the rows where PM_PART_NO equals 123; move the data to an alternate area, WS-D2MAST-RECORD in Working-Storage.

DB-OBTAIN REC D2TAB-REC
... WHERE PM_PART_NO = '123'
... INTO WS-D2MAST-RECORD

Select only one row (if duplicates exist) based on multiple selection criteria.

DB-OBTAIN REC D2TAB-REC DISTINCT
... WHERE PM_PART_SHORT_DESC = 'WIDGET'
... AND PM_COLOR = 'RED'

Select only columns PM_PART_NO and PM_COLOR, from rows of table D2MASTER based on multiple selection criteria; eliminate duplicate rows. For column PM_PART_NO, move the data to the default destination, the COBOL host-variable of the same name; for column PM_COLOR, name an alternate destination, Working-Storage field WS-COLOR.

DB-OBTAIN REC D2TAB-REC DISTINCT
... PM_PART_NO PM_COLOR (WS-COLOR)
... WHERE PM_PART_SHORT_DESC = 'WIDGET'
... AND PM_COLOR = 'RED'
VSAM Batch

Read records sequentially by the CUST-NUMBER key.

DB-OBTAIN REC CUST-RECORD VIEW CUST-NUMBER

Read records sequentially; store record in an alternate storage area.

DB-OBTAIN REC CUST-RECORD
... INTO CUST-RECORD-SAVE-AREA

Read records by CUST-NUMBER key; identify the subscripted SCREEN-CUST-NUMBER that is used as the key search value. After successful execution, establish file position so that a sequential DB-OBTAIN can read the next record.

DB-OBTAIN REC CUST-RECORD
... WHERE CUST-NUMBER = SCREEN-CUST-NUMBER
... SUB (ROW-CTR)

Verify the existence of a CUST-NUMBER and (if successful) provide a starting point in the file for a sequential DB-OBTAIN to execute.

DB-OBTAIN REF CUST-RECORD
... WHERE CUST-NUMBER = SCREEN-CUST-NUMBER
IF  OK-ON-REC
    DB-OBTAIN REC CUST-RECORD
    ... VIEW CUST-NUMBER
VSAM Online

Sequentially read records into an alternate storage area and hold a record for updating. The VSAM Generator ends the sequential read and rereads the file via the primary key for updating. The sequential read is then resumed on the next execution of the DB-OBTAIN call.

DB-OBTAIN REC CUST-RECORD
... INTO CUST-RECORD-SAVE-AREA
... HOLD
      .
      .
DB-MODIFY REC CUST-REC

Read records sequentially by the CUST-NUMBER key.

DB-OBTAIN REC CUST-RECORD VIEW CUST-NUMBER

Read records by CUST-NUMBER key. Identify the subscripted SCREEN-CUST-NUMBER that is used as the key search value. Establish file position for a sequential DB-OBTAIN.

DB-OBTAIN REC CUST-RECORD
... WHERE CUST-NUMBER = SCREEN-CUST-NUMBER SUB (ROW-CTR)

Read by ORDR-NUMBER; hold the record for updating. Note that if ORDR-NUMBER was an alternate key, the file would be reread via the primary key for updating.

DB-OBTAIN REC ORDR-RECORD
... WHERE ORDR-NUMBER = CUST-ORDR-NUMBER HOLD

Verify the existence of CUST-RECORD with the value specified in CUST-NUMBER and (if successful) provide a starting point in the file for a sequential DB-OBTAIN.

DB-OBTAIN REF CUST-RECORD
... WHERE CUST-NAME = SCREEN-CUST-NAME
IF  OK-ON-REC
    DB-OBTAIN REC CUST-RECORD... VIEW CUST-NAME

DB-OPEN

Category:

Database call (see Database Calls)

Compatibility:

IDMS DB, SQL, and VSAM batch targets

Description:

Open a record, cursor set, or file.

Syntax:
IDMS DB
DB-OPEN [ALL] [MODE usagemode]
... [AREA areaname]
SQL
DB-OPEN CUR[SOR] cursorname
OS4 and VSAM Batch

Format 1:

DB-OPEN FILE filename [... filename]
... MODE option

Format 2:

DB-OPEN FILE ALL
... MODE option
Parameters:

ALL

Specify all files and ready all areas defined in the subschema.

AREA areaname

IDMS area name.

CUR[SOR] cursorname

Specify cursor. Cursorname must be previously named by DB-DECLARE or DB-PROCESS-ID.

FILE filename

File(s) to process.

MODE option

File processing mode: INPUT, OUTPUT, I-O, EXTEND

MODE usagemode

Usage mode--RETRIEVAL (default),PROTECTED RETRIEVAL, EXCLUSIVE RETRIEVAL, UPDATE, PROTECTED UPDATE, EXCLUSIVE UPDATE

Comments:
IDMS DB

SQL

A cursor set can be opened, processed, and closed multiple times in the same program. A DB-OPEN issued for an open cursor set causes an error; first code a DB-CLOSE.

SAM Batch

DB-OPEN is required.

Examples:

Open the DORDER file for write-only processing.

DB-OPEN FILE DORDER MODE EXTEND
IDMS DB

Ready all areas in the data view in the default usage mode.

DB-OPEN ALL

Ready CUSTOMER-REGION in PROTECTED UPDATE usage mode.

DB-OPEN MODE PROTECTED UPDATE AREA CUSTOMER-REGION
SQL

Open cursor set D2MAST-CURSOR, previously defined in DB-DECLARE.

DB-OPEN CURSOR D2MAST-CURSOR
VSAM Batch

Open the AORDER and ASUPLIR files for I-O processing.

DB-OPEN FILE AORDER ASUPLIR MODE I-O

DB-PROCESS

Category:

Database call (see Database Calls)

Description:

Combine record retrieval and looping functions into one call.

Under IDMS DB, DB-PROCESS processes all records within a set, an area, or an indexed set based on a specified value.

Under IMS, DB-PROCESS processes:

Under SQL, DB-PROCESS simplifies cursor row processing by:

Under VSAM, DB-PROCESS processes records:

Syntax:
IDMS DB
DB-PROCESS [REF recordname] REC recordname
... [DB-PROCESS-ID name] [WHERE keyname operator value]
... [SET setname|AREA areaname] [RESET] [HOLD] [EXCLUSIVE]
 Controlled logic block
IMS DB

Format 1, key-qualified:

DB-PROCESS REC recordname
... [WHERE keyname operator value [SUB value] [OF dataarea]]
... [DB-PROCESS-ID name] [INTO dataarea]
... [HOLD] [RESET]
... [VIEW pcbname|PCB pcbname]
 Controlled logic block

Format 2, unqualified:

DB-PROCESS REC recordname
... [DB-PROCESS-ID name] [INTO dataarea]
... [HOLD] [RESET]
... [VIEW pcbname|PCB pcbname]
 Controlled logic block
SQL

Format 1, unqualified--select all columns:

DB-PROCESS REC copylibname-REC
... [DB-PROCESS-ID name]
... [DB-LOOP-MAX=number]
... [FETCH ONLY] [WITH HOLD]
... [OPTIMIZE number]
... [UPDATE|ORDER
... column1 [ASC|DESC] [...columnN [ASC|DESC]]]
... [INTO dataname]
 Controlled logic block

Format 2, qualified--select all columns:

DB-PROCESS REC copylibname-REC
... [DB-PROCESS-ID name]
... [FETCH ONLY] [WITH HOLD] [OPTIMIZE number]
... WHERE column operator [[:]]altvalue]|column
... [AND|OR column operator [[:]altvalue]|column]
          .
          .
... [AND|OR column operator [[:]altvalue]|column]
... [DB-LOOP-MAX=number]
... [UPDATE|ORDER
... column1 [ASC|DESC] [...columnN [ASC|DESC]]]
... [INTO dataname]
 Controlled logic block

Format 3, select specific columns:

DB-PROCESS REC copylibname-REC
... [DB-PROCESS-ID name]
... [DISTINCT]
... [FETCH ONLY]
... [WITH HOLD]
... [OPTIMIZE number]
... column1 [(altvalue)] [... columnN [(altvalue)]]
... WHERE column operator [[:]altvalue]|column
... [AND|OR column operator [[:]altvalue]|column]
          .
          .
          .
... [AND|OR column operator [[:]altvalue]|column]
... [DB-LOOP-MAX=number]
... [UPDATE|ORDER
... column1 [ASC|DESC] [...columnN [ASC|DESC]]]
 Controlled logic block

Format 4, join columns from two or more tables:

DB-PROCESS REC correlname.copylibname-REC
... [DB-PROCESS-ID name] [DISTINCT]
... [FETCH ONLY] [WITH HOLD]
... [OPTIMIZE number]
... [column1 [(altvalue)] [... columnN [(altvalue)]]]
... REC correlname.copylibname-REC
... [column1 [(altvalue)] [... columnN [(altvalue)]]]
          .
          .
... [WHERE correlname.column oper [[:]altvalue]|correlname.column
... [AND|OR correlname.column oper [[:]altvalue]|correlname.col]
          .
          .
... [AND|OR correlname.column oper [[:]altvalue]|correlname.col]
... [DB-LOOP-MAX=number]
... [ORDER
... column1 [ASC|DESC] [...columnN [ASC|DESC]]]
 Controlled logic block

Format 5, specify a UNION:

DB-PROCESS REC copylibname-REC
... [DB-PROCESS-ID name]
... [DISTINCT]
... [FETCH ONLY]
... [WITH HOLD]
... [OPTIMIZE number]
... [column1 [(altvalue)] [... columnN [(altvalue)]]]
... [WHERE column operator [[:]altvalue]|column
... [AND|OR column operator [[:]altvalue]|column]
          .
          .
          .
... [AND|OR column operator [[:]altvalue]|column]]
... [DB-LOOP-MAX=number]
... UNION [ALL]
DB-OBTAIN REC copylibname-REC
          .
          .
          .
... [ORDER
... column1 [ASC|DESC] [...columnN [ASC|DESC]]]
 Controlled logic block
VSAM Batch

Format 1, qualified:

DB-PROCESS REC recordname WHERE keyname operator value
... [DB-PROCESS-ID name] [SUB value]
... [OF dataarea] [INTO dataarea]
 Controlled logic block

Format 2, unqualified:

DB-PROCESS REC recordname [VIEW keyname]
... [DB-PROCESS-ID name] [INTO dataarea] [RESET]
 Controlled logic block
VSAM Online

Format 1, key-qualified:

DB-PROCESS REC recordname WHERE keyname operator value
... [DB-PROCESS-ID name] [SUB value]
... [OF dataarea] [INTO dataarea]
... [KLEN value] [HOLD] [PREV]
... [REQID number] [SYSID systemname]
... [DDN ddname]
 Controlled logic block

Format 2, unqualified:

DB-PROCESS REC recordname
... [DB-PROCESS-ID name] [INTO dataarea]
... [HOLD] [PREV] [RESET]
... [REQID number] [SYSID systemname]
... [VIEW keyname] [DDN ddname]
 Controlled logic block
Parameters:

[:](altvalue)

Alternate value; can be a literal, column name, or host-variable, as follows.

  • A host-variable is any COBOL data item referenced in your APS/SQL code; can a be data item generated automatically by APS/SQL to match a DB2 column name.

  • An alternate host-variable is one you instruct APS/SQL to use instead of the automatically generated one for a column.

  • If you name alternate host-variables for specific columns, do not code INTO, which names an entire alternate host structure.

  • Precede host-variables and alternate host-variables with a colon. APS generates a # symbol for the colon.

AND col op col|[:]altval

Value can be a literal or data name. See also the altvalue parameter above.

AREA areaname

IDMS area name.

BROWSE col1 colN

Modify columns during cursor processing. In cursor processing, you cannot modify a column unless you specify UPDATE first. Do not code BROWSE with ORDER, UNION, DISTINCT, GROUP BY, or if the call specifies a join or selects column functions.

CKEYED

Retrieve segment with a concatenated key.

correlname.

Correlation name (maximum 18 characters); end with a period. Required if columnname is in a select list or if the WHERE clause appears in multiple joined tables.

CURRENT

Under IDMS DB, process the last record of the type accessed.

Under IMS DB, establish positioning at the specified dependent of the current, previously-read parent.

DB-LOOP-MAX=number

Maximum number loops allowed. Overrides loop flags for current structure only; you can define a different limit for each DB-PROCESS. See also "Comments" below.

DB-PROCESS-ID name

Generate:

  • Cursor named name (for SQL targets)
  • End-process flag named name-END-PROCESS
  • Counter named name-PROCESS-CTR

Name (maximum 12 characters) must be unique, and cannot be the same as the subschema copylib names. See also "Comments" below.

DDN ddname

Specify file ddname; can be a literal or data name defined as PIC X(8). Supply a value to the name option of CICS DATASET.

DISTINCT

Eliminate all but one row from each set of duplicate rows. Duplicate rows have identical selected columns from the results table.

EXCLUSIVE

IDMS keep exclusive; place an exclusive lock on the record.

FETCH ONLY

Specify that the table is read-only and therefore the cursor cannot be referred to in positioned UPDATE and DELETE statements. Do not code in a call that contains an UPDATE clause.

FIRST

Under IDMS DB, retrieve the first record in the set.

Under IMS DB, establish positioning at the first occurrence of the specified segment; generate IMS code F.

HOLD

Hold a record for modification or deletion. Code only once, at end of call. Do not code with PREV or KLEN.

Under IDMS DB, keep DML; place an explicit shared lock on the record.

IMSREC segmentname

Specify that the segment name (maximum 8 characters) is in a Working-Storage variable for the program to read, modify, add, or delete.

INTO dataarea

Specify I/O area where the program reads a record.

INTO dataname

Move host variable structure into the alternate data structure dataname. Can code before or after WHERE.

Data moves after the actual SQL call via a MOVE statement. Generated code:

IF OK-ON-REC
MOVE hostname TO dataname

KLEN value

or

KEYLENGTH value

Specify number or characters in key length; full or partial length is valid. Value can be a number or a data name defined as PIC S9(4) COMP. APS generates the CICS GENERIC option for a partial key length. Do not use with HOLD or PREV.

LAST

Under IDMS DB, retrieve last record in set.

Under IMS DB, establish positioning at the last occurrence of the specified segment; generate IMS code L.

NEXT

Under IDMS DB, retrieve next record in the set (default).

Under IMS DB, sequentially read forward in database.

OF dataarea

Qualify the I/O area moving to the value field, when more than one structure in the Data Division contains the field. Optionally code IN instead of OF.

OPTIMIZE number

Specify estimated maximum number of rows that call will retrieve. If the call retrieves no more than number rows, performance could be improved. Specifying this keyword does not prevent all rows from being retrieved.

OR col op col|[:]altval

Value can be a literal or data name. See also the altvalue parameter above.

ORDER [ASC|DESC] [col1 colN]

Sort the results table in ascending (default) or descending order, based on the values in the columns specified. Specify the column either by name or by relative position in the column selection list. Specify at least one column. Do not code with UPDATE.

PCB pcbname

Synonymous with VIEW. Specify the PCB used when the PSB contains multiple PCBs for the same database.

PREV[IOUS]

Perform a reverse sequential browse starting at the last record in file. Do not code with HOLD or KLEN.

REC copylib-REC

Specify the 01-level name of the COBOL row layout in the DCLGEN or copybook information. Cannot be the same as any cursor names or DB-PROCESS-ID names.

REC recordname

COBOL record or IMS segment to process.

REF recordname

Specify a COBOL record to reference. Under IMS, the program uses the referenced segment for navigating the database.

REQID number

Unique browse identifier for performing a simultaneous browse on the same key; is a single integer (0 - 9). Assign &VS-ENDBR-CONTROL = "USER" in the APS CNTL file APVSAMIN.

RESET

Reset database or file positioning to the beginning. Code only once per call, at end. Code with PREV or KLEN, to reset file position to end.

Alternate reset method: prior to retrieving under VSAM Batch or Online, set RESET-OBTAIN flag to TRUE; under IMS DB, set RESET-POSITION flag to TRUE.

SUB[SCRIPT] (value)

Move the subscripted field value to a specified field. Value can be a data name, literal, or, under VSAM Batch or Online, an integer.

SYSID systemname

Remote system name (maximum 4 characters); can be a literal region name or a Working-Storage field.

UPDATE col1 colN

Modify columns during cursor processing. In cursor processing, you cannot modify a column unless you specify UPDATE first. Do not code UPDATE with ORDER, UNION, DISTINCT, GROUP BY, or if the call specifies a join or selects column functions.

VIEW keyname

Specify primary or alternate key.

VIEW pcbname

Synonymous with PCB. Specify the PCB used when the PSB contains multiple PCBs for the same database.

WHERE col op [:]altval

Column is the column on which to qualify the selection. Operator can be: =, ^=, >, <, >=, <=, native SQL predicates (such as LIKE and BETWEEN). See also the altvalue parameter above.

WHERE fld|key op value

Under VSAM Batch or Online, operator can be: =, EQ, >=, GTEQ; otherwise operator can be: =, EQ, >, GT, <, LT, >=, GE, <=, LE, <>, NE, ^=.

Value can be literal, data name, or an asterisk (*). An asterisk indicates the segment record description contains the key value.

WITH HOLD

Prevent the closing of a cursor as a consequence of a commit operation. See also "Comments" below.

Loop Structure

DB-PROCESS provides a built-in loop structure to process records and rows. The loop structure can include blocks of user-supplied logic and APS-generated control fields. User logic executes once for each successful iteration of DB-PROCESS, and can include

APS generates the following fields, enabling you to logically terminate the loop structure.

APS-END-PROCESS

S-COBOL flag initialized FALSE. To end the process loop, set flag to TRUE.

name-END-PROCESS

APS generates this flag, where name is the PROCESS-ID name. Use this flag when using DB-PROCESS-ID clauses for nested loops.

name-PROCESS-CTR

APS generates this counter, where name is the PROCESS-ID name. Use this counter when using DB-PROCESS-ID clauses for nested loops.

APS-PROCESS-CTR

APS increments this counter at each process loop execution. This counter

  • Controls looping.
  • Serves as a subscript when moving data into a table or screen fields.
  • Counts processed records.

IMS DB, VSAM Batch, and VSAM Online

Sample loop syntax:

/* Begin process loop
DB-PROCESS REC recordname
... WHERE keyname operator value parameters
... [DB-PROCESS-ID name]
    IF  APS-PROCESS-CTR|name-PROCESS-CTR > value
    /* End process loop
        TRUE APS-END-PROCESS|name-END-PROCESS
    ELSE
        /* User-written record processing logic
IF ...
/*Logic executed after process loop termination
/*    Includes file status checking
IDMS DB

Sample loop syntax:

DB-OBTAIN REC recordname WHERE key = value
/* Begin process loop
DB-PROCESS REF recordname REC recordname
    IF APS-PROCESS-CTR > value
    /* End process loop
        TRUE APS-END-PROCESS
    ELSE
        /* User-written record processing logic
        /*     Can include file status checking
/* Logic executed after process loop termination
   /*     Can include file status checking
SQL

Sample loop syntax:

/* Begin process loop
DB-PROCESS REC recordname
    /* Custom row processing code
    IF APS-PROCESS-CTR|name-PROCESS-CTR > value
    /* End process loop
        TRUE APS-END-PROCESS|name-END-PROCESS
    ELSE
        /* Custom record processing logic
        /*     Can include file status checking
/* Logic executed after process loop termination
/*     Can include file status checking
Comments:

IMS DB

Processing begins at a previously established position in the database or, if RESET coded, at the beginning of the database.

SQL

VSAM Batch

VSAM Online

Examples:
IMS DB, VSAM Batch, and VSAM Online

Process CUST-RECORD; execute logic upon each successful read. Note that CUST-PROCESS-CTR serves as a subscript for the screen fields.

DB-PROCESS REC CUST-RECORD
... WHERE CUST-KEY >= SCREEN-KEY
... DB-PROCESS-ID CUST
        IF  CUST-PROCESS-CTR > SCREEN-MAX
            TRUE CUST-END-PROCESS
        ELSE
            SCREEN-CUST    (CUST-PROCESS-CTR) = CUST-NAME
            SCREEN-PHONE   (CUST-PROCESS-CTR) = CUST-PHONE
            SCREEN-ADDRESS (CUST-PROCESS-CTR) = CUST-ADDRESS
IF NTF-ON-REC
    SCREEN-MSG = 'CUSTOMER NOT FOUND'
ELSE-IF END-ON-REC
    SCREEN-MSG = 'END OF CUSTOMER RECORDS'
IDMS DB

Process CUST-RECORD; execute logic upon each successful read.

DB-PROCESS REC CUST-RECORD
... WHERE CUST-KEY >= SCREEN-KEY
... SET CUST-ORDR
... DB-PROCESS-ID CUST
        IF  CUST-PROCESS-CTR > SCREEN-MAX
            TRUE CUST-END-PROCESS
        ELSE
            SCREEN-CUST    (CUST-PROCESS-CTR) = CUST-NAME
            SCREEN-PHONE   (CUST-PROCESS-CTR) = CUST-PHONE
            SCREEN-ADDRESS (CUST-PROCESS-CTR) = CUST-ADDRESS
IF NTF-ON-REC
    SCREEN-MSG = 'CUSTOMER NOT FOUND'
ELSE-IF END-ON-REC
    SCREEN-MSG = 'END OF CUSTOMER RECORDS'
SQL

Declare, name, and open a cursor; retrieve all rows and columns; process only one row from duplicate rows; close the cursor; move data into an alternate area.

DB-PROCESS REC D2TAB-REC
... DB-PROCESS-ID D2MAST-ID
... DISTINCT
... INTO WS-D2MAST-RECORD

Select specific columns from selected rows; name alternate host-variables for specific columns; sort columns by position in selection list.

DB-PROCESS REC D2TAB-REC
... DB-PROCESS-ID D2MAST-ID
... PM_PART_NO (WS-PART-NO)
... PM_NEW_PART_NO (WS-NEW-PART-NO) PM_UNITS
... ORDER 1 ASC 3 DESC

Nest one DB-PROCESS within another.

DB-PROCESS REC A.D2TAB-REC
... DB-PROCESS-ID D2MAST-ID
... DISTINCT
... PM_PART_NO PM_UNITS PM_PART_SHORT_DESC
    IF D2MAST-ID-PROCESS-CTR >5
        TRUE D2MAST-ID-END-PROCESS
    ELSE
        /* Custom logic to process SAVEKEY
        IF NOT TRUE D2MAST-ID-END-PROCESS
            DB-PROCESS REC D2INV-REC
            ... DB-PROCESS-ID D2INV-ID
            ... WHERE INPM_PART_NO = :WS-SAVE-PART-NO
                /* Custom record processing logic

DB-ROLLBACK

Category:

Database call (see Database Calls)

Compatibility:

SQL target

Description:

Perform SQL ROLLBACK functions.

Syntax:
DB-ROLLBACK

DB-STORE

Category:

Database call (see Database Calls)

Description:

Write a record to a file or database.

Under IMS, DB-STORE lets you:

Under SQL, DB-STORE lets you add entire rows or selected columns.

Syntax:
IDMS DB
DB-STORE REC recordname
IMS DB
DB-STORE [REC|REF recordname1] [FROM dataarea]
... [VIEW pcbname|PCB pcbname]
... [WHERE fieldname operator value]
... [REC|REF recordname2] [FROM dataarea]
... [VIEW pcbname|PCB pcbname]
... [WHERE fieldname operator value]
... [SUB number] [OF dataarea]
        .
        .
        .
... REC recordnameN [FROM dataarea]
... [VIEW pcbname|PCB pcbname]
... [WHERE fieldname operator value]
... [SUB number] [OF dataarea]
OS4
DB-STORE REC recordname
... [FORMAT formatname]
... [FROM dataarea]
SQL

Format 1:

DB-STORE REC copylibname-REC
... [column1 [(altvalue)] [... columnN [(altvalue)]]]
... [FROM dataname]

Format 2:

DB-STORE REC copylibname-REC
... [column1 [(altvalue)] [... columnN [(altvalue)]]]
... [DB-OBTAIN REC copylibname-REC
... column1 [... columnN]
... WHERE column1 operator [:]altvalue
... [AND|OR column2 operator [:]altvalue]]
        .
        .
... [AND|OR columnN operator [:]altvalue] ]
VSAM Batch
DB-STORE REC recordname [FROM dataarea]
VSAM Online
DB-STORE REC recordname [FROM dataarea]
... [SYSID systemname] [DDN ddname]
Parameters:

[:](altvalue)

Alternate value; can be a literal, column name, or host-variable, as follows.

  • A host-variable is any COBOL data item referenced in your APS/SQL code; can a be data item generated automatically by APS/SQL to match a DB2 column name.

  • An alternate host-variable is one you instruct APS/SQL to use instead of the automatically generated one for a column.

  • If you name alternate host-variables for specific columns, do not code FROM, which names an entire alternate host structure.

  • Precede host-variables and alternate host-variables with a colon. APS generates a # symbol for the colon.

AND col op [:]altval

Value can be a literal or data name. See also the altvalue parameter above.

CKEYED

Position to correct parent segments.

DDN ddname

Specify file ddname; can be a literal or data name defined as PIC X(8). Supply a value to the name option of CICS DATASET.

FROM dataarea

Alternate I/O area where program deletes, modifies, or adds a record. Required for a record obtained from an I/O area other than the default I/O area, such as by DB-OBTAIN INTO. See also "Comments" below.

FROM dataname

Move alternate data structure to the host variable structure name. Data moves prior to the actual SQL call via MOVE statement.

Preferred format is to code FROM before WHERE, otherwise you must separate the WHERE and FROM with ENDWHERE. See also "Comments" below.

IMSREC segmentname

Specify that the segment name (maximum 8 characters) is in a Working-Storage variable for the program to read, modify, add, or delete;.

OF dataarea

Qualify the I/O area moving to the value field, when more than one structure in the Data Division contains the field. Optionally code IN instead of OF.

OR col op [:]altval

Value can be a literal or data name. See also the altvalue parameter above.

PCB pcbname

Synonymous with VIEW. Specify the PCB used when the PSB contains multiple PCBs for the same database. See also "Comments" below.

REC copylib-REC

Specify the 01-level name of the COBOL row layout in the DCLGEN or copybook information. Cannot be the same as any cursor names or DB-PROCESS-ID names.

REC recordname

COBOL record or IMS segment to process.

REF recordname

Specify a COBOL record to reference. Under IMS, the program uses the referenced segment for navigating the database.

SUB[SCRIPT](value)

Move the subscripted field value to a specified field. Value can be a data name, literal, or, under VSAM Batch or Online, an integer.

SYSID systemname

Remote system name (maximum 4 characters); can be a literal region name or a Working-Storage field.

VIEW pcbname

Synonymous with PCB. Specify the PCB used when the PSB contains multiple PCBs for the same database. See also "Comments" below.

WHERE col op [:]altval

Column is the column on which to qualify the selection. Operator can be: =, ^=, >, <, >=, <=, native SQL predicates (such as LIKE and BETWEEN). See also the altvalue parameter above.

WHERE fld|key oper value

Code only with REF parameter.

Under VSAM Batch or Online, operator can be: =, EQ, >=, GTEQ; otherwise operator can be: =, EQ, >, GT, <, LT, >=, GE, <=, LE, <>, NE, ^=.

Value can be literal, data name, or an asterisk (*). An asterisk indicates the segment record description contains the key value.

Comments:
IDMS DB

Initialize all CALC keys; make all sets, in which the object record participates as a mandatory member, current of record type. If the location mode of the object record is VIA, establish currency for the set in which the record participates as a member.

IMS DB

Examples:
IDMS DB

Write record type ORDER from Working-Storage.

DB-STORE REC ORDER
IMS DB

Add an occurrence of RECORD-A to the database.

DB-STORE REC RECORD-A

Add one occurrence of RECORD-A and one of its dependents, RECORD-B.

DB-STORE REC RECORD-A REC RECORD-B

Add one occurrence of RECORD-B, a dependent of a specific RECORD-A.

DB-STORE REF RECORD-A WHERE FIELD-1 = VALUE-1 REC RECORD-B

Alternately, add RECORD-B by coding DB-STORE after DB-OBTAIN.

DB-OBTAIN REF RECORD-A WHERE KEY-A = VALUE-A 
DB-STORE RECORD-B
SQL

Insert specific columns into D2MASTER; for PM_PART_NO, store information from the default COBOL host variable; for other columns, name alternate sources of information.

DB-STORE REC D2TAB-REC
... PM_PART_NO PM_NEW_PART_NO ('23432')
... PM_COLOR (:WS-NEW-COLOR)

Insert columns IN_PART_NO and IN_UNIT_BASE_PRICE from D2MASTER into table D2INVEN; select only rows from D2MASTER where PM_PART_NO does not equal PM_NEW_PART_NO.

 DB-STORE REC D2INVEN-REC IN_PART_NO IN_UNIT_BASE_PRICE
 ... DB_OBTAIN REC D2MASTER-REC PM_PART_NO PM_UNIT_BASE_PRICE
 ... WHERE PM_PART_NO not= PM_NEW_PART_NO
VSAM Batch and VSAM Online

Write ORDR-RECORD to the file; check file status.

DB-STORE REC ORDR-RECORD
IF OK-ON-REC
    SCREEN-MSG = 'ORDER ADDED TO FILE'
ELSE-IF IVD-ON-REC
    SCREEN-MSG = 'ORDER ALREADY EXISTS'

DB-SUBSCHEMA

Category:

Database call (see Database Calls)

Compatibility:

IDMS DB, IMS DB, SQL, VSAM batch, and VSAM online targets

Description:

Include the imported program subschema in your program. APS automatically does this for you when you specify your subschema in the Application Painter after importing the subschema.

Syntax:
DB-SUBSCHEMA subschemaname
Comment:

Specify a subschema for an APS program in either of the following ways.


DDIFILE Report (DB01)

Category:

APS-generated report (see Database Calls)

Description:

The DDIFILE Report describes the contents of the DDIFILE that contains your imported database definitions. Use this report to understand and evaluate the results of an import.

The report provides a section for each of the following items.

Comment:

Produce the DDIFILE Report from the Documentation Facility.

Example:
REPORT CODE: DB01         APS DATA DESCRIPTION INTERFACE                           PAGE     1
                                   DBD REPORT                                 92/01/21  09:53

NAME                CREATED     UPDATED       REC NO       MESSAGE
---------------------------------------------------------------------------------------------

BE3ORDER            88/08/19    88/08/19      20           INCOMPLETE SET OF DDI NAMES FOUND
BE3ORDRX            88/08/19    88/08/19       3           NO DDI NAMES SPECIFIED
CORDPSB             89/10/12    00/00/00       3
CPTORDLD            89/11/02    00/00/00       3

 
REPORT CODE: DB01         APS DATA DESCRIPTION INTERFACE                           PAGE     4
                                FILE REPORT                                   92/01/21  09:53

NAME                CREATED     UPDATED       REC NO       MESSAGE
---------------------------------------------------------------------------------------------

CUSTMAST-REC        90/08/13    90/08/15      5
CUSTORDR-REC        90/08/13    90/08/15      5
 
 
REPORT CODE: DB01         APS DATA DESCRIPTION INTERFACE                           PAGE     5
                                SUBSCHEMA REPORT                              92/01/21  09:53

NAME                CREATED     UPDATED       REC NO       MESSAGE
---------------------------------------------------------------------------------------------

DMVINQ              90/05/10    90/12/07      1
DMVLST              90/05/10    90/12/07      3
 
 
***********   FINAL TOTALS   ***********
           TOTAL NUMBER OF DBDS              18
           TOTAL NUMBER OF DBD RECS         530
           TOTAL NUMBER OF PSBS              45
           TOTAL NUMBER OF PSB RECS          93
           TOTAL NUMBER OF FILES              8
           TOTAL NUMBER OF FILE RECS         30
           TOTAL NUMBER OF SUBSCHS           10
           TOTAL NUMBER OF SUBSCH RECS       21
           TOTAL NUMBER OF ENTITIES          63
           TOTAL NUMBER OF RECORDS          623

DDI Statements

Compatibility:

IMS and VSAM targets

Category:

Importer feature

Description:

Identify IMS database segments and VSAM files and their corresponding COBOL Syntax

DDI statements are comprised of the literal *DDI followed by a statement type and its applicable parameter parameters. The statement type identifies what database or file component to import. For example, database, record or field. Code DDI statements for any environment as follows:

Column
Value

7-10

*DDI

11

Blank

12-14

Statement type

15

Blank

16-18

Keyword parameter

IMS DB

The DBD statement corresponds to the DBD statement:

*DDI DBD NAME=dbname

The REC statement corresponds to the SEGM statement/copylib:

*DDI REC NAME=cpylibrec|[new-COBOL-recordname],
*DDI     SEG=segname, [COPY=membername|[new-copylibname]],
*DDI     [GEN01=Y|N]

The FLD statement corresponds to the FIELD and XDFLD statement/copylib field:

*DDI FLD NAME=cpylibfldname, IMSNAME=fldname,
*DDI     [PIC=cpylibpic]

The PSB statement corresponds to the PSB name:

*DDI PSB NAME=PSBname

The PCB statement is a positional, or placeholder statement. It corresponds to the PCB for which you are assigning an additional set of names:

*DDI PCB
VSAM DB

The VSM statement corresponds to the VSAM file external ddname:

*DDI VSM DDN=extddname, TYPE=K|E|R, VSPREFIX=fileprefix,
         [CYL|TRK|REC(size)], CISZ(cntlintrvalsize),
         VOL(volname), CAT=catname, [idcamsparms]

The REC statement corresponds to the copylib record name and copylib file name:

*DDI REC NAME=recname, SHORT=shrtrecname, COPY=membername,
         SOURCE=P|C|, MAXLEN=maxreclen, AVGLEN=avgreclen

The IDX statement is for a keyed file. It corresponds to copylib key field name and copylib file name:

*DDI IDX NAME=cpylibreckeyfldname, [ALIAS=redefinefld],
         TYPE=P|U|D, KEYLEN=keyfldlen, OFFSET=position,
         DDN=indxddname, PIC=number,[idcamsparms]

The SUB statement identifies the copylib record name(s) used by your APS program, record processing, batch options, and VSAM file external ddname:

*DDI SUB NAME=subschemaname, RECORD=recname,
         PROCOPT=A|G|I|D|R, [ACCESS=options], [BLOCK=0],
         [LABEL=STANDARD], [ASSIGN=extddname]
Parameters:

ACCESS=options

Batch access options. Dynamic for KSDS files. Sequential for ESDS/RRDS files.

ALIAS=redefinefld

If a VSAM file uses multiple copylib records, this value is the field name that redfines NAME=cpylibreckeyfldname. Maximum 30 characters.

ASSIGN=extddname

VSAM file external ddname. Default is the value of the *DDI VSM statement DDN parameter. Maximum 8 characters.

AVGLEN=avgreclen

Average record length. Default is the value of MAXLEN.

CAT=catname

Catalog name.

CISZ(cntlintrvalsize)

Control interval size. Default is CISZ(4096).

COPY=membername

Copylib member name. Default for IMS is SEGM NAME=. Maximum 8 characters.

CYL|TRK|REC(size)

Size of file in cylinders, tracks or records.

DDN=extddname

VSAM file external ddname. Maximum 8 characters.

DDN=indxddname

DDNAME of the index. Default is primary=ddname. Maximum 24 characters.

GEN01=Y|N

GEN01=Y Indicates segname is an 01 level name.

GEN01=N Overrides the value of &GEN-DB-REC-01-NAMES flag.

idcamskeywrds

Other IDCAMS keywords. Code exactly as they appear on IDCAMS control statements.

IMSNAME=fieldname

DBD value of FIELD NAME= or XDFLD NAME=. Maximum 8 characters.

IMSNAME=new-COBOL fldname

New copylib name for the new COBOL record .

KEYLEN=keyfldlen

Length of key field. Maximum 4 characters.

MAXLEN=maxreclen

Maximum record length.

NAME=copylibfldname

Copylib field name. Default is DBD value of FIELD NAME= or XDFLD NAME=. Maximum 30 characters.

NAME=cpylibrec

Copylib record name. Default is DBD value of SEGM NAME=. Maximum 30 characters.

NAME=cpylibreckey fldname

VSAM file copylib record key field name. Maximum 30 characters.

NAME=dbname

DBD name. Maximum 8 characters.

NAME=new-COBOL-fldname

New COBOL record name of the segment.

NAME=new-COBOL-recname

New COBOL record name of the segment.

NAME=PSBname

Specifies the program PSB name.

NAME=recname

VSAM file record name. Maximum 30 characters.

NAME=subschemaname

A unique subschema name. Maximum 8 characters.

OFFSET=position

The offset position of the field relative to the beginning of the record (first position is 0). Maximum characters.

PIC=cpylibpic

COBOL picture clause. Default is x(n). n=the value of the BYTES parameter in the DBD. Maximum 24 characters.

PIC=keypicture

Picture of keyed field. Required for non-alphanumeric. Maximum 24 characters.

PROCOPT=A|G|I|D|R

Process control options. Values are: A(ll); G(et); I(nsert); D(elete); R(eplace).

RECORD=recname

Value of the first or only DDI REC statement NAME=recname. Maximum 30 characters.

SEG=segname

DBD value of SEGM NAME=. If you supplement or override this statement segname is as it appears in the program PSB. Maximum 8 characters.

SHORT=shrtrecname

Short record name. Maximum 8 characters.

SOURCE=P|C

Method used to put copylib members in program. Values are: P (via an APS %INCLUDE statement). C(via COBOL COPY command).

TYPE=K|E|R

VSAM file type. Values are: K(eyed); E(ntry); R(elative). Default is K.

TYPE=P|U|D

Index type. Values are P(rimary); U(nique); D(uplicate). The first index must be primary.

VOL(name)

Volume name.

VSPREFIX=fileprefix

VSAM file prefix.

Comments:
IMS DB/DC

Examples:
IMS DB

DBD and copylib DDI statements.

DBD    NAME=DBD1 etc.
SEGM   NAME=S1 etc.
FIELD  NAME=S1FLD etc.
SEGM   NAME=S2 etc.
FIELD  NAME=S2FLD etc.
 
Copylib file (S1)
01  SALES-REC.
    05  REGION-FLD          PIC 9(03).
   .
   .
Copylib file (S2)
01  CUST-REC.
    05  LOCATION-FLD        PIC X(30).
   .
   .

DDI statements applicable to the above DBD statements and copylib.

KYWD 12-+----20---+----30---+----40---+----50---+-
*DDI DBD NAME=DBD1
*DDI REC NAME=SALES-REC,SEG=S1,COPY=S1,
*DDI     GEN01=Y
*DDI FLD NAME=REGION-FLD,IMSNAME=S1FLD,PIC=9(03)
*DDI REC NAME=CUST-REC,SEG=S2,COPY=S2,
*DDI     GEN01=Y
*DDI FLD NAME=LOCATION-FLD,IMSNAME=S2FLD,PIC=X(30)

Fast path DBDs and PSBs.

DBD     NAME=DEDBASE,ACCESS=DEDB,RMNAME=DEDBRAND
AREA    DEVICE=3380,SIZE=1024,UOW=(20,5),ROOT=(40,10),DD1=AREA1
AREA    DEVICE=3380,SIZE=1024,UOW=(20,5),ROOT=(40,10),DD1=AREA2
AREA    DEVICE=3380,SIZE=1024,UOW=(20,5),ROOT=(40,10),DD1=AREA3
SEGM    NAME=CUST,PARENT=0,BYTES=(80,80)
FIELD   START=03,BYTES=06,TYPE=C,NAME=(ACCTNO,SEQ,U)
FIELD   START=09,BYTES=09,TYPE=C,NAME=SSA
FIELD   START=18,BYTES=30,TYPE=C,NAME=NAME
FIELD   START=48,BYTES=30,TYPE=C,NAME=ADDRESS
SEGM    NAME=SUMM,PARENT=CUST,BYTES=(30,30),TYPE=SEQ
FIELD   START=03,BYTES=10,TYPE=C,NAME=ACTION
FIELD   START=13,BYTES=08,TYPE=C,NAME=AMOUNT
FIELD   START=21,BYTES=10,TYPE=C,NAME=TELLER
SEGM    NAME=TRAN,PARENT=CUST,BYTES=(50,50),TYPE=DIR,      X
        SSPTR=8
FIELD   START=03,BYTES=06,TYPE=C,NAME=(TRANDATE,SEQ)
FIELD   START=09,BYTES=06,TYPE=C,NAME=TRANAMT
FIELD   START=15,BYTES=15,TYPE=C,NAME=TYPE
FIELD   START=30,BYTES=08,TYPE=C,NAME=BALANCE
SEGM    NAME=CHARGE,PARENT=TRAN,BYTES=(30,30),TYPE=DIR,SSPTR=5
FIELD   START=03,BYTES=06,TYPE=C,NAME=DATE
FIELD   START=09,BYTES=06,TYPE=C,NAME=SERVCHAR
FIELD   START=15,BYTES=10,TYPE=C,NAME=TYPECHAR
DBDGEN
FINISH
END

DDI statements:

*DDI DBD NAME=DEDBASE
*DDI REC NAME=CUSTOMER-RECORD,SEG=CUST,COPY=CUST
*DDI FLD NAME=CUSTOMER-ACCT-NO,IMSNAME=ACCTNO
*DDI FLD NAME=CUSTOMER-SSA,IMSNAME=SSA
*DDI FLD NAME=CUSTOMER-ADDRESS,IMSNAME=ADDRESS
*DDI REC NAME=SUMMARY-RECORD,SEG=SUMM,COPY=SUMM
*DDI FLD NAME=SUMMARY-ACTION,IMSNAME=ACTION
*DDI FLD NAME=SUMMARY-AMOUNT,IMSNAME=AMOUNT
*DDI FLD NAME=SUMMARY-TELLER,IMSNAME=TELLER
*DDI REC NAME=TRANSACTION-RECORD,SEG=TRAN,COPY=TRAN
*DDI FLD NAME=TRANSACTION-TRANDATE,IMSNAME=TRANDATE
*DDI FLD NAME=TRANSACTION-AMOUNT,IMSNAME=TRANAMT
*DDI FLD NAME=TRANSACTION-TYPE,IMSNAME=TYPE
*DDI FLD NAME=TRANSACTION-BALANCE,IMSNAME=BALANCE
*DDI REC NAME=CHARGE-RECORD,SEG=CHARGE,COPY=CHARGE
*DDI FLD NAME=CHARGE-DATE,IMSNAME=DATE
*DDI FLD NAME=CHARGE-SERVCHAR,IMSNAME=SERVCHAR
*DDI FLD NAME=CHARGE-TYPECHAR,IMSNAME=TYPECHAR
 
DBD     NAME=DEDB1,ACCESS=DEDB,
        RMNAME=(DBFHD040)
AREA    DD1=DEDB1DD,DEVICE=3380,SIZE=1024,
        ROOT=(10,5),UOW=(15,10)
SEGM    NAME=A,BYTES=(48,27),PARENT=0
FIELD   NAME=(A1,SEQ,U),BYTES=10,START=3,TYPE=C
SEGM    NAME=B,BYTES=(24,11),PARENT=((A,SNGL)),TYPE=DIR,SSPTR=5
FIELD   NAME=(B1,SEQ,U),BYTES=5,START=3,TYPE=C
FIELD   NAME=B2,BYTES=5,START=10,TYPE=C
SEGM    NAME=C,BYTES=(34,32),PARENT=((B,DBLE)),RULES=(,HERE),
        TYPE=DIR
FIELD   NAME=(C1,SEQ,U),BYTES=20,START=3,TYPE=C
SEGM    NAME=D,BYTES=(52,33),PARENT=((A,DBLE)),TYPE=DIR,SSPTR=3
FIELD   NAME=(D1,SEQ,U),BYTES=2,START=3,TYPE=C
SEGM    NAME=E,BYTES=(52,33),PARENT=((A,DBLE)),RULES=(,FIRST),
        TYPE=DIR
FIELD   NAME=(E1,SEQ,U),BYTES=2,START=3,TYPE=C
DBDGEN
FINISH
END
 
DDI *DDI DBD NAME=DEDB1
 
DBD     NAME=MSDB1,ACCESS=MSDB
DATASET REL=NO
SEGM    NAME=A,BYTES=4
FIELD   NAME=(A1,SEQ,U),BYTES=1,START=1,TYPE=X
DBDGEN
FINISH
END
 
*DDI DBD NAME=MSDB1
 
PSB
PCB   TYPE=DB,DBDNAME=DEDB1,PROCOPT=A,KEYLEN=35
SENSEG NAME=A,PARENT=0
SENSEG NAME=B,PARENT=A,SSPTR=((1,R),(2,U),(5))
SENSEG NAME=C,PARENT=B
PCB    TYPE=DB,DBDNAME=DEDBASE,PROCOPT=A,KEYLEN=12
SENSEG NAME=CUST,PARENT=0
SENSEG NAME=SUMM,PARENT=CUST
SENSEG NAME=TRAN,PARENT=CUST
PCB    TYPE=DB,DBDNAME=MSDB1,PROCOPT=A,KEYLEN=1
SENSEG NAME=A,PARENT=0
PSBGEN PSBNAME=FASTPATH,LANG=COBOL
END

DDI for fixed length KSDS file.

KYWD 12-+----20---+----30---+----40---+----50---+---
*DDI VSM DDN=EMPLOYEE
*DDI       TYPE=K,VSPREFIX=VQAC6550.APS17X,
*DDI       TRK(100 10),CISZ(8192),VOL(SAGE03),
*DDI       REPLICATE,FSPC(15 15),SHR(1 3),NOIMBED
*DDI REC NAME=EMPLOYEE-RECORD,SHORT=EMPL,
*DDI       COPY=EMPLOYEE,SOURCE=P,
*DDI       MAXLEN=56
*DDI IDX NAME=EMPL-EMP-NUM,TYPE=P,KEYLEN=6,OFFSET=0,
*DDI       DDN=EMPLOYEE,TRK(5 5),VOL(SAGE03)
*DDI IDX NAME=EMPL-SOURCE-CODE,TYPE=D,
*DDI       KEYLEN=6,OFFSET=30,DDN=EMPLOYE1,
*DDI       TRK(3 3),VOL(SAGE03),NOIMBED
*DDI IDX NAME=EMPL-SALARY,TYPE=D,
*DDI       KEYLEN=4,OFFSET=36,DDN=EMPLOYEZ,
*DDI       PIC=9(7)COMP-3,TRK(3 3),VOL(SAGE03)
*DDI SUB NAME=SAMPPGM,RECORD=EMPLOYEE-RECORD,PROCOPT=A,
*DDI       LABEL=STANDARD,BLOCK=200,ASSIGN=EMPLOYEE

Copylib for a variable length keyed sequential file with one index accessing multiple records.

% * CICS RECORDS ARE REDEFINED FOR WORKING-STORAGE.
% * MVS  RECORDS ARE NOT REDEFINED;  ARE PLACED DIRECTLY UNDER FD.
% IF &APS-MDC = "CICS-TP"
    &VSSUF = "  REDEFINES ORDER-RECORD"
% ELSE
    &VSSUF = ""
01  ORDER-RECORD.
    05  ORDER-KEY                   PIC X(05).
    05  ORDER-RECORD-TYPE           PIC X(01).
    05  ORDER-CUST-NUMBER           PIC X(07).
    05  ORDER-PART-NUMBER           PIC X(07).
    05  ORDER-QUANTITY-ORDERED      PIC 9(05).
    05  ORDER-QUANTITY-TYPE         PIC X(10).
    05  ORDER-ORDER-AMOUNT          PIC 9(05)V99.
    05  ORDER-ORDER-STATUS          PIC X(04).
01  ORDER-PART-RECORD &VSSUF.
    05  FILLER                      PIC X(06).
    05  PART-NAME                   PIC X(05).
    05  PART-DESCRIPTION            PIC X(25).
    05  PART-SUPPLIER-NBR           PIC X(07).
    05  PART-SUPPLIER-NAME          PIC X(25).
01  ORDER-DELV-RECORD &VSSUF.
    05  FILLER                      PIC X(06).
    05  DELV-CONTACT-NAME           PIC X(30).
    05  DELV-CONTACT-PHONE          PIC X(12).
    05  DELV-ADDRESS                PIC X(35).
    05  DELV-SPECIAL-INSTRUCTIONS   PIC X(50).

DDI for variable length KSDS files.

KYWD 12-+----20---+----30---+----40---+----50---+---
*DDI VSM DDN=ORDER
*DDI REC NAME=ORDER-RECORD,SHORT=ORDER,COPY=ORDER,SOURCE=P,
*DDI     MAXLEN=133,AVGLEN=46
*DDI IDX NAME=ORDER-KEY,TYPE=P,KEYLEN=5,OFFSET=0,DDN=ORDER
*DDI REC NAME=ORDER-PART-RECORD,SHORT=PART,MAXLEN=68
*DDI REC NAME=ORDER-DELV-RECORD,SHORT=DELV,MAXLEN=133
*DDI SUB NAME=ORDERSS,
*DDI     RECORD=ORDER-RECORD,PROCOPT=A,
*DDI     LABEL=STANDARD,BLOCK=0,ASSIGN=ORDER

DDI statements for generating DDISYMB and IDCAMS.

*DDI VSM DDN=PERSON
*DDI     TYPE=K,VSPREFIX=VAPS6550,
*DDI     CISZ(4096),VOL(PDVL02),TRK(5 5)
*DDI REC NAME=PERSONNEL-RECORD,SHORT=PERSONEL,
*DDI     COPY=PERSONEL,SOURCE=P,MAXLEN=80,PREFIX=PER
*DDI IDX NAME=SSA,ALIAS=SSA-X,TYPE=P,KEYLEN=9,
*DDI     OFFSET=0,DDN=PERSON,
*DDI     TRK(5,5),VOL(PDVL02)
*DDI IDX NAME=LAST-NAME,TYPE=D,KEYLEN=15,
*DDI     OFFSET=9,DDN=PERSON1,
*DDI     TRK(5,5),REUSE,VOL(PDVL02)
*DDI IDX NAME=TITLE,TYPE=D,KEYLEN=15,
*DDI     OFFSET=24,DDN=PERSON2,
*DDI     TRK(5,5),REUSE,VOL(PDVL02)
*DDI SUB NAME=SAMPLE,RECORD=PERSONNEL-RECORD,
*DDI     PROCOPT=A

Generated IDCAMS source.

                                                03590000
DELETE VAPS6550.PERSON.CLUSTER                  01550000
           CLUSTER                              01610000
           PURGE                                01620000
                                                01640000
IF LASTCC = 8                                   01650000
THEN                                            01660000
       SET LASTCC = 00                          01670000
                                                01680000
DEFINE CLUSTER                                  01690000
           (INDEXED                             01760000
           NAME (VAPS6550.PERSON.CLUSTER)       01820000
           UNIQUE)                              01980000
                                                01990000
           DATA                                 02000000
           (NAME (VAPS6550.PERSON.DATA)         02010000
           TRK(5,5)                             02030000
           VOL(PDVL02)                          02080000
           RECSZ (80 80)                        02130000
           CISZ (4096)                          02170000
           KEYS (9 0)                           02240000
           SHR (3 3))                           02320000
                                                02340000
           INDEX                                02350000
           (NAME (VAPS6550.PERSON.INDEX)        02360000
           TRK(5,5)                             02440000
           VOL(PDVL02)                          02460000
           CISZ (1024)                          02550000
           SHR (3 3)                            02660000
           )                                    02690000
                                                02710000
       IF LASTCC < 5                            02720000
       THEN                                     02730000
       REPRO                                    02740000
           INFILE (DD1)                         02750000
           ODS (VAPS6550.PERSON.CLUSTER)        02760000
                                                02770000
       DEF AIX                                  02890000
           (NAME (VAPS6550.PERSON1.AIX)         02990000
           RELATE (VAPS6550.PERSON.CLUSTER)     03000000
           REUSE                                03040000
           TRK(5,5)                             03110000
           VOL(PDVL02)                          03180000
           RECSZ (256 512)                      03220000
           CISZ (1024)                          03260000
           KEYS ( 15 9)                         03290000
           NONUNIQUEKEY                         03340000
           UPGRADE)                             03380000
           DATA                                 03390000
           (NAME(VAPS6550.PERSON1.DATA))        03400000
           INDEX                                03410000
           (NAME(VAPS6550.PERSON1.INDEX))       03420000
                                                03430000
IF LASTCC < 5                                   03440000
       THEN                                     03450000
       BLDINDEX                                 03460000
           IDS (VAPS6550.PERSON.CLUSTER)        03470000
           ODS (VAPS6550.PERSON1.AIX)           03480000
                                                03490000
       IF LASTCC < 5                            03500000
       THEN                                     03510000
       DEF PATH                                 03520000
           (NAME (VAPS6550.PERSON1.PATH)        03530000
           PENT (VAPS6550.PERSON1.AIX)          03540000
           UPDATE)                              03550000
       DEF AIX                                  02890000
           (NAME (VAPS6550.PERSON2.AIX)         02990000
           RELATE (VAPS6550.PERSON.CLUSTER)     03000000
           REUSE                                03040000
           TRK(5,5)                             03110000
           VOL(PDVL02)                          03180000
           RECSZ (256 512)                      03220000
           CISZ (1024)                          03260000
           KEYS ( 15 24)                        03290000
           NONUNIQUEKEY                         03340000
           UPGRADE)                             03380000
           DATA                                 03390000
           (NAME(VAPS6550.PERSON2.DATA))        03400000
           INDEX                                03410000
           (NAME(VAPS6550.PERSON2.INDEX))       03420000
                                                03430000
IF LASTCC < 5                                   03440000
       THEN                                     03450000
       BLDINDEX                                 03460000
           IDS (VAPS6550.PERSON.CLUSTER)        03470000
           ODS (VAPS6550.PERSON2.AIX)           03480000
                                                03490000
       IF LASTCC < 5                            03500000
       THEN                                     03510000
       DEF PATH                                 03520000
           (NAME (VAPS6550.PERSON2.PATH)        03530000
           PENT (VAPS6550.PERSON2.AIX)          03540000
           UPDATE)                              03550000

DDISYMB Flags

Compatibility:

SQL target

Description:

You can use special DDISYMB flags to suppress or modify DCLGEN copybook generation. After you generate your subschema and DDISYMB file, insert these override flags into the DDISYMB file.

Syntax:

Flag 1, suppress inclusion of the APS-generated DCLGEN copybook:

&D2-INCLUDED-COPYLIB-copybookname = "YES"|"NO"

Flag 2, specify user override of APS indicator structure generation:

&D2-INCLUDED-IV-copybookname = "YES"|"NO"

Flag 3, specify indicator variable prefix override, overriding the APS default prefix IND:

&D2-copybookname-IV-PREFIX = "prefixvalue"

Flag 4, specify indicator structure, group-level, override name:

&D2-copybookname-IV-01-NAME = "indicatorvariablename"

Flag 5, specify host structure, group-level override name:

&D2-copybookname-HOST-01-NAME = "01levelname"

Flag 6, generate a value for &D2-copybookname-HOST-01-NAME:

&D2-GLOBAL-DCLGEN-NAME = "YES"|"NO"

Flag 7, override use and generation of the default IND-cursorname structure:

&D2-USE-CURSOR-IND = "YES"|"NO"
Comments:

Examples:

Substitute the prefix TAB2-IV for the default prefix IND for all indicator variables in a table represented by copybookname and for the 01-level name.

% &D2-copybookname-IV-PREFIX = "TAB2-IV"

Substitute a different 01-level name in the indicator variable structure generated by APS.

% &D2-copybookname-IV-01-NAME = "USER-IND-VAR-NAME"

Sample source code:

% &D2-D2MASTER-HOST-01-NAME = "XYZ-D2MASTER-STRUCT"
****************************************************
*  COBOL DECLARATION FOR TABLE D2MASTER
*  01-LEVEL NAME POST-PROCESSED
****************************************************
01  XYZ-D2MASTER-STRUCT.
  10  PM-PART-NO                      PIC X(8).
  10  PM-NEW-PART-NO                  PIC X(8).
  10  PM-OLD-PART-NO                  PIC X(8).
  10  PM-PART-SHORT-DESC              PIC X(13).
  10  PM-UNITS                        PIC 9(5).
  10  PM-UNIT-BASE-PRICE              PIC 9(5).
  10  PM-DIMENSIONS                   PIC X(8).
  10  PM-COLOR                        PIC X(8).

Generated SQL code using &D2-D2MASTER-HOST-01-NAME

EXEC SQL SELECT ...
INTO XYZ-D2MASTER-STRUCT.PM-PART-NO,
XYZ-D2MASTER-STRUCT.PM-NEW-PART-NO,
        .
        .
        .
    XYZ-D2MASTER-STRUCT.PM-COLOR,
FROM ...
WHERE ...
END-EXEC

Generated SQL code without using &D2-D2MASTER-HOST-01-NAME

EXEC SQL SELECT ...
INTO D2TAB-REC.PM-PART-NO,
    D2TAB-REC.PM-NEW-PART-NO,
        .
        .
        .
    D2TAB-REC.PM-COLOR,
FROM ...
WHERE ...
END-EXEC

DECL

Category:

Program Painter and Specification Editor parameter

Compatibility:

ISPF Dialog and ISPF prototyping batch programs; CICS and IMS DC programs without screens

Description:

Create Declarative Section statements only--not sections or paragraphs.

See also DPAR and USE BEFORE REPORTING for creating Declarative Section statements, paragraphs, and sections.

Syntax:
-KYWD-  12-*----20---*----30---*----40---*----50---*----60
 DECL   declarativestatements
Comments:

Example:
-KYWD-  12-*----20---*----30---*----40---*----50---*----60
 DECL   declarative statement
        declarative statement

Generated APS source:

DECLARATIVES.
declarative statement
declarative statement
END DECLARATIVES

DLG-ISPEXEC

Category:

Data communication call (see Data Communication Calls)

Compatibility:

ISPF Dialog target

Description:

Invoke ISPF services that use CALL ISPEXEC format.

Syntax:
DLG-ISPEXEC commandproceduresyntax
Parameters:

commandproceduresyntax

Syntax for call executed in Command Procedure (CLIST) format.

Comment:

Data field DLG-ISPEXEC-RC contains the return code after the call execution.

Examples:

Use the CONTROL service to disable the user's split screen capability.

DLG-ISPEXEC CONTROL SPLIT DISABLE
IF  DLG-ISPEXEC-RC = 8
    /* SPLIT SCREEN ALREADY DISABLED
    TRUE  SPLIT-SCREEN-DISABLED
ELSE-IF DLG-ISPEXEC-RC = 0
    /* SPLIT SCREEN DISABLED
    TRUE  SPLIT-SCREEN-DISABLED

Define an application message library to search before the default message library.

DLG-ISPEXEC LIBDEF ISPMLIB DATASET ID('ABC.DEF.ISPMLIB')
IF  DLG-ISPEXEC-RC = 0
    /* OK
ELSE
    DISPLAY '??? LIBDEF ISPMLIB ERROR, RC = ' DLG-ISPEXEC-RC

Invoke a command procedure to allocate application files.

DLG-ISPEXEC SELECT CMD(%ALOCFILE ALLOC)
IF  DLG-ISPEXEC-RC = 0
    /* OK
ELSE
    DISPLAY '??? ALOCFILE ERROR, RC = ' DLG-ISPEXEC-RC

DLG-ISREDIT

Category:

Data communication call (see Data Communication Calls)

Compatibility:

ISPF Dialog target

Description:

Invoke ISREDIT services.

Syntax:
DLG-ISREDIT commandproceduresyntax
Parameter:

commandproceduresyntax

Syntax for call executed in Command Procedure (CLIST) format

Comment:

Data field DLG-ISREDIT-RC contains the return code after call execution.

Example:

Determine if the member is new or existing. DLG-VDEFINE links ISPF variable &LASTLINE to COBOL variable LASTLINE.

DLG-VDEFINE LASTLINE &APS-FULL
DLG-ISREDIT (LASTLINE) = LINENUM .ZLAST
IF  LASTLINE = 0
    /* NEW MEMBER
    TRUE  NEW-MEMBER

DLG-SETMSG

Category:

Data communication call (see Data Communication Calls)

Compatibility:

ISPF Dialog target

Description:

Display a message on the next panel; predefine message text and attributes.

Syntax:

Format 1, SETMSG definition:

DLG-SETMSG
... [SHORT 'shortmessagetext']
... [LONG 'longmessagetext']
... [ALARM 'YES'|'NO']
... [HELP 'helppanelname']

Format 2, SETMSG definition for execution by Format 3:

DLG-SETMSG erroridentifier
... [SHORT 'shortmessagetext']
... [LONG 'longmessagetext']
... [ALARM 'YES'|'NO']
... [HELP 'helppanelname']

Format 3, SETMSG execution

DLG-SETMSG [erroridentifier|messageID]
Parameters:

ALARM 'YES'|'NO'

Sound alarm when screen displays.

erroridentifier

Unique name referencing predefined message text and attributes.

HELP 'help
panelname'

Help panel that displays via PF1.

messageID

ISPF MSGID for SETMSG service.

LONG 'long
messagetext'

Display text in long message field when the end user presses PF1 for the first time. Messagetext must fit on the same line as LONG.

SHORT 'short
messagetext'

Display text in short message field. Messages longer than 24 characters can cause truncation errors. Messagetext must fit on the same line as SHORT.

Comments:

Examples:

Define a message for an invalid option condition. INVALID-OPT (error identifier) identifies the message information to display when DLG-SETMSG is invoked in the execution format.

DLG-SETMSG INVALID-OPT
... SHORT 'INVALID OPTION'
... LONG  'ENTER ONE OF THE LISTED OPTIONS'
... ALARM 'YES'

Then, display the invalid option message.

IF  SCRA-OPTION = 'value'
    /* VALID CONDITION
ELSE
    DLG-SETMSG INVALID-OPT

DLG-VCOPY

Category:

Data communication call (see Data Communication Calls)

Compatibility:

ISPF Dialog target

Description:

Copy data from a Dialog variable to a COBOL program variable and generate the Working-Storage entry for the COBOL variable, if the COBOL level is specified.

Syntax:
DLG-VCOPY [COBOLlevel] COBOLvariable
... [[FROM] dialogvariable]
... [PIC COBOLpicture]|LEN value
... [GENONLY]
Parameters:

COBOLlevel

COBOLvariable level number.

COBOLvariable

COBOL data name the call processes.

FROM dialog
variable

ISPF Dialog variable where data comes from; default is COBOLvariable, truncated to eight characters.

GENONLY

Define COBOLvariable data item in Working-Storage only.

LEN value

COBOLvariable length; can be numeric integer, COBOL variable, or arithmetic expression.

PIC COBOLpicture

COBOLvariable picture; default is alphanumeric.

Comments:

Examples:

Copy data from a system variable into a screen field. The call does not generate the COBOL variable because the COBOL level number is not coded.

DLG-VCOPY SCRA-ZUSER FROM ZUSER LEN 8

Copy data from a system variable into a Working-Storage variable. Coding the COBOL level number generates the COBOL variable.

DLG-VCOPY 01 WS-LONG-ERROR-MESSAGE PIC X(78) FROM ZERRLM

DLG-VDEFINE

Category:

Data communication call (see Data Communication Calls)

Compatibility:

ISPF Dialog target

Description:

Establish a link between a Dialog function pool variable and a COBOL program variable.

Syntax:
DLG-VDEFINE [COBOLlevel] COBOLvariable
... [[AS] dialogvariable]
... [PIC COBOLpicture]|LEN value
... [GENONLY]
Parameters:

AS dialog
variable

ISPF Dialog variable where data links from; default is COBOLvariable, truncated to eight characters.

COBOLlevel

COBOLvariable level number.

COBOLvariable

COBOL data name the call processes.

GENONLY

Define the COBOLvariable data item in Working-Storage only.

LEN value

COBOLvariable length; can be numeric integer, COBOL variable, or arithmetic expression.

PIC COBOLpicture

COBOLvariable picture; default is alphanumeric.

Comments:

Example:

Establish a link between function pool variable COMDATA and COBOL variable WS-COMM-DATA. Coding the COBOL level number generates the COBOL data name.

DLG-VDEFINE 01 WS-COMM-DATA PIC X(150) AS COMDATA

DLG-VDELETE

Category:

Data communication call (see Data Communication Calls)

Compatibility:

ISPF Dialog target

Description:

Remove the Dialog variables, previously defined by VDEFINE, from the function pool.

Syntax:
DLG-VDELETE dialogvariable|*
Parameters:

 

dialogvariable

Delete a specific ISPF Dialog variable.

* (asterisk)

Delete all variables.

Comments:

Example:

Remove the link between function pool variable COMDATA and COBOL variable WS-COMM-DATA.

DLG-VDEFINE 01 WS-COMM-DATA LEN(150)
... AS COMDATA
DLG-VDELETE COMDATA

DLG-VREPLACE

Category:

Data communication call (see Data Communication Calls)

Compatibility:

ISPF Dialog target

Description:

Move data from a COBOL program variable to an ISPF function pool variable.

Syntax:
DLG-VREPLACE [COBOLlevel] COBOLvariable
... [[INTO] dialogvariable]
... [PIC COBOLpicture]|LEN value
... [GENONLY]
Parameters:

COBOLlevel

COBOLvariable level number.

COBOLvariable

COBOL data name the call processes.

GENONLY

Define COBOLvariable data item in Working-Storage only.

INTO dialog
variable

ISPF function pool variable data replaces; default is COBOLvariable, truncated to eight characters.

LEN value

COBOLvariable length; can be numeric integer, COBOL variable, or arithmetic expression.

PIC COBOLpicture

COBOLvariable picture; default is alphanumeric.

Comments:

Example:

Move a new value to the function pool variable ZPF01 and invoke ISPF help services with PF01.

DLG-VREPLACE 01 WS-PF01-HELP PIC X(04) VALUE 'HELP' INTO ZPF01

DLG-VRESET

Category:

Data communication call (see Data Communication Calls)

Compatibility:

ISPF Dialog target

Description:

Reset all program function pool variables and delete the links between COBOL variables and Dialog variables within the function pool.

Syntax:
DLG-VRESET
Comment:

Data field DLG-VRESET-RC contains the return code after call execution.


DPAR

Category:

Program Painter and Specification Editor parameter (see Keywords)

Compatibility:

ISPF Dialog and ISPF prototyping programs; CICS and IMS DC batch programs and reports

Description:

Create a Declarative Section or section paragraph--not declarative statements.

See also DECL and USE BEFORE REPORTING for creating Declarative Section statements, paragraphs, and sections.

Syntax:
-KYWD-  12-*----20---*----30---*----40---*----50---*----60
 DPAR   sectionname SECTION
        USE declarativesentence
[DPAR   paragraphname
            paragraphstatements ]
Parameters:

 

sectionname

Specify Section paragraph.

USE declarative
sentence

APS supports the USE clause with the exception of USE AFTER DEBUGGING, which is not supported.

Comments:

Example:

Program Painter code:

-KYWD-   12-*----20---*----30---*----40---*----50---*----60---*----70-
 DPAR    DUMMY-FOOTER SECTION
         USE BEFORE REPORTING FOOTER-DUMMY
 DPAR    DUMMY-FOOTER-PARA
         MOVE TOTAL-DIFF TO TIME-TOTAL
         SUPPRESS PRINTING
 DPAR    TOTAL-FOOT-SECTION SECTION
         USE BEFORE REPORTING TOTAL-FOOT
         TOTAL-FOOT-PARA
         TIME-AVERAGE = TIME-TOTAL / AVERAGE-CNT
         CALL-PERCENTAGE = (HALF-HOUR-CALLS / AVERAGE-CNT)
         ... * 100
         MOVE HALF-HOUR-CALLS TO HOLD-CALLS
         ADD HOLD-CALLS TO HALF-HOUR-CNT
         MOVE ZERO TO HALF-HOUR-CALLS
 DPAR    CONTROL-FOOTING-FINAL SECTION
         USE BEFORE REPORTING CNTL-FT-GP
 DPAR    CONTROL-FOOTING-FINAL-PARA
         IF SYSIN-TRACKER NOT = 'CTSALL'
             SUPPRESS PRINTING
         ELSE
             FINAL-PERCENTAGE = (HALF-HOUR-CNT / FINAL-PROB-CNT * 100)

Generated code:

 DECLARATIVES.
 
 DUMMY-FOOTER SECTION.
     USE BEFORE REPORTING FOOTER-DUMMY
 DUMMY-FOOTER-PARA.
     MOVE TOTAL-DIFF TO TIME-TOTAL
     SUPPRESS PRINTING
 TOTAL-FOOT-SECTION SECTION.
     USE BEFORE REPORTING TOTAL-FOOT
     $TOTAL-FOOT-PARA
     TIME-AVERAGE = TIME-TOTAL / AVERAGE-CNT
     CALL-PERCENTAGE = (HALF-HOUR-CALLS / AVERAGE-CNT)
     ... * 100
     MOVE HALF-HOUR-CALLS TO HOLD-CALLS
     ADD HOLD-CALLS TO HALF-HOUR-CNT
     MOVE ZERO TO HALF-HOUR-CALLS
 CONTROL-FOOTING-FINAL SECTION.
     USE BEFORE REPORTING CNTL-FT-GP
 CONTROL-FOOTING-FINAL-PARA.
     IF SYSIN-TRACKER NOT = 'CTSALL'
         SUPPRESS PRINTING
     ELSE
         FINAL-PERCENTAGE = (HALF-HOUR-CNT / FINAL-PROB-CNT * 100)
 
 END DECLARATIVES

DS

Category:

Program Painter and Specification Editor parameter (see Keywords)

Description:

In your program, include a data structure created in the Data Structure Painter and in that format.

Syntax:
-KYWD-  12-*----20---*----30---*----40---*----50---*----60
 DS[nn]  datastructurename
Comments:

 


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