Software AG Products 2.4.1 | Reference Guide | Programming Considerations | Writing a Program
 
Writing a Program
Adabas Pre-Compiler does not require any changes in the writing of PL/I or COBOL programs. You add Adabas Pre-Compiler commands to your programs when you want to use the Adabas database. Each Adabas Pre-Compiler command begins with an "@" symbol and ends with a period or a semicolon. You use the @OPTIONS statement to define only one of the two delimiters.
To identify your program, use the @NAME and @USER commands in the beginning. Then, in the WORKING-STORAGE SECTION, or wherever you need to, use the @ADADCL command to declare buffers. You can declare up to 70 sets of buffers with the @ADADCL command.
Use the @OPEN command to open the files in the database and define which type of program is running (Update/Access). Then, use the Adabas Pre-Compiler execution commands to read and/or write data.
When using the execution commands, keep in mind the EOFnnnn facility. Adabas Pre-Compiler checks for end of file in sequential reads, or end of list in @FIND/@READNEXT commands and turns on/off the EOFnnnn indication. Use this indication to write a processing loop. For example:
@FIND7
PERFORM RECORD-HANDLE UNTIL EOF7.
.
.
.
RECORD-HANDLE.
.
.
@READNEXT7.
Always issue the @CLOSE command at the end of a program.
The following is an example of a program:
ID DIVISION.
.
@NAME PROG1.
@USER V05.
.
WORKING-STORAGE SECTION.
.
@ADADCL1 . . . .
@ADADCLK . . . .
@ADADCL35X . . . .
.
.
PROCEDURE DIVISION.
@OPEN . . . .
.
.
.
.
@READLOGICAL1 FIRST.
PERFORM READING UNTIL EOF1.
.
.
.
.
.@CLOSE
STOP RUN.
READING.
.
@FIND35X.
PERFORM READ35X UNTIL EOF35X.
@READLOGICAL1.
.
.
READ35X.
.
.
.
@READNEXT35X.