Z-MODADR

This document covers the following topics:


Description

Modify the work and home address for a cabinet or nickname.

This subprogram can be used by different types of users. Depending on the type of user, the following functions are allowed:

  • Cabinet Administrator
    Modify the address for a cabinet (except for cabinet SYSCNT), or for a nickname in the cabinet administrator's own private cabinet.

  • System Administrator
    Modify the address for cabinet SYSCNT, for a nickname in cabinet SYSCNT, or for a nickname in the system administrator's own private cabinet.

  • Any Other User
    Modify the address for a nickname in the user's own private cabinet.

You must specify at least one of the following parameters: Cabinet-name, Nickname or Object-ISN. Thus, the following combinations are allowed: Cabinet-name and Object-ISN, Nickname and Object-ISN, only the Cabinet-name, only the Nickname, or only the Object-ISN.

The following table shows the parameters that are used for the different functions of this subprogram (the table does not consider the Object-ISN):

Function Cabinet Cabinet-name Nickname
Modify the address for a cabinet (except for cabinet SYSCNT). User ID of a cabinet administrator. The name of the cabinet to be modified.  
Modify the address for cabinet SYSCNT. User ID of a system administrator. The cabinet name "SYSCNT".  
Modify a nickname in cabinet SYSCNT. The cabinet name "SYSCNT".   The nickname to be modified.
Modify a nickname in the own private cabinet. The name of the cabinet in which the nickname is stored.   The nickname to be modified.

Parameters which are not completed in the parameter list are deleted from the address. Thus, to retain the existing values, you must specify them once more before you invoke this subprogram.

To fill the parameters with the already existing address values, it is recommended that you invoke Z-GETADR prior to invoking Z-MODADR (see the following example program).

Parameters

Parameter Format In Out Remarks
Return-code N2 O X Input -1: no ET.
Cabinet A8 R   To modify the address for a cabinet, this must be the user ID of a cabinet administrator. To modify the nickname, this must be the ID of the cabinet in which the nickname is stored.
Password A8 R   The password of the above cabinet.
Cabinet-name A8 R/O*   The name of the cabinet to be modified. Either Cabinet-name or Nickname, not both.
Nickname A32 R/O*   The nickname to be modified. Either Nickname or Cabinet-name, not both.
Object-ISN P10 R/O   The ISN of the cabinet or nickname to be modified. You can invoke Z-GETADR prior to Z-MODADR to obtain the ISN for the desired cabinet or nickname. The Object-ISN can either be specified alone, or in addition to Cabinet-name or Nickname. In the latter case, the Object-ISN must correspond to the Cabinet-name or Nickname, otherwise return code 4 is issued.
Work-title A32 O    
Work-company A32 O    
Work-location A32 O    
Work-address A60/1:3 O    
Work-city A32 O    
Work-country A8 O    
Work-department-name A32 O    
Work-department-number A10 O    
Work-phone A15 O    
Work-phone-country N2 O    
Work-phone-extension A10 O    
Work-postal-code A10 O    
Work-state A8 O    
Home-address A60/1:2 O    
Home-city A32 O    
Home-country A8 O    
Home-phone A15 O    
Home-phone-country N2 O    
Home-postal-code A10 O    
Home-state A8 O    

Return Codes

00 Success
02 Invalid cabinet name
03 Password incorrect
04 ISN was not found
15 Invalid administrator status
53 Requested object does not exist
91 Invalid input in the parameter Cabinet-name or Nickname
92 You can either specify Cabinet-name or Nickname, you must not specify both
93 You must specify the parameter Cabinet-name or Nickname

Subprograms

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

Example

The following example uses a local data area for the parameters of Z-MODADR. See Local Data Areas for further information.

Only the parameters used by Z-GETADR are defined locally.

**********************************************************************
* Shows how a cabinet administrator can substitute the old German
* zip codes (PLZ) with the new five-character zip codes
*********************************************************************
DEFINE DATA
LOCAL USING L-MODADR                 /* used by Z-MODADR
LOCAL
1 OBJECT-NUMBER          (N2)        /* used by Z-GETADR (in
1 PRIVATE-FLAG           (A1)        /* addition to the
1 LAST-NAME              (A32)       /* variables defined in
1 FIRST-NAME             (A32)       /* the local data area
1 INITIAL                (A1)        /* L-MODADR)
1 WORK-PARAMETER         (A88)
1 TABLE-DA(A30/2) INIT
  (1) <'Haardtring          64295'>
  (2) <'Friedberger         64289'>
1 REDEFINE TABLE-DA
  2 STRING (2)
    3 STREET           (A20)
    3 PLZ              (A5)
1 IND                  (N2)
1 ADR-INX              (N2)
1 #RETURN-CODE         (N2)
1 #COUNTER             (N3)
END-DEFINE
*
MOVE 'ADMIN-ID'           TO CABINET
MOVE 'PASSWORD'           TO PASSWORD
MOVE '*'                  TO CABINET-NAME  /* all cabinets
REPEAT
  RESET RETURN-CODE
  CALLNAT 'Z-GETADR'
    RETURN-CODE
    CABINET
    PASSWORD
    CABINET-NAME
    NICKNAME
    OBJECT-ISN
    OBJECT-NUMBER
    PRIVATE-FLAG
    LAST-NAME
    FIRST-NAME
    INITIAL
    WORK-TITLE
    WORK-COMPANY
    WORK-LOCATION
    WORK-ADDRESS(*)
    WORK-CITY
    WORK-COUNTRY
    WORK-DEPARTMENT-NAME
    WORK-DEPARTMENT-NUMBER
    WORK-PHONE
    WORK-PHONE-COUNTRY
    WORK-PHONE-EXTENSION
    WORK-POSTAL-CODE
    WORK-STATE
    HOME-ADDRESS(*)
    HOME-CITY
    HOME-COUNTRY
    HOME-PHONE
    HOME-PHONE-COUNTRY
    HOME-POSTAL-CODE
    HOME-STATE
    WORK-PARAMETER
*
  MOVE RETURN-CODE TO #RETURN-CODE
  IF RETURN-CODE EQ 0
      OR RETURN-CODE EQ 77
    RESET RETURN-CODE
*
    PERFORM FILL-PLZ /* see the subroutine at the end of this program
*
    CALLNAT 'Z-MODADR'
      L-MODADR
  END-IF
  IF RETURN-CODE EQ 0
    ADD 1 TO #COUNTER
  END-IF
  UNTIL #RETURN-CODE NE 77
END-REPEAT
*
WRITE #COUNTER ' addresses were modified'
*
* *****************************************************
*
DEFINE SUBROUTINE FILL-PLZ
*
IF WORK-CITY EQ SCAN 'Darmstadt'
  FOR ADR-INX  1 TO 3
    FOR IND 1 TO 2
      IF WORK-ADDRESS(ADR-INX)  EQ SCAN STREET(IND)
        MOVE PLZ(IND) TO WORK-POSTAL-CODE
      END-IF
    END-FOR
  END-FOR
END-IF
*
END-SUBROUTINE
* *****************************************************
END