To add a record occurrence to the database, perform the following steps:
Note: Sets for which the stored record is defined as a manual member need not be defined in the subschema because the STORE statement does not access those sets. (An automatic member is connected automatically to the selected set occurrence when the record is stored; a manual member is not connected automatically to the selected set occurrence.)
Areas should be readied whether they are affected explicitly or implicitly (for example, as owner of a mandatory automatic set whose members are being stored).
If the record being stored has a location mode of VIA, currency must be established for that VIA set, regardless of whether the record being stored is an automatic or manual member of that set. Current of the VIA set provides the suggested page for the record being stored.
What STORE Does
STORE performs the following functions:
The program excerpt below shows storing records in the database.
The program establishes the proper DEPARTMENT and OFFICE currencies and stores the new EMPLOYEE record.
PROCEDURE DIVISION.
.
READ NEW-EMP-FILE-IN.
AT END MOVE 'Y' TO EOF-SW.
PERFORM A300-STORE-EMP THRU A300-EXIT
UNTIL END-OF-FILE.
FINISH.
GOBACK.
A300-STORE-EMP.
MOVE DEPT-ID-IN TO DEPT-ID-0410.
*** ESTABLISH CORRECT DEPARTMENT CURRENCY ***
FIND CALC DEPARTMENT.
*** CHECK FOR ERROR-STATUS = 0326 ***
IF DB-REC-NOT-FOUND
THEN DISPLAY
'DEPARTMENT ' DEPT-ID-IN ' NOT FOUND'
'FOR NEW EMPLOYEE ID ' EMP-ID-IN
GO TO A300-GET-NEXT
ELSE IF DB-STATUS-OK
NEXT SENTENCE
ELSE
PERFORM IDMS-STATUS.
MOVE OFFICE-CODE-IN TO OFFICE-CODE-0450.
*** ESTABLISH CORRECT OFFICE CURRENCY ***
FIND CALC OFFICE.
*** CHECK FOR ERROR-STATUS = 0326 ***
IF DB-REC-NOT-FOUND
THEN DISPLAY
'OFFICE ' OFFICE CODE-IN ' NOT FOUND'
'FOR NEW EMPLOYEE ID ' NEW-EMP-ID
GO TO A300-GET-NEXT
ELSE IF DB-STATUS-OK
NEXT SENTENCE
ELSE
PERFORM IDMS-STATUS.
PERFORM B300-INITIALIZE-EMPLOYEE.
*** STORE EMPLOYEE RECORD ***
STORE EMPLOYEE.
PERFORM IDMS-STATUS.
PERFORM U500-WRITE-NEW-EMP-REPORT.
A300-GET-NEXT.
READ NEW-EMP-FILE-IN
AT END MOVE 'Y' TO EOF-SW.
A300-EXIT.
EXIT.
|
Copyright © 2013 CA.
All rights reserved.
|
|