Oppolzer - Informatik / Blog


Blog-Hauptseite      Neuester Artikel      Älterer Artikel      Neuerer Artikel      Älterer gleiche Kategorie      Neuerer gleiche Kategorie

Hercules - Aufruf eines externen Unterprogramms in PL/1

Subject:

Re: [H390-VM] Re: PL/I Main Program calling an External Subroutine

From:

Bernd Oppolzer <bernd.oppolzer@T-ONLINE.DE>

Reply-To:

Date:

2013.03.23 13:48:00


I tested it myself:

type driver pli

 DRIVER: PROC OPTIONS(MAIN);
 DCL (A,B,C) FIXED BINARY(31);
 DCL C1 CHAR (15);
 /* THE FOLLOWING IS NEEDED TO GET THE ADDRESS OF C1
  AS A BINARY VALUE INTO BINADRC1 */
 DCL ADRC1 PTR;
 DCL BINADRC1 BIN FIXED (31) BASED (PXX);
 DCL PXX PTR;
 PXX = ADDR(ADRC1);
 ADRC1 = ADDR (C1);
 DCL DESC1 BIN FIXED (31);
 DCL DESC2 BIN FIXED (31);
 C1 = 'TEST DESCRIPTOR';
 /* CALL ARITH(A,B,C);*/
 CALL SHOWDES (C1, DESC1, DESC2);
 PUT SKIP LIST (C1);
 PUT SKIP LIST ('FIRST DESC WORD = ' || DESC1);
 PUT SKIP LIST ('SECOND DESC WORD = ' || DESC2);
 PUT SKIP LIST ('ADDR(C1) = ' || BINADRC1);
 END DRIVER;

Ready; T=0.01/0.02 14:41:45

type showdes assemble

SHOWDES  CSECT
         STM   14,12,12(13)
         BALR  12,0
         USING *,12
         LM    2,4,0(1)  LOAD THE ADDRESSES OF PARAMETERS IN REGS
*
*        REG 2 POINTS TO THE CHAR DESCRIPTOR
*        STORE THE TWO WORDS OF THE CHAR DESCRIPTOR
*        INTO THE SECOND AND THIRD PARAMETER
*
         L     5,0(2)
         ST    5,0(3)   SHOULD BE THE ADDRESS OF THE CHAR
         L     5,4(2)
         ST    5,0(4)   SHOULD BE THE ATTRIBUTES OF THE CHAR
*
         LM    14,12,12(13)
         BR    14
         END   SHOWDES

Ready; T=0.01/0.01 14:42:12

plicomp driver
FILEDEF * CLEAR
PLI DRIVER ( LIST XREF
    COMPILER DIAGNOSTICS.

 WARNINGS.
    IEM0227I          NO FILE/STRING OPTION SPECIFIED IN ONE OR MORE GET/PUT STA
TEMENTS. SYSIN/SYSPRINT HAS BEEN
                      ASSUMED IN EACH CASE.

 END OF DIAGNOSTICS.
+++ R(00004) +++
Ready; T=0.10/0.28 14:42:38
filedef * clear
Ready; T=0.01/0.01 14:42:45
assemble showdes

ASSEMBLER (XF) DONE
NO STATEMENTS FLAGGED IN THIS ASSEMBLY
Ready; T=0.02/0.07 14:42:52

load driver showdes
Ready; T=0.01/0.02 14:43:20
genmod driver
Ready; T=0.01/0.01 14:43:26
filedef sysprint term
Ready; T=0.01/0.01 14:43:36
driver


TEST DESCRIPTOR
FIRST DESC WORD =         145324
SECOND DESC WORD =         983055
ADDR(C1) =         145324
Ready; T=0.01/0.03 14:43:38


So the conclusion:

the first word of the CHAR descriptor contains the address of the char,
as it is until today.

the second word contains the length in the left halfword and in the right
halfword (both times 15 in this case). Gives 983055. This is different from
today and needs further examination, for example: what happens, if the
CHAR is VARYING ?

The problem is, that the ASSEMBLER subprograms need to know the
representation of the PL/1 descriptors, as long as you don't specify on
the ENTRY declaration that no descriptors be generated (if there is such
an option on this old PL/1 version).

Kind regards

Bernd





Am 23.03.2013 10:32, schrieb Bernd Oppolzer:
>
>
> Very nice, thank you. That saves me a lot of time checking out
> those inter language calls by myself.
>
> Do you have an idea how the PL/1 descriptors looked in those
> early days for character parameters, structures, tables? Is it
> different to, for examples, OS PL/1 V2.3 ?
>
> And: was it possible at that version already to declare an external
> entry to have no descriptors, for example by specifying
> DCL SUBSUM EXTERNAL ENTRY OPTIONS (ASM);
>
> Maybe you know - if not, no harm - I would have to read the
> old manuals and check it out by myself.
>
> Thank you, kind regards
>
> Bernd
>
>
>
> Am 23.03.2013 00:13, schrieb G.M.:
>>
>>
>> Things running pretty good now :)
>> Here's the same Driver now calling an assembler subroutine:
>>
>> *******************************************************************************
>> type driver pli
>>
>>  DRIVER: PROC OPTIONS(MAIN);
>>  DCL (A,B,C) FIXED BINARY(31);
>>  A = 5;
>>  B = 6;
>>  /* CALL ARITH(A,B,C);*/
>>  CALL SUBSUM(A,B,C);
>>  PUT SKIP LIST(A,B,C);
>>  END DRIVER;
>>
>> Ready; T=0.02/0.03 18:44:58
>>
>> type sum assemble
>>
>> SUBSUM   CSECT
>>          STM   14,12,12(13)
>>          BALR  12,0
>>          USING *,12
>>          LM    2,4,0(1)  LOAD THE ADDRESSES OF PARAMETERS IN REGS
>> *                                  2,3,4
>> *                                  0(2) POINTS TO LOCATION A
>> *                                  0(3) POINTS TO LOCATION B
>> *                                  0(4) POINTS TO LOCATION C
>> *
>>          L     7,0(2)    LOAD THE ACTUAL VALUE OF A IN REG 7
>>          A     7,0(3)    ADD THE CONTENTS OF REG 7 TO ACTUAL VALUE
>> *                                OF B
>>          ST    7,0(4)    STORE THE RESULT IN C
>>          LM    14,12,12(13)
>>          BR    14
>>          END   SUBSUM
>>
>> Ready; T=0.02/0.03 18:45:46
>>
>> pli driver
>>     COMPILER DIAGNOSTICS.
>>
>>  WARNINGS.
>>     IEM0227I          NO FILE/STRING OPTION SPECIFIED IN ONE OR MORE GET/PUT STA
>> TEMENTS. SYSIN/SYSPRINT HAS BEEN
>>                       ASSUMED IN EACH CASE.
>>
>>  END OF DIAGNOSTICS.
>> Ready(00004); T=0.28/0.33 18:46:25
>>
>> filedef * clear
>> Ready; T=0.01/0.01 18:47:36
>>
>> assemble sum
>>
>> ASSEMBLER (XF) DONE
>> NO STATEMENTS FLAGGED IN THIS ASSEMBLY
>> Ready; T=0.22/0.25 18:47:48
>>
>>
>> load driver sum
>> Ready; T=0.11/0.16 18:48:28
>>
>> start
>> DMSLIO740I Execution begins...
>>
>>              5                       6                      11
>> Ready; T=0.25/0.27 18:49:04
>> *******************************************************************************
>

Blog-Hauptseite      Neuester Artikel      Älterer Artikel      Neuerer Artikel      Älterer gleiche Kategorie      Neuerer gleiche Kategorie