900-COPY-URL and 900-COPY-RNG-URL

The 900-COPY-URL-<FileName> API copies a URL from one base file record to a different base file record. The 900-COPY-RNG-URL-<FileName> API copies all of the URLs from one base file record to a different base file record. For both APIs, the target base file record must be in the same file as the source base file record. If you want to copy URL records from a record in one file to a record in a different file, use 900-CREATE-URL-<FileName> and 900-STORE-URL-<FileName> to create the URL records in the new file.

The base record that is current when 900-FIND-BEGRNG-URL-<FileName> is called is used as the source or "from" base record until either all of the URLs have been retrieved (for example, URLCOM-NOTFOUND DCOM@NOTFOUND is true) or 900-FIND-BEGRNG-URL-<FileName> is called again.

The base record that is current when 900-COPY-URL-<FileName> or 900-COPY-RNG-URL-<FileName> is called is used as the target or "to" base record.

When URL<Prefix>-DATE-USER = 1, the URL<Prefix>-CREATE-DATE , URL<Prefix>-CREATE-TIME , URL<Prefix>-MODIFY-DATE , and/or URL<Prefix>-MODIFY-TIME fields in the new URL records will use the values from those fields in the URLs being copied. If URL<Prefix>-DATE-USER is not 1, then those fields will be set to the current system date or time as appropriate.

Programming Example

This code uses 900-COPY-RNG-URL to copy the URLs associated with COMPANY 1000 to COMPANY 2000. In this example, the new URL records will use the system date and time.

PERFORM 910-AUDIT-BEGIN.

MOVE 1000 TO DB-COMPANY.
PERFORM 840-FIND-COMSET1.

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

    ... company 1000 is "current" and used as the source of the URLs ...
    PERFORM 900-FIND-BEGRNG-URL-COMPANY

    IF (URLCOM-FOUND)
        MOVE 2000 TO DB-COMPANY
        PERFORM 840-FIND-COMSET1

        IF (COMPANY-FOUND)
            ... company 2000 is "current" and used as the target of the copy ...
            PERFORM 900-COPY-RNG-URL-COMPANY
        END-IF
    END-IF
END-IF.

PERFORM 920-AUDIT-END.

This code uses 900-COPY-URL to copy the URLs associated with COMPANY 1000 that were created in 2012 to COMPANY 2000. Because we only copying some of the URLs, we must use 900-COPY-URL to copy the individual URLs.

PERFORM 910-AUDIT-BEGIN.

MOVE 20120101 TO PRM-FROM-DATE.
MOVE 20121231 TO PRM-TO-DATE.

MOVE 1000 TO DB-COMPANY.
PERFORM 840-FIND-COMSET1.

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

    ... company 1000 is "current" and used as the source of the URLs ...
    PERFORM 900-FIND-BEGRNG-URL-COMPANY

    MOVE 2000 TO DB-COMPANY
    PERFORM 840-FIND-COMSET1

    IF (COMPANY-FOUND)
        PERFORM UNTIL (URLCOM-NOTFOUND)
            ... company 2000 is "current" and is used as the target of the copy ...
            IF (PRM-FROM-DATE <= URLCOM-CREATE-DATE)
            AND (URLCOM-CREATE-DATE <= PRM-TO-DATE)
                MOVE 1 TO URLCOM-DATE-USER
                PERFORM 900-COPY-URL-COMPANY
            END-IF
            ... the value of URLCOM-TYPE changed, so we need to reset it ...
            MOVE SPACES TO URLCOM-TYPE
            ... company 1000 is still the source of the URLs ...
            PERFORM 900-FIND-NXTRNG-URL-COMPANY
            END-PERFORM
        END-PERFORM
    END-IF
END-IF.

PERFORM 920-AUDIT-END.
.