| Title: | PL/I Notes |
| Moderator: | PEROIT::LUCIA |
| Created: | Sat Jan 25 1986 |
| Last Modified: | Wed May 14 1997 |
| Last Successful Update: | Fri Jun 06 1997 |
| Number of topics: | 707 |
| Total number of notes: | 2472 |
Hi,
Same customer as note #700. In this case they are trying to use the
preprocessor. When trying to do a compile, using the preprocessor procedure
%BYTE_CHAR under OpenVMS/VAX, they have no problem at all. But when they
try to do it under OpenVMS/Alpha, they receive the following set of error
messages:
%PLIG-E-BADTEXTEND, (1) Invalid end of text. Check for unbalanced apostrophes or
unbalanced comments. This line is the first incorrect line.
%PLIG-W-ENDGIVEN, (1) An END statement has been supplied to close a DO-group,
SELECT-group, begin block, or procedure.
%PLIG-E-BADPAREN, (1) This statement contains unbalanced parentheses.
%PLIG-E-STMTSYNTOK, (1) Invalid syntax in a "END" statement.
A ") " was found where
a ";" was expected.
The information about the VAX in this case is:
Host: MicroVAX 3100-95
OpenVMS: v5.5-2H4
PL/I: v3.5-124
The information about the Alpha in this case is:
Host: AlphaStation 200 4/100
OpenVMS: v6.2-1H1
PL/I: v4.0a-1
A listing of the Alpha compile is attached to this note as Reply .1, and
a listing of the VAX compile is attached as Reply .2.
Any help in figuring out what the problem is would be appreciated.
Thanks,
Doug
The following is a sample source file:
/******************************************************************************/
/******************************************************************************/
Original PL/I source file.
/******************************************************************************/
/******************************************************************************/
/*==== INCLUDE FILES ====*/
%include textrtl; /* TEXT run time library */
/*==== CONSTANTS ====*/
%include $ssdef;
%replace true by '1'b;
%replace false by '0'b;
/*==== EXTERNAL PROCEDURES ====*/
%include run_time_library; /* Run time library declarations */
/*==== EXTERNAL VARIABLES ====*/
%byte_char: procedure (char_num) returns( character );
/*==== LOCAL VARIABLES ====*/
%declare
char_num fixed;
/*==== begin %byte_char ====*/
%if char_num ^= 39
%then
return('''' || byte (char_num) || '''');
%else
return('''' || '''''' || '''');
%end;
text_check_valid_string: procedure ( string_table, test_string,
flags, expanded_string, position) returns( fixed binary(31) );
/*==== CONSTANTS ====*/
%replace backslash by '\';
/*==== EXTERNAL PROCEDURES ====*/
declare
str$case_blind_compare entry (character(*), character(*))
returns (fixed binary(31)),
str$compare entry (character(*), character(*))
returns (fixed binary(31));
/*==== PARAMETERS ====*/
declare
expanded_string character(*),
flags bit(32) aligned,
position fixed binary(31),
string_table(*) character(*),
test_string character(*);
/*==== LOCAL VARIABLES ====*/
declare
1 table(hbound(string_table, 1)),
2 string character(length(string_table(1))),
2 signif_chars fixed binary(15);
declare
bs_position fixed binary(15), /* position of backslash */
i fixed binary(15), /* index */
j fixed binary(15), /* index */
last_occupied_element fixed binary(15), /* real size of table */
result fixed binary(15), /* result of string compare */
size fixed binary(15), /* size of a string */
table_size fixed binary(15), /* # of entries in table */
/* working vsn of test_string */
work_string character(length(string_table(1))),
work_string_length fixed binary(15); /* size of work string */
/*==== begin text_check_valid_string ====*/
expanded_string = ''; /* Default (returned if no match) */
position = 0; /* Default (returned if no match) */
/*
* Strip leading blanks from test_string
*/
work_string = trim(test_string);
work_string_length = max( length( trim(work_string) ), 1);
/* Massage string_table data and copy into table.string: strip off */
/* leading blanks, remove backslash character, note number of */
/* significant characters for compares. If any string is invalid */
/* or contains an ambiguity, signal ss$_badparam with lib$stop. */
table_size = hbound(string_table, 1);
if (table_size < 1) then call stop_invalid_string_table;
last_occupied_element = 0;
do i = 1 to table_size;
end;
stop_invalid_string_table: procedure;
/*
* Signal ss$_badparam condition
*/
call lib$stop( ss$_badparam );
end stop_invalid_string_table;
end text_check_valid_string;
/******************************************************************************/
text_denull: procedure(in_string, out_string);
/*==== PARAMETERS ====*/
declare
in_string character(*),
out_string character(*);
/*==== EXTERNAL PROCEDURES ====*/
declare
lib$movtc entry (character(*), character(*),
character(*), character(*));
/*==== EXTERNAL VARIABLES ====*/
declare
denull_table_init (3) character(1) static readonly init(
byte_char(0),
byte_char(1),
byte_char(2)),
denull_table character(3) based(addr(denull_table_init));
/*==== begin text_denull ====*/
if present (out_string) then
call lib$movtc (in_string, ' ', denull_table, out_string);
else
call lib$movtc (in_string, ' ', denull_table, in_string);
end text_denull;
| T.R | Title | User | Personal Name | Date | Lines |
|---|---|---|---|---|---|
| 701.1 | Alpha Compile Listing | NQOS01::16.90.48.218::burke | Mon Feb 03 1997 17:56 | 198 | |
/******************************************************************************/
/******************************************************************************/
PL/I listing from AlphaStation.
/******************************************************************************/
/******************************************************************************/
TEXT_CHECK_VALID_STRING Source Listing 3-JUN-1996 08:11:19
DEC PL/I V4.0A-1 Page 1
01 3-JUN-1996 08:09:13
DD1:[INCDEV.TEST]WAL.PLI;11
1
| 2 /*==== INCLUDE FILES ====*/
3
4 %include textrtl; /* TEXT run time library */
77
| 78 /*==== CONSTANTS ====*/
79
80 %include $ssdef;
1516
1517 %replace true by '1'b;
1518 %replace false by '0'b;
1519
| 1520 /*==== EXTERNAL PROCEDURES ====*/
1521
1522 %include run_time_library; /* Run time library declarations */
1661
| 1662 /*==== EXTERNAL VARIABLES ====*/
1663
1664 %byte_char: procedure (char_num) returns( character );
1665
| 1666 /*==== LOCAL VARIABLES ====*/
1667
1668 %declare
P 1669 char_num fixed;
1670
| 1671 /*==== begin %byte_char ====*/
1672
1673 %if char_num ^= 39
P 1674 %then
P 1675 return('''' || byte (char_num) || '''');
1676 %else
P 1677 return('''' || '''''' || '''');
P 1678 %end;
1679
1680
1681 text_check_valid_string: procedure ( string_table, test_string,
1682 flags, expanded_string, position) returns( fixed binary(31) );
1 1683
| 1 1684 /*==== CONSTANTS ====*/
1 1685
1 1686 %replace backslash by '\';
1 1687
| 1 1688 /*==== EXTERNAL PROCEDURES ====*/
1 1689
1 1690 declare
1 1691 str$case_blind_compare entry (character(*), character(*))
1 1692 returns (fixed binary(31)),
1 1693 str$compare entry (character(*), character(*))
1 1694 returns (fixed binary(31));
1 1695
| 1 1696 /*==== PARAMETERS ====*/
1 1697
1 1698 declare
1 1699 expanded_string character(*),
1 1700 flags bit(32) aligned,
1 1701 position fixed binary(31),
1 1702 string_table(*) character(*),
TEXT_CHECK_VALID_STRING Source Listing 3-JUN-1996 08:11:19
DEC PL/I V4.0A-1 Page 2
01 3-JUN-1996 08:09:13
DD1:[INCDEV.TEST]WAL.PLI;11
1 1703 test_string character(*);
1 1704
| 1 1705 /*==== LOCAL VARIABLES ====*/
1 1706
1 1707 declare
1 1708 1 table(hbound(string_table, 1)),
1 1709 2 string character(length(string_table(1))),
1 1710 2 signif_chars fixed binary(15);
1 1711
1 1712 declare
1 1713 bs_position fixed binary(15), /* position of backslash
*/
1 1714 i fixed binary(15), /* index */
1 1715 j fixed binary(15), /* index */
1 1716 last_occupied_element fixed binary(15), /* real size of table */
1 1717 result fixed binary(15), /* result of string
compare */
1 1718 size fixed binary(15), /* size of a string */
1 1719 table_size fixed binary(15), /* # of entries in table
*/
| 1 1720 /* working vsn of
test_string */
1 1721 work_string character(length(string_table(1))),
1 1722 work_string_length fixed binary(15); /* size of work string
*/
1 1723
| 1 1724 /*==== begin text_check_valid_string ====*/
1 1725
1 1726 expanded_string = ''; /* Default (returned if no match) */
1 1727 position = 0; /* Default (returned if no match) */
1 1728
| 1 1729 /*
| 1 1730 * Strip leading blanks from test_string
| 1 1731 */
1 1732
1 1733 work_string = trim(test_string);
1 1734 work_string_length = max( length( trim(work_string) ), 1);
1 1735
| 1 1736 /* Massage string_table data and copy into table.string: strip off */
| 1 1737 /* leading blanks, remove backslash character, note number of */
| 1 1738 /* significant characters for compares. If any string is invalid */
| 1 1739 /* or contains an ambiguity, signal ss$_badparam with lib$stop. */
1 1740
1 1741 table_size = hbound(string_table, 1);
1 1742 if (table_size < 1) then call stop_invalid_string_table;
1 1743
1 1744 last_occupied_element = 0;
1 1745 do i = 1 to table_size;
1 1746 end;
1 1747
1 1748 stop_invalid_string_table: procedure;
1 1749
| 1 1750 /*
| 1 1751 * Signal ss$_badparam condition
| 1 1752 */
1 1753
1 1754 call lib$stop( ss$_badparam );
1 1755
1 1756 end stop_invalid_string_table;
1 1757
1 1758 end text_check_valid_string;
1759
TEXT_CHECK_VALID_STRING Source Listing 3-JUN-1996 08:11:19
DEC PL/I V4.0A-1 Page 3
01 3-JUN-1996 08:09:13
DD1:[INCDEV.TEST]WAL.PLI;11
| 1760
/******************************************************************************/
1761
1762 text_denull: procedure(in_string, out_string);
1 1763
| 1 1764 /*==== PARAMETERS ====*/
1 1765
1 1766 declare
1 1767 in_string character(*),
1 1768 out_string character(*);
1 1769
| 1 1770 /*==== EXTERNAL PROCEDURES ====*/
1 1771
1 1772 declare
1 1773 lib$movtc entry (character(*), character(*),
1 1774 character(*), character(*));
1 1775
| 1 1776 /*==== EXTERNAL VARIABLES ====*/
1 1777
1 1778 declare
1 1779 denull_table_init (3) character(1) static readonly init(
1 1780 byte_char(0),
1 1781 byte_char(1),
1 1782 byte_char(2)),
1 1783
1 1784 denull_table character(3) based(addr(denull_table_init));
1 1785
1 1786 /*==== begin text_denull ====*/
1 1787
1 1788 if present (out_string) then
1 1789 call lib$movtc (in_string, ' ', denull_table, out_string);
1 1790 else
1 1791 call lib$movtc (in_string, ' ', denull_table, in_string);
1 1792
1 1793 end text_denull;
1
%PLIG-E-BADTEXTEND, (1) Invalid end of text. Check for unbalanced apostrophes or
unbalanced comments. This line is the first incorrect line.
%PLIG-W-ENDGIVEN, (1) An END statement has been supplied to close a DO-group,
SELECT-group, begin block, or procedure.
%PLIG-E-BADPAREN, (1) This statement contains unbalanced parentheses.
%PLIG-E-STMTSYNTOK, (1) Invalid syntax in a "END" statement.
A ") " was found where
a ";" was expected.
COMMAND LINE
------- ----
PLI/CHECK/LIS WAL
| |||||
| 701.2 | VAX Compile Listing | NQOS01::16.90.48.218::burke | Mon Feb 03 1997 17:58 | 187 | |
/******************************************************************************/
/******************************************************************************/
PL/I listing from MicroVAX.
/******************************************************************************/
/******************************************************************************/
TEXT_CHECK_VALID_STRING 3-JUN-1996 08:08:08
VAX PL/I V3.5-124 Page 1
01 3-JUN-1996 08:08:05
US8:[DEV.EW]WAL.PLI;13 (1)
1
2 | /*==== INCLUDE FILES ====*/
3
4 %include textrtl; /* TEXT run time library */
77
78 | /*==== CONSTANTS ====*/
79
80 %include $ssdef;
891
892 %replace true by '1'b;
893 %replace false by '0'b;
894
895 | /*==== EXTERNAL PROCEDURES ====*/
896
897 %include run_time_library; /* Run time library declarations */
1036
1037 | /*==== EXTERNAL VARIABLES ====*/
1038
1039 %byte_char: procedure (char_num) returns( character );
1040
1041 | /*==== LOCAL VARIABLES ====*/
1042
1043 %declare
1044 P char_num fixed;
1045
1046 | /*==== begin %byte_char ====*/
1047
1048 %if char_num ^= 39
1049 P %then
1050 P return('''' || byte (char_num) || '''');
1051 %else
1052 P return('''' || '''''' || '''');
1053 P %end;
1054
1055
1056 text_check_valid_string: procedure ( string_table, test_string,
1057 flags, expanded_string, position) returns( fixed binary(31) );
1058 1
1059 | 1 /*==== CONSTANTS ====*/
1060 1
1061 1 %replace backslash by '\';
1062 1
1063 | 1 /*==== EXTERNAL PROCEDURES ====*/
1064 1
1065 1 declare
1066 1 str$case_blind_compare entry (character(*), character(*))
1067 1 returns (fixed binary(31)),
1068 1 str$compare entry (character(*), character(*))
1069 1 returns (fixed binary(31));
1070 1
1071 | 1 /*==== PARAMETERS ====*/
1072 1
1073 1 declare
1074 1 expanded_string character(*),
1075 1 flags bit(32) aligned,
TEXT_CHECK_VALID_STRING 3-JUN-1996 08:08:08
VAX PL/I V3.5-124 Page 2
01 3-JUN-1996 08:08:05
US8:[DEV.EW]WAL.PLI;13 (1)
1076 1 position fixed binary(31),
1077 1 string_table(*) character(*),
1078 1 test_string character(*);
1079 1
1080 | 1 /*==== LOCAL VARIABLES ====*/
1081 1
1082 1 declare
1083 1 1 table(hbound(string_table, 1)),
1084 1 2 string character(length(string_table(1))),
1085 1 2 signif_chars fixed binary(15);
1086 1
1087 1 declare
1088 1 bs_position fixed binary(15), /* position of backslash
*/
1089 1 i fixed binary(15), /* index */
1090 1 j fixed binary(15), /* index */
1091 1 last_occupied_element fixed binary(15), /* real size of table */
1092 1 result fixed binary(15), /* result of string
compare */
1093 1 size fixed binary(15), /* size of a string */
1094 1 table_size fixed binary(15), /* # of entries in table
*/
1095 | 1 /* working vsn of
test_string */
1096 1 work_string character(length(string_table(1))),
1097 1 work_string_length fixed binary(15); /* size of work string
*/
1098 1
1099 | 1 /*==== begin text_check_valid_string ====*/
1100 1
1101 1 expanded_string = ''; /* Default (returned if no match) */
1102 1 position = 0; /* Default (returned if no match) */
1103 1
1104 | 1 /*
1105 | 1 * Strip leading blanks from test_string
1106 | 1 */
1107 1
1108 1 work_string = trim(test_string);
1109 1 work_string_length = max( length( trim(work_string) ), 1);
1110 1
1111 | 1 /* Massage string_table data and copy into table.string: strip off */
1112 | 1 /* leading blanks, remove backslash character, note number of */
1113 | 1 /* significant characters for compares. If any string is invalid */
1114 | 1 /* or contains an ambiguity, signal ss$_badparam with lib$stop. */
1115 1
1116 1 table_size = hbound(string_table, 1);
1117 1 if (table_size < 1) then call stop_invalid_string_table;
1118 1
1119 1 last_occupied_element = 0;
1120 1 do i = 1 to table_size;
1121 2 end;
1122 1
1123 1 stop_invalid_string_table: procedure;
1124 2
1125 | 2 /*
1126 | 2 * Signal ss$_badparam condition
1127 | 2 */
1128 2
1129 2 call lib$stop( ss$_badparam );
1130 2
1131 2 end stop_invalid_string_table;
1132 1
TEXT_CHECK_VALID_STRING 3-JUN-1996 08:08:08
VAX PL/I V3.5-124 Page 3
01 3-JUN-1996 08:08:05
US8:[DEV.EW]WAL.PLI;13 (1)
1133 1 end text_check_valid_string;
1134
1135 |
/******************************************************************************/
1136
1137 text_denull: procedure(in_string, out_string);
1138 1
1139 | 1 /*==== PARAMETERS ====*/
1140 1
1141 1 declare
1142 1 in_string character(*),
1143 1 out_string character(*);
1144 1
1145 | 1 /*==== EXTERNAL PROCEDURES ====*/
1146 1
1147 1 declare
1148 1 lib$movtc entry (character(*), character(*),
1149 1 character(*), character(*));
1150 1
1151 | 1 /*==== EXTERNAL VARIABLES ====*/
1152 1
1153 1 declare
1154 1 denull_table_init (3) character(1) static readonly init(
1155 1 byte_char(0),
1156 1 byte_char(1),
1157 1 byte_char(2)),
1158 1
1159 1 denull_table character(3) based(addr(denull_table_init));
1160 1
1161 | 1 /*==== begin text_denull ====*/
1162 1
1163 1 if present (out_string) then
1164 1 call lib$movtc (in_string, ' ', denull_table, out_string);
1165 1 else
1166 1 call lib$movtc (in_string, ' ', denull_table, in_string);
1167 1
1168 1 end text_denull;
COMMAND LINE
------- ----
PLI/CHECK/LIS WAL
| |||||
| 701.3 | SPECXN::DERAMO | Dan D'Eramo | Mon Feb 03 1997 19:34 | 12 | |
Doug,
Ed already reported this to the CSC as C960603-2584 and it has
been elevated to engineering:
> SYMPTOM:
>
> A PL/I program on OpenVMS Alpha that uses a compile-time
> preprocessor %PROCEDURE to quote the NUL character (ascii 0)
> does not compile.
Dan
| |||||
| 701.4 | NQOS01::seodan.seo.dec.com::burke | Tue Feb 04 1997 22:08 | 8 | ||
Dan, Thanks again. From discussion with Ed, he did not know the status of this issue...and it was getting very old (over six months). I'll let him know it made it to engineering. Doug | |||||