Calls to CEE3CTY, CEEFMDT, and CEEDATM in C

This example illustrates how you would query the default country code (CEE3CTY), change it to another country code (CEE3CTY), get the default date and time in the new country code (CEEFMDT), and convert the seconds to a timestamp (CEEDATM).
/*Module/File Name: EDCNLS */
/**********************************************************************/
/* FUNCTION                                                           */
/*             CEE3CTY   : query default country. set country to      */
/*                       : Germany.                                   */
/*             CEEFMDT   : get the German date and time format        */
/*             CEEDATM   : convert seconds to timestamp               */
/*                                                                    */
/* This example shows how to use several of the LE national           */
/* language support callable services. The current country is queried */
/* and changed to Germany. The default date and time for Germany is   */
/* obtained. CEEDATM is called to convert a large numeric value in    */
/* seconds to the timestamp 16.05.1988 19:01:01.                      */
/**********************************************************************/
#include <stdio.h>
#include <string.h>
#include <leawi.h>
#include <stdlib.h>
#include <ceeedcct.h>

int main(void) {

  _FEEDBACK fc;
  _INT4 function;
  _CHAR2 country, symbol;
  _CHAR80 date_pic;
  _FLOAT8 seconds;
  _VSTRING  picstr;
  _CHAR80 timestp;
  #define DE  "DE"
  #define BL  "  "

  printf ( "\n**********************************\n");
  printf ( "CESCNLS C Example is now in motion");
  printf ( "\n**********************************\n");

  /*****************************************************/
  /* Call CEE3CTY to query the current country setting */
  /*****************************************************/
  function = 2;
  CEE3CTY(&function,country,&fc);
  if ( (_FBCHECK (fc , CEE000)) != 0 ) {
     printf("CEE3CTY failed with message number %d\n",fc.tok_msgno);
     exit(2999);
  }

  /*****************************************************/
  /* Call CEE3CTY to set current country to Germany.   */
  /*****************************************************/
  function = 3;
  CEE3CTY(&function,DE,&fc);
  if ( (_FBCHECK (fc , CEE000)) != 0 ) {
     printf("CEE3CTY failed with message number %d\n",fc.tok_msgno);
     exit(2999);
  }
  /**************************************************************/
  /* Call CEEFMDT retrieve the default date and time format     */
  /**************************************************************/
  CEEFMDT(BL,date_pic,&fc);
  if ( (_FBCHECK (fc , CEE000)) != 0 ) {
     printf("CEEFMDT failed with message number %d\n",fc.tok_msgno);
     exit(2999);
  }
  /**************************************************************/
  /* Call CEEDATM to convert the number of seconds from 12:00AM */
  /* October 14, 1582 to 7:01PM May 16, 1988 to character       */
  /* format. The default date and time format matches that of   */
  /* the default country, Germany.                              */
  /**************************************************************/
  seconds = 12799191661.986;
  strcpy(picstr.string,date_pic);
  picstr.length = strlen(picstr.string);
  CEEDATM ( &seconds , &picstr , timestp , &fc );
  if ( (_FBCHECK (fc , CEE000)) != 0 ) {
     printf("CEE3MDS failed with message number %d\n",fc.tok_msgno);
     exit(2999);
  }
  printf("Generated timestamp: %s",timestp);
  printf ("\n*********************\n");
  printf ("CESCNLS example ended.");
  printf ("\n*********************\n");
}