GET SAME

#### Search Results

Search

# GET SAME

#### Structured Mode Syntax

`GET SAME` [(r)]

#### Reporting Mode Syntax

`GET SAME` [(r)] [operand1 ]

This document covers the following topics:

- Function

- Restrictions

- Syntax Description

- Example

For an explanation of the symbols used in the syntax diagram, see Syntax Symbols.

Related Statements: `ACCEPT/REJECT` | `AT BREAK` | `AT START OF DATA` | `AT END OF DATA` | `BACKOUT TRANSACTION` | `BEFORE BREAK PROCESSING` | `DELETE` | `END TRANSACTION` | `FIND` | `GET` | `GET TRANSACTION DATA` | `HISTOGRAM` | `LIMIT` | `PASSW` | `PERFORM BREAK PROCESSING` | `READ` | `RETRY` | `STORE` | `UPDATE`

Belongs to Function Group: Database Access and Update

## Function

The `GET SAME` statement is used to re-read the record currently being processed. It is most frequently used to obtain database array values (periodic groups or multiple-value fields) if the number and range of existing or desired occurrences was not known when the record was initially read.

## Restrictions

- `GET SAME` is only valid for Natural users who are using Adabas.

- `GET SAME` cannot be used with Entire System Server.

- An `UPDATE` or `DELETE` statement must not reference a `GET SAME` statement. These statements should instead make reference to the `FIND`, `READ` or `GET` statement used to read the record initially.

## Syntax Description

Operand Definition Table:

Operand | Possible Structure | Possible Formats | Referencing Permitted | Dynamic Definition
--- | --- | --- | --- | ---
`operand1` |  | S | A |  |  | A | U | N | P |  |  | B |  |  |  |  |  |  | no | yes

Syntax Element Description:

Syntax Element | Description
--- | ---
`(r)` | Statement Reference: The notation `(r)` is used to specify the statement which contains the `FIND` or `READ` statement used to initially read the record. If `(r)` is not specified, the `GET SAME` statement will be related to the innermost active processing loop. `(r)` may be specified as a reference statement number or as a statement label.
`operand1` | Fields to Be Made Available: As `operand1`, you specify the field(s) to be made available as a result of the `GET SAME` statement. Note `operand1` cannot be specified if the field is defined in a `DEFINE DATA` statement.

## Example

    ** Example 'GSAEX1': GET SAME
    ************************************************************************
    DEFINE DATA LOCAL
    1 I                (P3)
    1 POST-ADDRESS VIEW OF EMPLOYEES
      2 FIRST-NAME
      2 NAME
      2 ADDRESS-LINE   (I:I)
      2 C*ADDRESS-LINE
      2 POST-CODE
      2 CITY
    *
    1 #NAME            (A30)
    END-DEFINE
    *
    FORMAT PS=20
    MOVE 1 TO I
    *
    READ (10) POST-ADDRESS BY NAME
      COMPRESS NAME FIRST-NAME INTO #NAME WITH DELIMITER ','
      WRITE // 12T #NAME
      WRITE /  12T ADDRESS-LINE (I.1)
      /*
      IF C*ADDRESS-LINE > 1
        FOR I = 2 TO C*ADDRESS-LINE
          GET SAME                      /* READ NEXT OCCURRENCE
          WRITE 12T ADDRESS-LINE (I.1)
        END-FOR
      END-IF
      WRITE / POST-CODE CITY
      SKIP 3
    END-READ
    END

#### Output of Program GSAEX1:

    Page      1                                                  05-01-13  13:23:36

               ABELLAN,KEPA

               CASTELAN 23-C

    28014      MADRID

               ACHIESON,ROBERT

               144 ALLESTREE LANE
               DERBY
               DERBYSHIRE

    DE3 4TR    DERBY

### On this page

- Function
- Restrictions
- Syntax Description
- Example