Create URL Records

The 900-CREATE-URL-<FileName> and 900-STORE-URL-<FileName> routines are usd together to create a new URL record. The 900-CREATE-URL-<FileName> routine initializes some of the runtime fields. Then the program sets the appropriate URL working sotrage fields. Finally, the 900-STORE-URL-<FileName> routine sets additional runtime fields based on the current base file record and writes the new URL record to the database.

Programming Examples

This code shows how to create and store a URL record associated with COMPANY record of COMPANY 1000. The program is responsible for setting the NAME, TYPE, SCHEME, URL-TEXT and SIZE field values before performing 900-STORE-URL-<FileName>. When the DATE-USER field is zero (which is the default), the system will set the date and time fields using the current system date and time.

PERFORM 910-AUDIT-BEGIN.

MOVE 1000 TO DB-COMPANY.

PERFORM 840-FIND-COMSET1.

IF (COMPANY-FOUND)
    PERFORM 900-CREATE-URL-COMPANY
    MOVE "Example Home Page"   TO URLCOM-NAME
    MOVE "C"                   TO URLCOM-TYPE
    MOVE "HTTP"                TO URLCOM-SCHEME
    STRING "http://example.com"
        DELIMITED BY SIZE
        INTO URLCOM-URL-TEXT
        POINTER URLCOM-SIZE
    END-STRING
    PERFORM 900-STORE-URL-COMPANY
    IF (URLCOM-FOUND-SW = 3)
        ... the store failed, perform error handling ...
    END-IF
END-IF.

PERFORM 920-AUDIT-END.

This code shows how to create and store a URL record that uses user-defined dates and times. Moving a value of 1 to the DATE-USER field tells the 900-STORE-URL-<FileName> API to use the dates and times provided by the program.

PERFORM 910-AUDIT-BEGIN.

MOVE 1000 TO DB-COMPANY.

PERFORM 840-FIND-COMSET1.

IF (COMPANY-FOUND)
    PERFORM 900-CREATE-URL-COMPANY
    MOVE 1                     TO URLCOM-DATE-USER
    MOVE XXX-DATE              TO URLCOM-CREATE-DATE
    MOVE XXX-TIME              TO URLCOM-CREATE-TIME
    MOVE YYY-DATE              TO URLCOM-MODIFY-DATE
    MOVE YYY-TIME              TO URLCOM-MODIFY-TIME
    MOVE "Example Home Page"   TO URLCOM-NAME
    MOVE "C"                   TO URLCOM-TYPE
    MOVE "HTTP"                TO URLCOM-SCHEME
    STRING "http://example.com"
        DELIMITED BY SIZE
        INTO URLCOM-URL-TEXT
        POINTER URLCOM-SIZE
    END-STRING
    PERFORM 900-STORE-URL-COMPANY
    IF (URLCOM-FOUND-SW = 3)
        ... the store failed, perform error handling ...
    END-IF
END-IF.

PERFORM 920-AUDIT-END.

The URL-ORDER field is not used by the 900-CREATE-URL-<FileName> and 900-STORE-URL-<FileName> APIs.