How linker program?



High Level Assembler(HLASM) for MVS & VM & VSE

How linker program?

Postby michel123 » Wed Nov 23, 2011 4:56 pm

Hello,

I have a concern when the linkage of two related programs through a call.
I have a program P1 with a call to an entry point GDATA placed in a program SP2.

In P1 :
LA R13,SAVE1
CALL GDATE,(PARAM)

In SP2 :
SP2 CSECT
ENTRY GDATE
YREGS
*-------------------------------------------------------------------
GDATE SAVE (14,12),,SP2-&SYSDATE-&SYSTIME
LR R12,R15 R12=R15 : ADRESSE POINT D'ENTREE
USING SP2,R12
ST R13,SAVE2+4 ADRESSE SAVE APPELANT CHEZ NOUS
LA R11,SAVE2 R11 POINTE SUR NOTRE SAVE
ST R11,8(R13) ADRESSE NOTRE SAVE CHEZ APPELANT
DROP R15

compilation de SP2 :
//L.SYSIN DD
ENTRY GDATE
NAME SP2(R)
/*

compilation de P1
//L.SYSIN DD *
INCLUDE SYSLMOD(P1)
INCLUDE SYSLMOD(SP2)
NAME P1(R)
/*

The execution gives me a 0C1 !
michel123
 
Posts: 58
Joined: Tue Dec 28, 2010 12:28 am
Has thanked: 0 time
Been thanked: 0 time

Re: How linker program?

 

Re: How linker program?

Postby BillyBoyo » Wed Nov 23, 2011 5:16 pm

Try to use the Code tags to preserve formatted data. Highlight the text. Click on the Code button. Click on the Preview button to see what it will look like on the forum. Amend as necessary. Click on Submit when happy.

Presumably the S0C1 is on the call?

Can you post the output from the linkedit steps please?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: How linker program?

Postby michel123 » Wed Nov 23, 2011 5:27 pm

I gives again the code :

Prgramm P1 :

TRAIT    DS    0H
*
*        L     R15,=V(GDATE)
*        LA    R1,=A(PARAM)
         LA    R13,SAVE1
*        BALR  R14,R15
         CALL  GDATE,(PARAM)


Program P2 :
SP2      CSECT
         PRINT GEN                SPARE US THE MACRO EXPANSIONS
         ENTRY GDATE
         YREGS
*--------------------------------------------------------------------*
GDATE    SAVE  (14,12),,SP2-&SYSDATE-&SYSTIME
         LR    R12,R15            R12=R15 : ADRESSE POINT D'ENTREE
         USING SP2,R12
         ST    R13,SAVE2+4        ADRESSE SAVE APPELANT CHEZ NOUS
         LA    R11,SAVE2          R11 POINTE SUR NOTRE SAVE
         ST    R11,8(R13)         ADRESSE NOTRE SAVE CHEZ APPELANT
         DROP  R15
*--------------------------------------------------------------------*
*
INIT     DS    0H


And :

IEA995I SYMPTOM DUMP OUTPUT
SYSTEM COMPLETION CODE=0C1  REASON CODE=00000001
 TIME=05.44.08  SEQ=10271  CPU=0000  ASID=0026
 PSW AT TIME OF ERROR  078D0000   00007CF4  ILC 2  INTC 01
   ACTIVE LOAD MODULE           ADDRESS=00007A38  OFFSET=000002BC
   NAME=P1
   DATA AT PSW  00007CEE - E000100C  00000000  00009240
   AR/GR 0: 80C972CA/00000000_00000000   1: 00000000/00000000_00007CB4
         2: 00000000/00000000_00007B44   3: 00000000/00000000_009D09D4
         4: 00000000/00000000_009D09B0   5: 00000000/00000000_009FD098
         6: 00000000/00000000_009C0FE0   7: 00000000/00000000_FD000000
         8: 00000000/00000000_009F91C8   9: 00000000/00000000_009CED08
         A: 00000000/00000000_00000000   B: 00000000/00000000_00007D80
         C: 00000000/00000000_00007C68   D: 00000000/00000000_00007C0C
         E: 00000000/00000000_00007DD6   F: 00000000/00000003_00000000
 END OF SYMPTOM DUMP
IEF472I PG8997X P1 - COMPLETION CODE - SYSTEM=0C1 USER=0000 REASON=00000001
michel123
 
Posts: 58
Joined: Tue Dec 28, 2010 12:28 am
Has thanked: 0 time
Been thanked: 0 time

Re: How linker program?

Postby steve-myers » Wed Nov 23, 2011 5:56 pm

First, it is essentially impossible to place dump type data or Binder module map output in code tags. Don't try.

Second, with no Binder map, the indicative dump you tried to give us is basically useless.

Third, at least in concept, the entry linkage for GDATE is incorrect, though it may be correct in fact. Register 15 contains the address of GDATE, not SP2. It appears they are the same here so it should be OK.

Fourth, we have no idea how addressability in the program that called GDATE is setup, so that may well be the root cause of your problem, not GDATE in SP2.
steve-myers
Global moderator
 
Posts: 1887
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 198 times

Re: How linker program?

Postby BillyBoyo » Wed Nov 23, 2011 7:30 pm

Have you located the where the PSW is pointing in your program? It doesn't look like the "unresolved module" sort of S0C1.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: How linker program?

Postby michel123 » Wed Nov 23, 2011 10:14 pm

In point 4 of Steve, I have compiled as follows:

first the program SP2 :

//ASSEMBLE EXEC ASMACL
//C.SYSIN   DD DISP=SHR,DSN=PG8997.ASM.SOURCE(SP2)
//C.SYSLIB  DD DISP=SHR,DSN=SYS1.MACLIB
//          DD DISP=SHR,DSN=SYS1.MODGEN
//          DD DISP=SHR,DSN=PG8997.ASM.COPY
//L.SYSLMOD DD DISP=SHR,DSN=PG8997.BATCH.LOADLIB
//L.SYSIN   DD *
  ENTRY GDATE
  NAME SP2(R)
/*


Then the program P1 :

//ASSEMBLE EXEC ASMACL
//C.SYSIN   DD DISP=SHR,DSN=PG8997.ASM.SOURCE(P1)
//C.SYSLIB  DD DISP=SHR,DSN=SYS1.MACLIB
//          DD DISP=SHR,DSN=SYS1.MODGEN
//L.SYSLMOD DD DISP=SHR,DSN=PG8997.BATCH.LOADLIB
//L.SYSIN   DD *
  INCLUDE SYSLMOD(P1)
  INCLUDE SYSLMOD(SP2)
  NAME P1(R)
/*
michel123
 
Posts: 58
Joined: Tue Dec 28, 2010 12:28 am
Has thanked: 0 time
Been thanked: 0 time

Re: How linker program?

Postby steve-myers » Thu Nov 24, 2011 1:51 am

In the Binder control statements in the JCL to assemble and link P1 you should explicitly specify an entry point using an ENTRY statement as you did for SP2. It probably should be -

ENTRY P1

The INCLUDE SYSLMOD(P1) statement is unneeded, and most likely will cause an error. It's uneeded because the JCL has the effect of bringing the object output from the assembly into the Binder before any of the control statements are processed. It can cause an error in two ways:
  • The very first time you run the JCL, presumably there is no P1 module, so the INCLUDE statement will fail.
  • Afterwards, the INCLUDE statement will load modules P1 and SP2 (which may be in load module P1). Since the Binder already knows about SP2 it will effectively ignore the INCLUDE SYSLMOD(SP2) statement. More accurately, it will ignore module SP2 in the SP2 load module specified by the INCLUDE statement.
steve-myers
Global moderator
 
Posts: 1887
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 198 times


Return to Assembler

 


  • Related topics
    Replies
    Views
    Last post