Guardian Programmer's Guide

Table Of Contents
Formatting and Manipulating Character Data
Guardian Programmer’s Guide 421922-014
19 - 64
Sample Program
!------------------------------------------------------------
! Procedure to open the terminal file specified in the IN
! file of the Startup message and check that multibyte
! character sets are supported. The program stops if
! multibyte character sets are not supported.
!------------------------------------------------------------
PROC INITIALIZE^TERMINAL;
BEGIN
INT(32) RESULT;
STRING .S^PTR;
STRING .BUFFER[0:71];
STRING .TERM^NAME;
INT TERMLEN;
INT ERROR;
! Read and save the Startup message:
CALL INITIALIZER(!rucb!,
!passthru!,
SAVE^STARTUP^MESSAGE);
! Open the IN file:
ERROR := OLDFILENAME_TO_FILENAME_(
CI^STARTUP.INFILE.VOLUME,
TERM^NAME:MAXFLEN,TERMLEN);
IF ERROR <> 0 THEN CALL PROCESS_STOP_(!process^handle!,
!specifier!,
ABEND);
ERROR := FILE_OPEN_(TERM^NAME:TERMLEN,TERM^NUM);
IF ERROR <> 0 THEN CALL PROCESS_STOP_(!process^handle!,
!specifier!,
ABEND);
! Check that multibyte characters are supported:
RESULT := MBCS_CODESETS_SUPPORTED_;
IF RESULT = 0D THEN
BEGIN
BUFFER ':=' "Character Set Not Supported" -> @S^PTR;
CALL WRITEX(TERM^NUM,BUFFER,@S^PTR '-' @BUFFER);
IF <> THEN CALL PROCESS_STOP_(!process^handle!,
!specifier!,
ABEND);
END;
END;