 |
» |
|
 |
|
 |

Copyright (c) Digital Equipment Corporation 1985, 1991. All rights reserved
PRODUCT: VAX PASCAL OP/SYS: VMS
SOURCE: Digital Customer Support Center
OVERVIEW:
The following sample program demonstrates how to pass an array of words
to a PL/I subroutine.
*** CAUTION ***
This sample program has been tested using VAX PASCAL, version 4.2 on
VMS, version 5.4. However, we cannot guarantee its effectiveness because
of the possibility of error 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 key in the following example is that PL/I is looking for an array
descriptor of class_nca (non-contigious-array). Page 2-31 of the
"Introduction to System Routines" (June 90) describes the noncontiguous
array descriptor. Pascal will build this descriptor by using the
[class_nca] attribute. Please refer to the "VAX PASCAL Reference Manual"
(Dec 89), page 10-12 for more information on class_nca descriptors.
The following command file will create two programs that demonstrate
passing a array from a PASCAL program to a PL/I program.
COMMAND FILE:
$set verify
$create pas_main.pas
PROGRAM FILTER;
TYPE
UWORD = [word] 0..65535;
byte = [byte] 0..255;
ARRA256 = ARRAY [0..255] of uword;
VAR
I : INTEGER;
LOAD_VLT : ARRA256;
PROCEDURE MY$PLI (LOAD_VLT :[class_nca] arra256);EXTERN;
BEGIN
FOR I := 0 TO 255 DO
LOAD_VLT[I] := 1;
MY$PLI(load_vlt);
END.
$create pli_sub.pli
MY$PLI : PROCEDURE (ARRAY);
DCL ARRAY (*) FIXED BIN (15);
DCL I FIXED BIN (15);
DO I= LBOUND (ARRAY,1) TO HBOUND (ARRAY,1);
PUT SKIP LIST ('I IS ',I,'VALUE IS ', ARRAY(I));
END;
END MY$PLI;
$pas pas_main
$pli pli_sub
$link pas_main,pli_sub
$exit_out:
$set noverify
$run pas_main
|
buy online or call 1.800.AT.COMPAQ
|
|