Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Compiling and linking Assembler modules

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
View previous topic :: :: View next topic  
Author Message
k_rajesh

New User


Joined: 14 May 2010
Posts: 14
Location: hyd

PostPosted: Thu Jan 20, 2011 12:20 am    Post subject: Compiling and linking Assembler modules
Reply with quote

Hi, I am using the below JCL to compile and Link edit a program A which calls program B. I compiled program B first and then when I am compiling program A, A is not able to reference B. Please help.


I need your help in proper compilation of Assembler module A calling another module B:

//USERLIB JCLLIB ORDER='SYS1.ADMIN.PROCLIB'
//STEP010 EXEC ASMACL,MEMBER=PGMA,
// SRCELIB=USERID.SRCELIB,
// LOADLIB=USERID.LOADLIB
//SYSLIB DD DISP=SHR,DSN=USERID.MACLIB
// DD DISP=SHR,DSN=SYS1.MACLIB
// DD DISP=SHR,DSN=SYS1.MODGEN
//LKED.SYSLIB DD DISP=SHR,DSN=USERID.LOADLIB


I am getting the following message when compiling PGMA which calls PGMB.

BATCH EMULATOR JOB(R01681C ) STEP(STEP010 ) PGM= HEWL PROCEDURE(LKED )
IEW2278I B352 INVOCATION PARAMETERS - MAP,LET,LIST,NCAL

IEW2454W 9203 SYMBOL PGMB UNRESOLVED. NO AUTOCALL (NCAL) SPECIFIED.
IEW2650I 5102 MODULE ENTRY NOT PROVIDED. ENTRY DEFAULTS TO SECTION PGMA.

The related PGMA has the following code along with standard house keeping:

** CALL PGMB
L R15,=V(PGMB)
BASR R14,R15

I did not define any other variable related to PGMB in PGMA.

PGMB CSECT
ENTRY HOUSE KEEPING
WTO '* PGMY IS STARTING...'
EXIT HOUSE KEEPING.

I tried my luck by going ahead and running. It ABENDED with S0C1 and R15 is filled with zeroes.

Please help me in calling PGMB from PGMA.
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7931
Location: Bellevue, IA

PostPosted: Thu Jan 20, 2011 12:30 am    Post subject:
Reply with quote

In the compile JCL for PGMA, you need:

Code:
//LKED.SYSIN DD *
  INCLUDE SYSLMOD(PGMB)
/*
Using the V-type constant means you need to tell the linkage editor / binder where PGMB is coming from so it can be linked into the PGMA load module. This is what is meant by
Quote:
IEW2454W 9203 SYMBOL PGMB UNRESOLVED. NO AUTOCALL (NCAL) SPECIFIED.
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 991
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Thu Jan 20, 2011 1:07 pm    Post subject:
Reply with quote

Or, alternatively, assemnle/link PGMA specifying ",PARM.LKED=(LIST,XREF)' . The NCAL parameter specified in your procedure tells the linkage editor not to resolve external references.

Garry.
Back to top
View user's profile Send private message
k_rajesh

New User


Joined: 14 May 2010
Posts: 14
Location: hyd

PostPosted: Fri Jan 21, 2011 10:29 pm    Post subject: Reply to: Compiling and linking Assembler modules
Reply with quote

Hi Frens,

Thanks to your help I was able to come out of compilation hickups and call program B from A. I also learnt few lessons hard way. Plz confirm if they are correct:

1. When you use single JCL to compile and Link edit the modules (ASMACL) then in an A calling B scenario if changes are made in B they will not be reflected at run time unless B is compiled and Linked first. PGM a shuld also be compiled and link ed as A is calling B.

2. The best way to shoot ones leg in Assembler is to use WTO's recklessly, especially in the called pgm. WTOs tend to corrupt R1 and R2 where in R1 holds the parameter list address.

Lastly :

+IHB0017B DC V(PGMY)
+ LA 1,IHB0019
+ B IHB0019A
+IHB0019 DS 0F
+ DC A(PARM01)
+ DC A(PARM02)
+ DC A(PARM03)
+ DC A(PARM04+X'80000000')

I am calling PGMY with 4 parms and it is getting expanded as shown above.

I see that X'80000000' is placed at the end while compiling. Is it to help us determine end of parameter list in the called module??

Thanks for your help.

Munni.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7931
Location: Bellevue, IA

PostPosted: Fri Jan 21, 2011 10:55 pm    Post subject:
Reply with quote

In assembler, when calling a subprogram, the high-order bit being set to one indicates the end of the parameter list.

One of the reasons for using dynamically called programs is so you don't have to recompile the calling program every time you change the called program. With a statically called program, changing the called program means you have to recompile the called AND calling programs.

Many production environments only allow a programmer to use a WTO by management approval, which is another reason not to use them.
Back to top
View user's profile Send private message
Ronald Burr

Active User


Joined: 22 Oct 2009
Posts: 293
Location: U.S.A.

PostPosted: Fri Jan 21, 2011 11:25 pm    Post subject:
Reply with quote

Robert Sample wrote:
With a statically called program, changing the called program means you have to recompile the called AND calling programs.

Not necessarily. You could just recompile the called program and then do a rebind(link-edit) of the statically-liked executable indicating your desire to replace the called module in the new executable.
For example, if PGMA is the main module in the statically-linked executable, PGMB is the called module that is being recompiled, and PGME is the name of the statically-linked executable, then the following SYSIN to the binder(link-edit) step would build the new, statically-linked executable (PGME) without having to recompile any modules other than PGMB:
Code:
//SYSIN DD *
REPLACE PGMB
INCLUDE XLIB(PGME)
INCLUDE OBJMOD
ENTRY PGMA
NAME PGME(R)
/*

where XLIB is the DDNAME pointing to the library where the "old" executable resides, and OBJMOD is the DDNAME pointing to the object output of the recompile of PGMB.

This technique is most useful when one does not have the source for one or more of the modules contained in a statically-linked executable. Not something to be used casually, but mighty handy when required.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7931
Location: Bellevue, IA

PostPosted: Fri Jan 21, 2011 11:45 pm    Post subject:
Reply with quote

Ronald -- true, but it depends upon what was changed in the called program. When the change affects one of the varaibles going between the program, such as a length change, recompiling both programs will keep them synchronized.
Back to top
View user's profile Send private message
Ronald Burr

Active User


Joined: 22 Oct 2009
Posts: 293
Location: U.S.A.

PostPosted: Sat Jan 22, 2011 12:27 am    Post subject:
Reply with quote

True, Robert - and a very good point, indeed.

Also, I realized, after it was too late to edit my post, that what I posted is not 100% correct, anyway. I SHOULD have stated in the example I provided that PGMA was the main ENTRY point for the statically-linked executable (PGME), not the main MODULE in the executable. Entry points (PROGRAM-ID's or CSECT's) in statically-linked executables do not have to equate to the actual name of a load/object module in the executable, as would be a requirement in dynamically called modules.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts A not very Christmassy PL/I tale, wit... prino PL/I & Assembler 3 Mon Dec 26, 2016 1:01 am
No new posts IDMS/DC-COBOL program - SNAP error wh... rakeshsekar1987 IDMS/ADSO 5 Tue Sep 13, 2016 8:28 pm
No new posts Problem Compiling cobol code with Cob... amitc23 COBOL Programming 2 Wed Aug 24, 2016 1:50 pm
No new posts Online Assembler Program Starting point Aditya.Srivastava PL/I & Assembler 4 Fri Jul 08, 2016 6:48 pm
This topic is locked: you cannot edit posts or make replies. MVS Assembler profiles for Pune Locat... shailesh_do Mainframe Jobs 0 Mon Feb 22, 2016 6:21 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us