Z-DETACH

This document covers the following topics:


Description

Detach cover notes, enclosed documents or attached notes from a document. Or detach attached notes from an appointment or meeting.

Parameters

Parameter Format In Out Remarks
Return-code N2 O X Input -1: no ET.
Cabinet A8 R   The cabinet in which the document, appointment or meeting is stored.
Password A8 R   The password of the above cabinet.
Command A1 R   Must be one of the following: D=detach, E=erase.
Text-type A1 R   Only required for documents. The type of object to be detached: C=cover note, E=enclosed document, N=attached note.
Text-type-current P3 R*   The sequence number of the cover note, enclosure or attached note to be detached. Must be specified separately for each text type to be detached. You must specify only one of the following parameters: Text-type-current, Note-subject or Attachment-ISN.
Note-subject A32 R*   Applies only to attached notes. The subject of the attached note to be detached. You must specify only one of the following parameters: Text-type-current, Note-subject or Attachment-ISN.
Attachment-ISN P10 R* X Input: the ISN of the cover note, enclosure or attached note to be detached. You can invoke Z-GET11D prior to this subprogram to obtain the ISN. You must specify only one of the following parameters: Text-type-current, Note-subject or Attachment-ISN. Output: the ISN of the detached object.
Host-object-number N2 R   The number of the object from which the cover note, enclosure or attached note is to be detached. Must be one of the following: 3=appointment, 11=document, 16=meeting.
Host-object-name A32 R*   Only required for documents. The name of the document from which the cover note, enclosure or attached note is to be detached. Either Host-object-name or Host-object-ISN, not both.
Host-object-ISN P10 R* X Input: the ISN of the object from which the cover note, enclosure or attached note is to be detached. For an appointment or meeting, this parameter is required. For a document, specify either Host-object-ISN or Host-object-name, not both. Output: the ISN of the object from which the cover note, enclosure or attached note was detached.

Return Codes

00 Success
02 Invalid cabinet name
03 Password incorrect
04 ISN of host object was not found
08 Supply either ISN or name for host object, not both
09 ISN of host object does not point to document, meeting or appointment
13 Invalid host object number
51 Invalid host object name
53 Requested object does not exist
59 Requested command (D or E) not found
91 Invalid Text-type
92 Invalid Text-type-current
93 Cover note, enclosure or attached note does not exist
94 Document is not in folder Work or a user-defined folder
95 Error creating separate detached document
96 Specify only one: Text-type-current, Note-subject or Attachment-ISN
97 Invalid note subject

Subprograms

N-GETMSG
Z-120
Z-122
Z-123
Z-135
Z-161
Z-175
Z-180
Z-711
Z-1200&0

Example

0010 *
0020 * Example program to detach a note from a meeting/appointment
0030 *
0040 *
0050 DEFINE DATA
0060 *
0070 LOCAL
0080 1 RETURN-CODE      (N2)
0090 1 CABINET          (A8)
0100 1 PASSWORD         (A8)
0110 1 COMMAND          (A1)     /* D=detach, E=erase
0120 1 TEXT-TYPE        (A1)     /* N=attached note, C=cover note,E=enclosed
0130 1 TEXT-TYPE-CURRENT(N2)     /* Sequence number of item to be detached
0140 *                              (for each type (N/C/E) - separately).
0150 1 NOTE-SUBJECT     (A32)
0160 1 ATTACHMENT-ISN   (P10)
0170 1 HOST-OBJECT-NUMBER(N2)
0180 1 HOST-OBJECT-NAME (A32)
0190 1 HOST-OBJECT-ISN  (P10)
0200 * ----------------------------
0210 1 START-DATE       (A8)     /* Parameters for Z-GET06B
0220 1 START-TIME       (A8)
0230 1 END-DATE         (A8)
0240 1 END-TIME         (A8)
0250 1 SUBJECT          (A20)
0260 1 DESCRIPTION      (A60/1:3)
0270 1 LOCATION         (A60)
0280 1 AGENDA           (A32)
0290 1 KEYWORDS         (A15/1:6)
0300 1 PRIVATE-FLAG     (A1)
0310 1 SECURITY-FLAGS   (A1/1:4)
0320 1 OBJECT-NUMBER    (N2)
0330 1 RANGE-TYPE       (A1)
0340 1 NO-OCCUPATION    (A1)
0350 1 CURRENT-DATE     (A8)
0360 1 CURRENT-START    (A8)
0370 1 CURRENT-END      (A8)
0380 1 CALENDER-ISN     (P10)   /* ISN  of record is returned
0390 1 ONLY-FIRST       (A1)    /* Only the first record of a multiple-day 
0400 *                             calendar item is returned
0410 1 NOTES            (N2)    /* Number of attached notes returned
0420 1 WORK-PARAMETER   (A40)
0430 * ----------------------------
0440 1 MEETING-FOUND    (L)    INIT < FALSE >
0450 *
0460 END-DEFINE
0470 *
0480 RESET RETURN-CODE
0490 MOVE 'CABINET ' TO CABINET
0500 MOVE 'PASSWORD' TO PASSWORD
0510 MOVE '19971231' TO START-DATE
0520 MOVE '2000'     TO START-TIME
0530 MOVE 'X'        TO ONLY-FIRST
0540 *
0550 REPEAT UNTIL RETURN-CODE NE 0
0560 *
0570   CALLNAT 'Z-GET06B' RETURN-CODE
0580     CABINET
0590     PASSWORD
0600     START-DATE
0610     START-TIME
0620     END-DATE
0630     END-TIME
0640     SUBJECT
0650     DESCRIPTION(*)
0660     LOCATION
0670     AGENDA
0680     KEYWORDS(*)
0690     PRIVATE-FLAG
0700     SECURITY-FLAGS(*)
0710     OBJECT-NUMBER
0720     RANGE-TYPE
0730     NO-OCCUPATION
0740     CURRENT-DATE
0750     CURRENT-START
0760     CURRENT-END
0770     CALENDAR-ISN
0780     ONLY-FIRST
0790     NOTES
0800     WORK-PARAMETER
0810   IF CALENDAR-ISN NE 0
0820       AND  START-DATE EQ '19971231'
0830       AND  START-TIME EQ '    2000'
0840       AND  SUBJECT EQ 'MEET-SUBJ'
0850     MOVE TRUE TO MEETING-FOUND
0860     ESCAPE BOTTOM     /* Go to the note to be detached from the meeting
0870   END-IF
0880 END-REPEAT
0890 *
0900 IF MEETING-FOUND
0910   MOVE 'D'            TO COMMAND
0920   MOVE 'N'            TO TEXT-TYPE
0930   MOVE 'Meeting Notes'TO NOTE-SUBJECT
0940   MOVE  16            TO HOST-OBJECT-NUMBER  /* Meeting
0950   MOVE  CALENDAR-ISN  TO HOST-OBJECT-ISN     /* ISN was found in Z-GET06B
0960   CALLNAT 'Z-DETACH'
0970     RETURN-CODE
0980     CABINET
0990     PASSWORD
1000     COMMAND
1010     TEXT-TYPE
1020     TEXT-TYPE-CURRENT
1030     NOTE-SUBJECT
1040     ATTACHMENT-ISN
1050     HOST-OBJECT-NUMBER
1060     HOST-OBJECT-NAME
1070     HOST-OBJECT-ISN
1080 *
1090   IF RETURN-CODE EQ 00 OR EQ -1
1100     WRITE 'Note was detached'  /
1110     WRITE 'ISN of document created' ATTACHMENT-ISN
1120   ELSE
1130     WRITE 'Return code ' RETURN-CODE  /
1140   END-IF
1150 ELSE
1160   WRITE 'Meeting not found'
1170 END-IF
1180 *
1190 END