Top
Systemwalker Operation Manager  Reference Guide
FUJITSU Software

16.1.3 Calendar Update API (Mp_SetCalendar2)

This section explains the calendar update API (Mp_SetCalendar2).

Synopsis

int Mp_SetCalendar2 (char *APL_name,
              char *cal_name, 
              CALENDAR_WDAT2 *cal_dat2) ;

Description

The Mp_SetCalendar2 function updates the calendar information (if the specified calendar does not exist, it is registered first). Holidays and substitute holidays for which the date changes from year to year can also be updated.

The SYSTEM_CALENDAR cannot be updated.

Past dates cannot be set.

Parameters

APL_name

Specify the storage area address for the requested source application name (64 bytes or less).

Specify NULL at the end of the requested source application name. Do not use names that begin with "Mp_" or "_CAL_."

cal_name

Specify the storage area address for the calendar name to be updated. Specify the calendar name with up to 24 bytes and set NULL at the end.

cal_dat2

Specify the address of the calendar update information structure (CALENDAR_WDAT2).

See "16.1.2 Calendar Registration API (Mp_AddCalendar2)" for details on the calendar update information structure.

Return Values

Return Value

Meaning

Action

0

Normal termination.

-

-5

SYSTEM_CALENDAR specified.

Specify something other than "SYSTEM_CALENDAR".

-6

Not system administrator (a user in the Administrators group on Windows or a superuser on UNIX).

Execute as a system administrator (a member of the Administrators group or the superuser).

-8

Error in calendar information.

Review the specified calendar information (the calendar update information structure "CALENDAR_WDAT2").

-10

Calendar service/daemon is not running.

Start the calendar service or daemon.

-11

There is not enough memory.

Use one of the following methods to increase the amount of available memory:

  • Close other applications.

  • Add more physical memory.

-15

Unspecifiable character specified in calendar name.

Do not use invalid characters in the calendar name.

Calendar names cannot contain spaces, user-defined characters or any of the following characters:

? \ * " < > | / : , ;

-16

Error in file operation (write error).

Check that there is enough space available on the hard disk and that the hard disk is functioning normally.

-17

Illegal calendar name length.

Calendar names can be no more than 24 bytes long.

Program Example

Below is an example program of the calendar update API:

#include <stdio.h>
#include <stdlib.h> 
#include <malloc.h> 
#include <string.h> 

#include <f3crhcap.h> 

extern  void set_cal_dat2( CALENDAR_WDAT2 *) ;

void main() {

        int ret ; 
        int count ; 
        CALENDAR_WDAT2 cal_dat2 ; 

        /*..........initialization ..........*/ 
        memset( &cal_dat2, 0x00, sizeof( CALENDAR_WDAT2) ) ;

        /*..........calendar information setting..........*/ 
        /*this year's settings */ 
        cal_dat2.year = 2000 ;

        /*  enable substitute holiday */ 
        cal_dat2.sub_holiday = 1 ;

        /*make Sunday every week a holiday */ 
        for ( count = 0 ; count < 12 ; count++ ){
                cal_dat2.holiday_w[count] = (unsigned char)0x80 ; 
        }

        /*set calendar information for 3 years */ 
        set_cal_dat2( &cal_dat2 ) ; 

        /*calendar update */ 
        ret = Mp_SetCalendar2( "Test Pro", "calendar_1", &cal_dat2 ) ;

        printf( "ret= %d\n", ret ) ;

        exit ( 0 ) ;

}