 |
» |
|
 |
|
 |

Copyright (c) Digital Equipment Corporation 1989. All rights reserved
LAYERED PRODUCT or COMPONENT: PLI V3.2 OP/SYS: VMS V5.0
SOURCE: Digital Customer Support Center
OVERVIEW:
This program shows how to use LIB$MOVTC with a user-provided table.
CAUTION: This sample program has been tested using:
PRODUCT: PL1 V3.2 on OPERATING SYSTEM: VMS V5.0
However, we cannot guarantee its effectiveness because of the possibility of
errors in transmitting or implementing it. It is meant to be used as a
template for writing your own program, and it may require modification for use
on your system.
PROGRAM NOTES:
The program builds it own table for conversion of the character string.
In building the table, the following is used to determine how the individual
fields are to be used. The numbers 0 through 9 are converted to '#'.
In order to determine the offset, note that an ASCII 0 equates to a decimal
48, so the 48th byte in the user table is set to the required conversion
character.
PROGRAM SAMPLE:
st: proc options(main);
%include LIB$MOVTC;
%include $STSDEF;
%include $SSDEF;
%include $DSCDEF;
dcl old_string char(10) init('012ABCabc-');
dcl new_string char(10);
dcl filler char(1) init(' ');
dcl 01 table_descriptor,
05 desc_length fixed bin(15) init(256),
05 desc_class_length,
10 desc_type fixed bin(7),
10 desc_class fixed bin(7),
05 desc_pointer pointer;
dcl usertable(256) char(1);
dcl i fixed bin(31);
/* A - Z will translate to C
a - z will translate to l
0 - 9 will translate to #
default S */
do i = 1 to 256;
usertable(i) = 'S';
if i > 47 & i < 57
then usertable(i) = '#';
if i > 64 & i < 91
then usertable(i) = 'C';
if i > 96 & i < 123
then usertable(i) = 'l';
end;
desc_type = dsc$k_dtype_t;
desc_class = dsc$k_class_s;
desc_pointer = addr(usertable);
sts$value = LIB$MOVTC(old_string,filler,ref(table_descriptor),
new_string);
if ^sts$success
then signal vaxcondition(sts$value);
put skip list ('The old string: ', old_string);
put skip list ('The new string: ', new_string);
end st;
|
buy online or call 1.800.AT.COMPAQ
|
|