Z-ENC11

This document covers the following topics:


Description

Enclose documents with a host document, or detach enclosures from a host document.

The following functions are available:

Function code 1 - Add enclosures to a host document

You can enclose up to 10 documents with a host document.

To specify the documents which are to be enclosed, you can either use the array Enclosure-name or Enclosure-ISN. The occurrences of an array must be filled contiguously. The first occurrence of an array identifies whether the enclosures are specified by name or ISN; i.e. when you fill the first occurrence with the ISN, you must also fill all other occurrences with ISNs. You must not use both names and ISNs within an array.

However, you can fill the parameter Host-document-ISN with the ISN and the occurrences of the array Enclosure-name with the names.

The documents are enclosed in the same order as they appear in the array. If the host document already contains enclosures, the new enclosures will be placed after them.

Function code 2 - Get enclosures of a host document

To get the names of documents which are currently enclosed with a host document, you must leave the arrays Enclosure-name and Enclosure-ISN empty.

The names of the enclosures are returned in the array Enclosure-name.

Function code 3 - Detach enclosures from a host document

When you use this subprogram to detach enclosures, all detached enclosures are erased from Con-nect. They are not placed in the Wastebasket. Cover notes and attached notes are not considered by this subprogram.

To specify the enclosures which are to be detached from a host document, you must specify their names in the array Enclosure-name.

When you specify a document which is not an enclosure of the host document, this name remains in the array Enclosure-name after all other enclosures have been detached. This array will normally be empty, if all specified enclosures have been found and detached.

Parameters

Parameter Format In Out Remarks
Return-code N2 O X Input -1: no ET.
Cabinet A8 R   The cabinet which contains the host document.
Password A8 R   The password of the above cabinet.
Host-document-name A32 R*   The name of the host document. Either Host-document-name or Host-document-ISN, not both.
Host-document-ISN P10 R*   The ISN of the host document. Either Host-document-ISN or Host-document-name, not both.
Enclosure-name A32/1:10 R* X The names of the enclosures. Input: either Enclosure-name or Enclosure-ISN, not both.
Enclosure-ISN P10/1:10 R*   The ISNs of the enclosures. Either Enclosure-ISN or Enclosure-name, not both. You can only specify Enclosure-ISN when you add an enclosure. You must not specify Enclosure-ISN when you detach an enclosure. However, you can specify Enclosure-name in both cases.
Index P3   X A value is returned for return codes 4, 9, 51 and 53. Values 1 through 10 indicate the position (occurrence) of the enclosure in the array; 0 indicates the host document.
Function-code N2 R   1=add enclosures, 2=get enclosure names, or 3=detach enclosures.

Return Codes

00 Success
02 Invalid cabinet name or - in batch mode only - locked cabinet
03 Password incorrect
04 Document ISN was not found
08 Supply either document ISN or name, not both
09 ISN does not point to a document record
51 Invalid document name
53 Requested object does not exist
91 No more enclosures possible
92 Too many documents to enclose
93 Documents cannot be enclosed with a document in a system folder
94 Wrong function code
95 Host document does not contain enclosures
96 To detach an enclosure, you must specify its name (you must not use the ISN)
97 The specified enclosures are no enclosures of the host document

Subprograms

Z-120
Z-122
Z-123
Z-180
Z-185
Z-1200&0

Example

0010 DEFINE DATA
0020 LOCAL
0030 1 RETURN-CODE         (N2)
0040 1 CABINET             (A8)
0050 1 PASSWORD            (A8)
0060 1 HOST-DOCUMENT-NAME  (A32)          /* Host document
0070 1 HOST-DOCUMENT-ISN   (P10)
0080 1 ENCLOSURE-NAME      (A32/1:10)     /* Enclosures
0090 1 ENCLOSURE-ISN       (P10/1:10)
0100 1 INDEX               (P3)
0110 1 FUNCTION-CODE       (N2)
0120 *
0130 * FUNCTION-CODE:
0140 *    1 = Add enclosures
0150 *    2 = Get enclosure names
0160 *    3 = Detach enclosures
0170 *
0180 END-DEFINE
0190 *
0200 RESET RETURN-CODE
0210       INDEX
0220 *
0230 MOVE  1               TO  FUNCTION-CODE       /* Add enclosures
0240 MOVE 'CABINET'        TO  CABINET
0250 MOVE 'PASSWORD'       TO  PASSWORD
0260 MOVE 177271           TO  HOST-DOCUMENT-ISN   /* Host document
0270 *
0280 MOVE 'Encl1'          TO  ENCLOSURE-NAME(1)
0290 MOVE 'Encl2'          TO  ENCLOSURE-NAME(2)
0300 *
0310 CALLNAT 'Z-ENC11'  RETURN-CODE
0320    CABINET
0330    PASSWORD
0340    HOST-DOCUMENT-NAME
0350    HOST-DOCUMENT-ISN
0360    ENCLOSURE-NAME(*)
0370    ENCLOSURE-ISN (*)
0380    INDEX
0390    FUNCTION-CODE
0400 *
0410 IF RETURN-CODE EQ 0
0420    WRITE 'Enclosures were added'
0430 ELSE
0440    WRITE 'Return code' RETURN-CODE
0450 END-IF
0460 *
0470 END