DB-PROCESS

Combine record retrieval and looping functions into one call. DB-PROCESS provides a built-in loop structure to process records and rows. The loop structure can include blocks of user-supplied logic and AMB-generated control fields. User logic executes once for each successful iteration of DB-PROCESS, and can include:
Restriction: This topic applies only when the AppMaster Builder AddPack has been installed, and applies only to Windows platforms.
  • Any AMB DB call, except DB-OPEN, DB-DECLARE, or DB-CLOSE
  • Record and row processing code, for example, MOVE DATA TO SCREEN

AMB 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

AMB 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

AMB 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

AMB increments this counter at each process loop execution. This counter controls looping, serves as a subscript when moving data into a table or screen fields, and counts processed records

The specific purposes of this call vary depending on the target.

Targets:

  • IMS DB
  • SQL
  • VSAM Batch
  • VSAM Online

IMS DB

DB-PROCESS processes:
  • Records that satisfy the key qualification (key qualified)
  • Records sequentially (unqualified)
Syntax: for Format 1

Key-qualified.

DB-PROCESS REC recordname
... [WHERE keyname operator value [SUB[SCRIPT] value] 
... [OF|IN dataarea]]
... [DB-PROCESS-ID name] [INTO dataarea] [HOLD] [RESET]
... [VIEW|PCB pcbname]
  Controlled logic block
Syntax: for Format 2

Unqualified.

DB-PROCESS REC recordname
... [DB-PROCESS-ID name] [INTO dataarea]
... [HOLD] [RESET]
... [VIEW|PCB pcbname]
  Controlled logic block
General Rules:
  1. Processing begins at a previously established position in the database or, if RESET coded, at the beginning of the database.
  2. Use the CCODE keyword to include additional IMS command codes. See the topic IMS command codes for a list of valid CCODEs.
Parameters:

REC recordname

IMS segment to process.

WHERE keyname operator value

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.

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.