All targets
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.
The APS/IDMS calls include the following:
|
Bind all records and the run-unit. |
|
|
Close a record. |
|
|
Delete a record. |
|
|
Move data into Working-Storage. |
|
|
Read a record. |
|
|
Open a record. |
|
|
Update a record. |
|
|
Add a record. |
|
|
Obtain and loop records. |
|
|
Write a commit checkpoint. |
|
|
Connect a record to a set. |
|
|
Disconnect a record from set. |
|
|
Test a conditional. |
|
|
Specify the program execution mode. |
|
|
Return the database key from an indexed set. |
|
|
Write an abort checkpoint to an IDMS journal file. |
The APS/IMS DB calls include the following:
|
Delete a record. |
|
|
Update a record. |
|
|
Read a record. |
|
|
Read multiple records in a loop. |
|
|
Add a record. |
|
|
Build a Field Search Argument. |
|
|
Access Data Entry Data Bases. |
The APS/SQL DB calls include the following:
|
Close a cursor set. |
|
|
Perform the SQL COMMIT function. |
|
|
Declare a cursor set. |
|
|
Delete a row. |
|
|
Obtain a row from a cursor set. |
|
|
Update a row. |
|
|
Read a table. |
|
|
Open a cursor set. |
|
|
Read a table and loop on it. |
|
|
Perform the SQL ROLLBACK function. |
|
|
Add a record. |
The APS/VSAM online DB calls include the following:
|
Delete a record. |
|
|
Release file resources. |
|
|
Update a record. |
|
|
Read a file. |
|
|
Read a file and loop on it. |
|
|
Add a record. |
The APS/VSAM batch DB calls include the following:
|
Close a file. |
|
|
Delete a record. |
|
|
Update a record. |
|
|
Read a file. |
|
|
Open a file. |
|
|
Read a file and loop on it. |
|
|
Add a record. |
APS Logical View DB calls can consist of a call name, keywords, and arguments. Observe the following conventions when you code a DB call:
|
See... |
For more
information about... |
|---|---|
|
Using IDMS database calls in program logic |
|
|
Using IMS DB database calls in program logic |
|
|
Using VSAM Batch database calls in program logic |
|
|
Using VSAM Online database calls in program logic |
|
|
Using SQL database calls in program logic |
|
|
Controlling certain target-specific functions |
|
|
Entering comments in your program |
|
|
Avoiding use of APS reserved words |
|
|
Recognizing size limitations |
All targets
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.
The APS/CICS DC calls include the following:
|
Override default I/O screen field attributes at run time. |
|
|
Access CICS storage areas. |
|
|
Assign values defined outside the program to a data area in Working-Storage. |
|
|
Cancel a CIC-START or CIC-DELAY. |
|
|
Suspend a task. |
|
|
Delete all transient data in a transient data queue. |
|
|
Delete temporary data in a temporary storage queue and free all storage in the queue. |
|
|
Release storage acquired by a CIC-GETMAIN call. |
|
|
Obtain and initialize main storage. |
|
|
Load programs, tables, or maps from a resident system library to main storage. |
|
|
Read transient data from a transient data queue. |
|
|
Read a temporary storage queue in main or auxiliary storage. |
|
|
Delete from main storage any programs, tables, or maps loaded by CIC-LOAD. |
|
|
Schedule an IMS PSB. |
|
|
Clear the screen and unlock the keyboard before terminating a program. |
|
|
Establish addressability to a data area in the Linkage Section following an address change in its BLL cell. |
|
|
Start a task on a local or remote system. |
|
|
Terminate the currently scheduled IMS PSB. |
|
|
Write transient data to a predefined data queue. |
|
|
Write temporary records to a temporary storage queue. |
|
|
Move spaces to all screen fields. |
|
|
Reset screen field attributes to their original values. |
|
|
Transfer control to a subprogram and optionally send Commarea data. |
|
|
Simulate screen invocation. |
|
|
Enable the program to receive multiple screens. |
|
|
Send a screen to the monitor. |
|
|
Terminate the program. |
|
|
ABEND the program. |
|
|
Generate a Working-Storage record for data that the program can send to and receive from other programs. |
|
|
Handle addressability of Linkage Section records. |
|
|
Move LOW-VALUES to all fields of a specified screen. |
|
|
Perform a paragraph and optionally pass arguments. |
|
|
Transfer program control to another program at the same logical level, and send Commarea data. |
The APS/IMS DC calls include the following:
|
Override default I/O screen field attributes at run time. |
|
|
Move spaces to all screen fields. |
|
|
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. |
|
Transfer control to a subprogram and optionally send Commarea data. |
|
|
Transfer control to another program and optionally send screen data. |
|
|
Simulate screen invocation. |
|
|
Enable the program to receive multiple screens. |
|
|
Send a screen to the monitor. |
|
|
Terminate the program. |
|
|
ABEND the program. |
|
|
Generate a Working-Storage record for data that the program can send to and receive from other programs. |
|
|
Handle addressability of Linkage Section records. |
|
|
Move LOW-VALUES to all fields of a specified screen. |
|
|
Perform a paragraph and optionally pass arguments. |
The APS/ISPF Dialog DC calls include the following:
|
Override default I/O screen field attributes at run time. |
|
|
Move spaces to all screen fields. |
|
|
Reset screen field attributes to their original values. |
|
|
Invoke services through ISPEXEC calls. |
|
|
Invoke services through ISREDIT calls. |
|
|
Display a message on the next panel. |
|
|
Copy an ISPF Dialog variable value to a COBOL variable. |
|
|
Link an ISPF Dialog variable and a COBOL variable. |
|
|
Delete an ISPF Dialog variable from the function pool. |
|
|
Move a COBOL variable value to the function pool. |
|
|
Reset function pool variables. |
|
|
Transfer control to a subprogram and optionally send Commarea data. |
|
|
Simulate screen invocation. |
|
|
Enable the program to receive multiple screens. |
|
|
Send a screen to the monitor. |
|
|
Terminate the program. |
|
|
Generate a Working-Storage record for data that the program can send to and receive from other programs. |
|
|
Handle addressability of Linkage Section records. |
|
|
Move LOW-VALUES to all fields of a specified screen. |
|
|
Perform a paragraph and optionally pass arguments. |
|
|
Execute the LINK call. |
The APS/ISPF prototyping DC calls include the following:
|
Override default I/O screen field attributes at run time. |
|
|
Transfer control to a subprogram and optionally sends Commarea data. |
|
|
Transfer control to another program and optionally send screen data. |
|
|
See RESET-PFKEY |
Simulate screen invocation. |
|
Enable the program to receive multiple screens. |
|
|
Send a screen to the monitor. |
|
|
Terminate the program. |
|
|
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. |
|
Transfer program control to another program at the same logical level, and send Commarea data. |
APS Logical View DC calls can consist of a call name, keywords, and arguments. Observe the following conventions when you code a DC call:
|
See... |
For more
information about... |
|---|---|
|
Using CICS data communication calls in program logic |
|
|
Using IMS DC data communication calls in program logic |
|
|
Using ISPF Dialog data communication calls in program logic |
|
|
Entering comments in your program |
|
|
Controlling certain target-specific functions |
|
|
Avoiding use of APS reserved words |
|
|
Recognizing size limitations |
APS-generated report (see Application Reports)
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.
Produce the Data Structure Definition Report from the Report Generator, Painter Menu, or Application Painter.
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
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.
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. |
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. |
Code data structures in the Data Structure Painter format, which is a shorthand syntax.
A8 generates PIC A(8).
-------- Data Structure Painter ------- WORK1-FIELD1 X(13) ... V'13 CHARS LONG' WORK1-FIELD2 X(120) ... VALUE 'A LONG LITERAL MAY ... BE CONTINUED ON ONE OR ... MORE LINES'
9&variable+V5 generates PIC 9(&variable)V9(5).
For example:
N8V4 generates PIC 9(8) V9(4). N8 V4 generates PIC 9(8) VALUE 4.
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).Screen Painter feature (see Field Edits)
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.
To assign internal, input, or output edits to a date screen, follow these steps.
| 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 |
|
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. |
|
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:
M Can be 2, 3, or 9 characters, where:
D Can be 3 characters if you do not define Month, otherwise it must be 2 characters, where:
|
||||||||
|
|
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.
|
||||||||
|
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. |
Note: In a report mock-up, use PIC clauses instead of COBOL masks when formatting dates and times containing / $ or :. See Report Mock-Ups.
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 |
Database call (see Database Calls)
IDMS target
Bind all records copied into a program subschema via a COPY IDMS statement; bind the run unit.
Format 1:
DB-BIND REC [recordname]
Format 2:
DB-BIND RUN-UNIT ... SUBSCHEMA name|NODENAME name|DBNAME name
|
DBNAME name |
|
|
NODENAME name |
|
|
REC [recordname] |
Retrieve record. Recordname is optional because the record is previously located by a DB-OBTAIN REF. |
|
RUN-UNIT |
|
|
SUBSCHEMA name |
-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-RTNDatabase call (see Database Calls)
IDMS DB, SQL, and VSAM batch targets
Close IDMS files and subschema areas; close SQL cursor sets; close VSAM batch files.
DB-CLOSE ALL
Format 1:
DB-CLOSE FILE filename1 [ ... filenameN]
Format 2:
DB-CLOSE FILE ALL
DB-CLOSE CUR[SOR] cursorname
|
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 |
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.
DB-CLOSE is required.
Database call (see Database Calls)
SQL target
Perform database commit functions.
DB-COMMIT [HOLD]
|
HOLD |
Do not release resources; do not close open cursors; preserve prepared SQL statements; release locks on specific rows acquired during the transaction. |
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-STORE
DB-ERASE (except with WHERE or WHERE CURRENT)
DB-MODIFY (except with WHERE or WHERE CURRENT)
Database call (see Database Calls)
SQL target
Designate a set of rows as a logical group, that is, a cursor set. The call declares:
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]]]
|
[:](altvalue) |
Alternate value; can be a literal, column name, or host-variable, as follows.
|
|
AND col op col|[:]altval |
Value can be a literal or data name. See also the altvalue parameter above. |
|
copylibname-REC |
|
|
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. |
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
Database call (see Database Calls)
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:
DB-ERASE REC recordname [PERM|SELECT|ALL]
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]
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]
Format 1, key-qualified:
DB-ERASE REC recordname ... WHERE primarykeyname = value ... [SUB value] [OF dataarea]
Format 2, unqualified:
DB-ERASE REC recordname
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
|
[:](altvalue) |
Alternate value; can be a literal, column name, or host-variable, as follows.
|
|
ALL |
|
|
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
|
|
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. |
Record to be deleted must be current of run unit.
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
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
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'
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
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-RECORDDatabase call (see Database Calls)
SQL target
Sequentially retrieve rows from the cursor set defined by DB-DECLARE.
DB-FETCH CUR[SOR] cursorname ... [INTO dataname]
|
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 |
DB-FETCH CURSOR D2MAST-CURSOR ... INTO WS-D2MAST-RECORD
Database call (see Database Calls)
VSAM online target
Release file resources and:
DB-FREE REC recordname|ALL ... [VIEW keyname] ... [ENDBR] [UNLOCK] [REQID number] ... [SYSID systemname] [DDN ddname]
|
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 |
|
|
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 |
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
Database call (see Database Calls)
IDMS DB target
Move data from a previously located record (via a DB-OBTAIN REF) into Working-Storage.
DB-GET REC [recordname]
|
recordname |
Retrieve record. Recordname is optional because the record is previously located by a DB-OBTAIN REF. |
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
Database call (see Database Calls)
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.
DB-MODIFY REC recordname
DB-MODIFY ... REC|REF recordname1 [FROM dataarea] ... [VIEW pcbname|PCB pcbname] . . . ... REC|REF recordnameN [FROM dataarea] ... [VIEW pcbname|PCB pcbname]
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]
DB-MODIFY REC recordname [FROM dataarea]
DB-MODIFY REC recordname [FROM dataarea] ... [SYSID systemname] [DDN ddname]
|
[:](altvalue) |
Alternate value; can be a literal, column name, or host-variable, as follows.
|
|
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 |
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 |
|
|
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 |
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. |
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.
Before modifying a record, retrieve it with a DB-OBTAIN or DB-PROCESS call.
Rewrite record type ORDER, which is current of run unit, from Working-Storage.
DB-MODIFY REC ORDER
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
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
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
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-AREADatabase call (see Database Calls)
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:
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]
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]
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]
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]
|
[:](altvalue) |
Alternate value; can be a literal, column name, or host-variable, as follows.
|
|
AND col op xol|[:]altval |
Value can be a literal or data name. See also the altvalue parameter above. |
|
AREA areaname |
|
|
CKEYED dataname |
|
|
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 |
|
|
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 |
|
|
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 |
|
|
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 |
|
|
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 |
|
|
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 |
|
|
SEQUENCE = number |
|
|
SET setname |
|
|
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 |
|
|
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. |
Always follow a DB-OBTAIN HOLD with a DB-MODIFY or DB-ERASE.
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
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
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'
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
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-NAMEDatabase call (see Database Calls)
IDMS DB, SQL, and VSAM batch targets
Open a record, cursor set, or file.
DB-OPEN [ALL] [MODE usagemode] ... [AREA areaname]
DB-OPEN CUR[SOR] cursorname
Format 1:
DB-OPEN FILE filename [... filename] ... MODE option
Format 2:
DB-OPEN FILE ALL ... MODE option
|
ALL |
Specify all files and ready all areas defined in the subschema. |
|
AREA areaname |
|
|
CUR[SOR] cursorname |
Specify cursor. Cursorname must be previously named by DB-DECLARE or DB-PROCESS-ID. |
|
FILE filename |
|
|
MODE option |
|
|
MODE usagemode |
Usage mode--RETRIEVAL (default),PROTECTED RETRIEVAL, EXCLUSIVE RETRIEVAL, UPDATE, PROTECTED UPDATE, EXCLUSIVE UPDATE |
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.
DB-OPEN is required.
Open the DORDER file for write-only processing.
DB-OPEN FILE DORDER MODE EXTEND
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
Open cursor set D2MAST-CURSOR, previously defined in DB-DECLARE.
DB-OPEN CURSOR D2MAST-CURSOR
Open the AORDER and ASUPLIR files for I-O processing.
DB-OPEN FILE AORDER ASUPLIR MODE I-O
Database call (see Database Calls)
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:
DB-PROCESS [REF recordname] REC recordname ... [DB-PROCESS-ID name] [WHERE keyname operator value] ... [SET setname|AREA areaname] [RESET] [HOLD] [EXCLUSIVE] Controlled logic block
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
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
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
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
|
[:](altvalue) |
Alternate value; can be a literal, column name, or host-variable, as follows.
|
|
AND col op col|[:]altval |
Value can be a literal or data name. See also the altvalue parameter above. |
|
AREA areaname |
|
|
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 |
|
|
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 |
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 |
|
|
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 |
|
|
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 |
|
|
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. |
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
|
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
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
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
SYM1 % &prefix-LOOP-MAX = 200
|
Target |
Limit |
APS Counter |
|---|---|---|
|
IDMS |
100 |
&IDMS-LOOP-MAX |
|
IMS DB |
100 |
&VS-IMS-LOOP-MAX |
|
SQL |
100 |
&DB2-LOOP-MAX |
|
VSAM Batch |
999,999 |
&VS-MVS-LOOP-MAX |
|
VSAM Online |
100 |
&VS-CICS-LOOP-MAX |
Processing begins at a previously established position in the database or, if RESET coded, at the beginning of the database.
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'
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'
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 logicDatabase call (see Database Calls)
SQL target
Perform SQL ROLLBACK functions.
DB-ROLLBACK
Database call (see Database Calls)
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.
DB-STORE REC recordname
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]
DB-STORE REC recordname ... [FORMAT formatname] ... [FROM dataarea]
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] ]
DB-STORE REC recordname [FROM dataarea]
DB-STORE REC recordname [FROM dataarea] ... [SYSID systemname] [DDN ddname]
|
[:](altvalue) |
Alternate value; can be a literal, column name, or host-variable, as follows.
|
|
AND col op [:]altval |
Value can be a literal or data name. See also the altvalue parameter above. |
|
CKEYED |
|
|
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 |
|
|
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. |
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.
Write record type ORDER from Working-Storage.
DB-STORE REC ORDER
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
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
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'Database call (see Database Calls)
IDMS DB, IMS DB, SQL, VSAM batch, and VSAM online targets
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.
DB-SUBSCHEMA subschemaname
Specify a subschema for an APS program in either of the following ways.
APS-generated report (see Database Calls)
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.
Produce the DDIFILE Report from the Documentation Facility.
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 623IMS and VSAM targets
Importer feature
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 |
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
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]
|
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. |
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
01 EMPLOYEE-RECORD.
05 EMPL-EMP-NUM PIC X(06).
05 EMPL-LAST-NAME PIC X(20).
05 EMPL-FIRST-INIT PIC X(02).
05 EMPL-MIDDLE-INIT PIC X(02).
05 EMPL-SOURCE-CODE PIC X(06).
05 EMPL-SALARY PIC 9(7)COMP-3.
05 EMPL-SCHED-HOURS PIC 9(04).
05 EMPL-ACTIVE-FLAG PIC X(02).
05 EMPL-LAST-PROM-DATE PIC X(06).
05 EMPL-LAST-EXT-DATE PIC X(06).
05 EMPL-START-YR PIC X(02).
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) 03550000SQL target
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.
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"
01 IND-copybookname-REC
05 IND-colname1
05 IND-colname2
If you override the host indicator variable structure generated by APS, you still must conform to the format above. However, you can override the IND prefix with one of your own. You can specify one prefix for each host indicator variable structure. The prefix you create must be supplied to APS via the variable &D2-copybookname-IV-prefix.
Similarly, you may also override the 01-level name of the host indicator variable structure. If the 01-level name you choose is not in the APS format shown above, supply it to APS via the variable &D2-copybookname-IV-01-name. These two user flags are described below.
% &D2-TAB2-IV-PREFIX = "TAB2-IV"
Yields the following indicator variable structure.
01 TAB2-IV-TAB2-REC.
05 TAB2-IV-colname1
05 TAB2-IV-colname2
05 TAB2-IV-colname3
.
.
05 TAB2-IV-colnameN
% &D2-TAB2-IV-01-NAME = "TAB2-IND-VAR"
Yields the following indicator variable structure:
01 TAB2-IND-VAR.
05 IND-colname1
05 IND-colname2
05 IND-colname3
.
.
05 IND-colnameN
01 TABLE-REC.
05 COL1 PIC X(4).
05 COL2 PIC X(8).
01 IND-TABLE-REC.
05 IND-COL1 PIC S9(4) COMP.
01 IND-CURSOR1.
05 IND-COL1 PIC S9(4) COMP.
.
.
.
DB-FETCH CURSOR CURSOR1
IF OK-ON-REC
IF IND-COL1 OF IND-CURSOR1 = +0
MAP-COL1 = COL1 in TABLE-REC
Note: Using the host indicator variable structure can simplify your code because the one indicator variable structure can be used repeatedly. In nested processes, however, the host indicator variables are overwritten by each successive nesting level.
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-EXECProgram Painter and Specification Editor parameter
ISPF Dialog and ISPF prototyping batch programs; CICS and IMS DC programs without screens
Create Declarative Section statements only--not sections or paragraphs.
See also DPAR and USE BEFORE REPORTING for creating Declarative Section statements, paragraphs, and sections.
-KYWD- 12-*----20---*----30---*----40---*----50---*----60 DECL declarativestatements
-KYWD- 12-*----20---*----30---*----40---*----50---*----60
DECL declarative statement
declarative statement
Generated APS source:
DECLARATIVES. declarative statement declarative statement END DECLARATIVES
Data communication call (see Data Communication Calls)
ISPF Dialog target
Invoke ISPF services that use CALL ISPEXEC format.
DLG-ISPEXEC commandproceduresyntax
|
commandproceduresyntax |
Syntax for call executed in Command Procedure (CLIST) format. |
Data field DLG-ISPEXEC-RC contains the return code after the call execution.
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-RCData communication call (see Data Communication Calls)
ISPF Dialog target
Invoke ISREDIT services.
DLG-ISREDIT commandproceduresyntax
|
commandproceduresyntax |
Syntax for call executed in Command Procedure (CLIST) format |
Data field DLG-ISREDIT-RC contains the return code after call execution.
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-MEMBERData communication call (see Data Communication Calls)
ISPF Dialog target
Display a message on the next panel; predefine message text and attributes.
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]
|
ALARM 'YES'|'NO' |
|
|
erroridentifier |
Unique name referencing predefined message text and attributes. |
|
HELP 'help |
|
|
messageID |
ISPF MSGID for SETMSG service. |
|
LONG 'long |
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 |
Display text in short message field. Messages longer than 24 characters can cause truncation errors. Messagetext must fit on the same line as SHORT. |
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-OPTData communication call (see Data Communication Calls)
ISPF Dialog target
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.
DLG-VCOPY [COBOLlevel] COBOLvariable ... [[FROM] dialogvariable] ... [PIC COBOLpicture]|LEN value ... [GENONLY]
|
COBOLlevel |
COBOLvariable level number. |
|
COBOLvariable |
COBOL data name the call processes. |
|
FROM dialog |
ISPF Dialog variable where data comes from; default is COBOLvariable, truncated to eight characters. |
|
GENONLY |
|
|
LEN value |
COBOLvariable length; can be numeric integer, COBOL variable, or arithmetic expression. |
|
PIC COBOLpicture |
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
Data communication call (see Data Communication Calls)
ISPF Dialog target
Establish a link between a Dialog function pool variable and a COBOL program variable.
DLG-VDEFINE [COBOLlevel] COBOLvariable ... [[AS] dialogvariable] ... [PIC COBOLpicture]|LEN value ... [GENONLY]
|
AS dialog |
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 |
|
|
LEN value |
COBOLvariable length; can be numeric integer, COBOL variable, or arithmetic expression. |
|
PIC COBOLpicture |
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
Data communication call (see Data Communication Calls)
ISPF Dialog target
Remove the Dialog variables, previously defined by VDEFINE, from the function pool.
DLG-VDELETE dialogvariable|*
|
dialogvariable |
Delete a specific ISPF Dialog variable. |
|
* (asterisk) |
Delete all variables. |
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
Data communication call (see Data Communication Calls)
ISPF Dialog target
Move data from a COBOL program variable to an ISPF function pool variable.
DLG-VREPLACE [COBOLlevel] COBOLvariable ... [[INTO] dialogvariable] ... [PIC COBOLpicture]|LEN value ... [GENONLY]
|
COBOLlevel |
COBOLvariable level number. |
|
COBOLvariable |
COBOL data name the call processes. |
|
GENONLY |
|
|
INTO dialog |
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 |
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
Data communication call (see Data Communication Calls)
ISPF Dialog target
Reset all program function pool variables and delete the links between COBOL variables and Dialog variables within the function pool.
DLG-VRESET
Data field DLG-VRESET-RC contains the return code after call execution.
Program Painter and Specification Editor parameter (see Keywords)
ISPF Dialog and ISPF prototyping programs; CICS and IMS DC batch programs and reports
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.
-KYWD- 12-*----20---*----30---*----40---*----50---*----60
DPAR sectionname SECTION
USE declarativesentence
[DPAR paragraphname
paragraphstatements ]
|
sectionname |
Specify Section paragraph. |
|
USE declarative |
APS supports the USE clause with the exception of USE AFTER DEBUGGING, which is not supported. |
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 DECLARATIVESProgram Painter and Specification Editor parameter (see Keywords)
In your program, include a data structure created in the Data Structure Painter and in that format.
-KYWD- 12-*----20---*----30---*----40---*----50---*----60 DS[nn] datastructurename
|
FD |
File Section (see FD) |
|
SD |
Sort File Description (see SD) |
|
WS |
Working-Storage Section (see WS) |
|
LK |
Linkage Section (see LK) |
Copyright © 2002 Micro Focus International Limited. All rights reserved.
This document and the proprietary marks and names
used herein are protected by international law.