Read URL Records

900-FIND-BEGRNG-URL-<FileName> and 900-FIND-NXTRNG-URL-<FileName> routines are used to read URL records.

The 900-FIND-BEGRNG-URL-<FileName> API is used to define search parameters for a set of URL records associated with the current base file record, open the result set and retrieve the first record of the set.

The URL<Prefix>-URL-ORDER field controls both the order in which URLs are returned and the keys used to search for the URLs.

URL-ORDER = 0 is the default and orders the URLs by NAME and sequence number (SET5). If the NAME field is not blank, only URLs with matching NAME values will be returned.

URL-ORDER = 1 orders the URLs by CREATE-DATE, CREATE-TIME and sequence number (SET6). If the Ath->CrtDate and Ath->CrtTime fields (internal C fields that 4GL programs do not directly control) are not blank, only URLs that match both will be returned. If Ath->CrtDate is not blank and Ath->CrtTime is blank, then only URLs that match that date are returned.

URL-ORDER = 2 orders the URLs by MODIFY-DATE, MODIFY-TIME and sequence number (SET7). If the Ath->ModDate and Ath->ModTime fields (internal C fields that 4GL programs do not directly control) are not blank, only URLs that match both will be returned. If Ath->ModDate is not blank and Ath->ModTime is blank, then only URLs that match that date are returned.

URL-ORDER = 3 orders the URLs by sequence number (SET3).

The URL<Prefix>-TYPE field can be used to search for specific types of URLs. If URL<Prefix>-TYPE = ' ' (space), then all URLs are retrieved. If the field is set to a different value, then only URLs of that type are returned.

The 900-FIND-NXTRNG-URL-<FileName> API is used to retrieve subsequent records from the result set. The value of the URL<Prefix>-TYPE field must be set to the appropriate value before each call to 900-FIND-NXTRNG-URL-<FileName> .

The name stored with the URL is that of the user who created the URL attachment.

Programming Examples

This code shows how to read all of the URL records associated with COMPANY 1000 ordered by NAME and sequence number.

MOVE 1000 TO DB-COMPANY.

PERFORM 910-AUDIT-BEGIN.

PERFORM 840-FIND-COMSET1.

IF (COMPANY-FOUND)
    MOVE 0      TO URLCOM-URL-ORDER
    MOVE SPACES TO URLCOM-NAME
    MOVE SPACES TO URLCOM-TYPE

    PERFORM 900-FIND-BEGRNG-URL-COMPANY

    PERFORM UNTIL (URLCOM-NOTFOUND)
        ... process the URL ...
        ... note that the value of URLCOM-TYPE changed, so we need to reset it ...
        MOVE SPACES TO URLCOM-TYPE
        PERFORM 900-FIND-NXTRNG-URL-COMPANY
        END-PERFORM
    END-PERFORM
END-IF.

PERFORM 920-AUDIT-END.

This code shows how to read all of the URL records associated with COMPANY 1000 of TYPE = "H" where NAME = "Company Home Page" ordered by NAME and sequence number.

MOVE 1000 TO DB-COMPANY.

PERFORM 910-AUDIT-BEGIN.

PERFORM 840-FIND-COMSET1.

IF (COMPANY-FOUND)
    MOVE 0      TO URLCOM-URL-ORDER
    MOVE "Company Home Page" TO URLCOM-NAME
    MOVE "H"                 TO URLCOM-TYPE

    PERFORM 900-FIND-BEGRNG-URL-COMPANY

    PERFORM UNTIL (URLCOM-NOTFOUND)
        ... process the URL ...
        ... note that URLCOM-TYPE is always "H", so it doesn't need to be reset ...
        PERFORM 900-FIND-NXTRNG-URL-COMPANY
        END-PERFORM
    END-PERFORM
END-IF.

PERFORM 920-AUDIT-END.

This code shows how to read all of the URL records associated with COMPANY 1000 ordered by CREATE-DATE, CREATE-TIME, and sequence number.

MOVE 1000 TO DB-COMPANY.

PERFORM 910-AUDIT-BEGIN.

PERFORM 840-FIND-COMSET1.

IF (COMPANY-FOUND)
    MOVE 1      TO URLCOM-URL-ORDER
    MOVE SPACES TO URLCOM-TYPE

    PERFORM 900-FIND-BEGRNG-URL-COMPANY

    PERFORM UNTIL (URLCOM-NOTFOUND)
        ... process the URL ...
        ... note that the value of URLCOM-TYPE changed, so we need to reset it ...
        MOVE SPACES TO URLCOM-TYPE
        PERFORM 900-FIND-NXTRNG-URL-COMPANY
        END-PERFORM
    END-PERFORM
END-IF.

PERFORM 920-AUDIT-END.