GET

In structured mode and in reporting mode using a DEFINE DATA LOCAL statement, the following syntax applies:

GET [IN] [FILE] view-name
[PASSWORD=operand1]
[CIPHER=operand2]

RECORDS

operand3

*ISN [(r) ]

In reporting mode using no DEFINE DATA LOCAL statement, the following syntax applies:

GET [IN] [FILE] ddm-name
[PASSWORD=operand1]
[CIPHER=operand2]

RECORDS

operand3

operand4
*ISN [(r) ]

This document covers the following topics:

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 SAME | GET TRANSACTION | HISTOGRAM | LIMIT | PASSW | PERFORM BREAK PROCESSING | READ | RETRY | STORE | UPDATE

Belongs to Function Group: Database Access and Update


Function

The GET statement is used to read a record with a given Adabas Internal Sequence Number (ISN).

For XML databases, the GET statement is used to read an XML object with a given object ID.

The GET statement does not cause a processing loop to be initiated.

Restrictions

  • The GET statement cannot be used for SQL databases.

  • The GET statement cannot be used with Entire System Server.

Syntax Description

Operand Definition Table:

Operand Possible Structure Possible Formats Referencing Permitted Dynamic Definition
operand1 C S       A                       yes no
operand2 C S         N                     no no
operand3 C S     N   N P I   B *             yes no
operand4   S A     A N P I F B D T L       yes yes

* Format B of operand3 may be used only with a length of less than or equal to 4.

Syntax Element Description:

Syntax Element Description
view-name
View Name:

In structured mode and in reporting mode using a DEFINE DATA LOCAL statement, the name of a view as defined either directly within a DEFINE DATA statement or in a separate global or local data area.

ddm-name
DDM Name:

In reporting mode using no DEFINE DATA LOCAL statement, the name of the data definition module (DDM) is referenced.

PASSWORD=operand1
PASSWORD Clause/CIPHER Clause:

These clauses are applicable only to Adabas databases.

The PASSWORD clause is used to provide a password when retrieving data from an Adabas file which is password protected.

The CIPHER clause is used to provide a cipher key when retrieving data from an Adabas file which is enciphered.

See the statements FIND and PASSW for further information.

CIPHER=operand2
*ISN / operand3
Internal Sequence Number:

The ISN must be provided either in the form of a numeric constant or user-defined variable (operand3 in the range from 1 to 4294967295), or via the Natural system variable *ISN.

(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 statement will be related to the innermost active processing loop.

(r) may be specified as a reference statement number or as a statement label.

operand4
Reference to Database Fields:

In reporting mode, subsequent references to database fields that have been read with a GET statement can contain the label or line number of the GET statement.

Example

** Example 'GETEX1': GET                                                
************************************************************************
DEFINE DATA LOCAL                                                       
1 PERSONS VIEW OF EMPLOYEES                                             
  2 PERSONNEL-ID                                                        
  2 NAME                                                                
  2 FIRST-NAME                                                          
1 SALARY-INFO VIEW OF EMPLOYEES                                         
  2 NAME                                                                
  2 CURR-CODE (1:1)                                                     
  2 SALARY    (1:1)                                                     
*                                                                       
1 #ISN-ARRAY  (B4/1:10)                                                 
1 #LINE-NR    (N2)                                                      
END-DEFINE                                                              
*                                                                       
FORMAT PS=16                                                            
LIMIT 10                                                                
READ PERSONS BY NAME                                                    
  MOVE *COUNTER TO #LINE-NR                                         
  MOVE *ISN     TO #ISN-ARRAY (#LINE-NR)                            
  DISPLAY #LINE-NR PERSONNEL-ID NAME FIRST-NAME                     
  /*                                                                
  AT END OF PAGE                                                    
    INPUT / 'PLEASE SELECT LINE-NR FOR SALARY INFORMATION:' #LINE-NR
    IF #LINE-NR = 1 THRU 10                                         
      GET SALARY-INFO #ISN-ARRAY (#LINE-NR)                         
      WRITE / SALARY-INFO.NAME                                      
              SALARY-INFO.SALARY    (1)                             
              SALARY-INFO.CURR-CODE (1)                             
    END-IF                                                          
  END-ENDPAGE                                                       
  /*                                                                
END-READ                                                            
END

Output of Program GETEX1:

Page      1                                                  05-01-13  13:17:42
                                                                               
#LINE-NR PERSONNEL         NAME              FIRST-NAME                        
            ID                                                                 
-------- --------- -------------------- --------------------                   
                                                                               
  1      60008339  ABELLAN              KEPA                                   
  2      30000231  ACHIESON             ROBERT                                 
  3      50005800  ADAM                 SIMONE                                 
  4      20008800  ADKINSON             JEFF                                   
  5      20009800  ADKINSON             PHYLLIS                                
  6      20012700  ADKINSON             HAZEL                                  
  7      20013800  ADKINSON             DAVID                                  
  8      20019600  ADKINSON             CHARLIE                                
  9      20008600  ADKINSON             MARTHA                                 
 10      20005700  ADKINSON             TIMMIE                                 
                                                                               
PLEASE SELECT LINE-NR FOR SALARY INFORMATION: 1                                
                                                                               
ABELLAN                 1450000 PTA