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
 

 

DSECT and Establishing Addressability

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

New User


Joined: 26 May 2008
Posts: 50
Location: Bangalore

PostPosted: Tue May 31, 2011 3:45 pm    Post subject: DSECT and Establishing Addressability
Reply with quote

Hi,

I have written below code to understand the concept of DSECT and establishing addressability for DSECT.

But the compilation error says No Active USING for the fields under DSECT(OPERTNA,ADD1A,ADD2A).

Code:
TESTPGM2 START
         SAVE (14,12)   
         USING *,R5     
         BALR R5,R0     
         BCTR R5,R0     
         BCTR R5,R0     
         OPEN (OUTFLE,OUTPUT) 
ADDIT    MVC OPERTN,=C'ADD'   
         L R2,ADD1   
         AH R2,ADD2                                               
         CHI R2,50                                                 
         BE  ADDSUC                                               
         WTO 'FAIL:ADDITION(AH) OF X''31 WITH X''14 IS NOT X''45'''
         B  DISP                                                   
ADDSUC   WTO 'SUCC:ADDITION(AH) OF X''31 WITH X''14 IS X''45'''   
DISP     LA R3,RESULT                                             
         ST R2,0(R3)                                               
         PUT OUTFLE,ADDDATE                                       
         WTO '***DSECT AND ADDRESSABILITY***'           
ADD      USING ADDFLD,R9                               
         L  R9,OUTREC                                   
         MVC OPERTNA,=C'ADD'                           
         L R2,ADD1A                                     
         MVI ADD2A,10                                   
         AH  R2,ADD2A                                   
         CHI R2,40                                     
         BE  ADDSUC                                     
         WTO 'FAIL:ADDITION(AH) OF 30 WITH 10 IS NOT 40'
         B  DISP                                       
ADDSUC2  WTO 'SUCC:ADDITION(AH) OF 30 WITH 10 IS 40'   
DISP2    LA R3,RESULTA                                 
         ST R2,0(R3)                                   
         PUT OUTFLE,OUTREC                             
         CLOSE OUTFLE                                   


* DATA FIELDS FOR AH INSTRUCTION             
ADDDATE  DC 0CL80                             
OPERTN   DC CL3' '                           
FILLER1  DC C' '                             
ADD1     DC F'30'                             
FILLER2  DC C' '                             
ADD2     DC H'20'                             
FILLER3  DC C' '                             
RESULT   DC F'0'                             
FILLER4  DC CL64' '                           

OUTREC   DC  CL80' '                                                   
OUTFLE   DCB DSORG=PS,                                                 X
               MACRF=(PM),                                             X
               DDNAME=OUTFILE,                                         X
               LRECL=80,                                               X
               RECFM=FB,                                               X
               SYNAD=ERROR1,                                           X
               BLKSIZE=8000                                             

ADDFLD   DSECT         
OPERTNA  DC CL3' '     
FILLER1A DC C' '       
ADD1A    DC F'30'       
FILLER2A DC C' '       
ADD2A    DC H'20'       
FILLER3A DC C' '       
RESULTA  DC F'0'       
FILLER4A DC CL64' '     
*                       
         END           


But the compilation error says No Active USING for the fields under DSECT(OPERTNA,ADD1A,ADD2A).

Please let me know what is wrong with the code. Thanks
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


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

PostPosted: Tue May 31, 2011 3:57 pm    Post subject:
Reply with quote

You have to allocate memory pointed to by a register, then issue a USING ADDFLD,register to make the DSECT variables usable -- BEFORE using any of the variables.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Tue May 31, 2011 3:58 pm    Post subject: Reply to: DSECT and Establishing Addressability
Reply with quote

First of all, get rid of those two consecutive BCTR's. What are they for?

Second, I don't see a USING and an associated base-register for the ADDFLD DSECT.

DSECT's belong at the top, before the start of the CSECT, but that has nothing to do with the USING error.

Issue a GETMAIN and then load R9 (as an example DSECT base) from R1 with the address, followed by USING ADDFLD,R9. You're also missing an 18-Word Register-Savearea (standard practice) and the RETURN Macro with an accompanying R15.

Bill
Back to top
View user's profile Send private message
Garry Carroll

Active Member


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

PostPosted: Tue May 31, 2011 4:05 pm    Post subject:
Reply with quote

Quote:
DSECT's belong at the top, before the start of the CSECT

Not at my shop. Every in-house Assembler application has the DSECTs at the bottom. I think it's according to taste...

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

Global Moderator


Joined: 27 Oct 2009
Posts: 2422
Location: Netherlands, Amstelveen

PostPosted: Tue May 31, 2011 4:26 pm    Post subject:
Reply with quote

You are using a labeled USING so you would need someting like :

MVC ADD.OPERTNA,=C'ADD'

better is :

ADD EQU *
USING ADDFLD,R9


And for the rest your coding sucks big time.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Tue May 31, 2011 4:33 pm    Post subject: Reply to: DSECT and Establishing Addressability
Reply with quote

Garry,

HLASM recommends placing the DSECTS at the top. This is just the opposite of its predecessors.

DSECTS at the top prevent the Assembler from "Double Sweeping" during Assembly.

Bill
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Tue May 31, 2011 4:45 pm    Post subject: Reply to: DSECT and Establishing Addressability
Reply with quote

Something else. Move the BALR R5,R0 to just after the SAVE Macro, then followed by the USING for the CSECT.

Change L R9,OUTREC to LA R9,OUTREC

Bill
Back to top
View user's profile Send private message
nigelosberry

New User


Joined: 06 Jan 2009
Posts: 88
Location: Ggn, IN

PostPosted: Wed Jun 01, 2011 2:46 pm    Post subject: Re: DSECT and Establishing Addressability
Reply with quote

Code:
ADDFLD   DSECT         
OPERTNA  DC CL3' '     
FILLER1A DC C' '       
ADD1A    DC F'30'       
FILLER2A DC C' '       
ADD2A    DC H'20'       
FILLER3A DC C' '       
RESULTA  DC F'0'       
FILLER4A DC CL64' '     



Shouldn't all DC's be DS's here? I believe that DSECT acts just as a "stencil" over a data area and does nothing like initialising that area.
Back to top
View user's profile Send private message
nigelosberry

New User


Joined: 06 Jan 2009
Posts: 88
Location: Ggn, IN

PostPosted: Wed Jun 01, 2011 2:52 pm    Post subject: Re: DSECT and Establishing Addressability
Reply with quote

Code:
BCTR R5,R0     
BCTR R5,R0     


A different way of adjusting the address in base register.

I once placed a BALR after USING and it took me quite long to detect the problem.
Back to top
View user's profile Send private message
Garry Carroll

Active Member


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

PostPosted: Wed Jun 01, 2011 2:55 pm    Post subject:
Reply with quote

Quote:
A distinct way of adjusting the base register address.


No, an unconventional way. Most would

Code:
    TESTPGM2 CSECT
             L    R5,R15
             USING TESTPGM2,R5


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

New User


Joined: 06 Jan 2009
Posts: 88
Location: Ggn, IN

PostPosted: Wed Jun 01, 2011 2:58 pm    Post subject:
Reply with quote

Garry Carroll wrote:
Quote:
A distinct way of adjusting the base register address.


No, an unconventional way. Most would

Code:
    TESTPGM2 CSECT
             L    R5,R15
             USING TESTPGM2,R5


Garry.



Yes. absolutely!
One should not reach a point wherein one has to adjust the content of base. icon_smile.gif
Back to top
View user's profile Send private message
vinayknj

New User


Joined: 26 May 2008
Posts: 50
Location: Bangalore

PostPosted: Wed Jun 15, 2011 10:52 am    Post subject:
Reply with quote

Thanks everyone. The issue is resolved, as mentioned by Peter I would have to use ADD.OPERTNA.
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 Using DSECT - for file reading Apurva Mehta PL/I & Assembler 2 Mon Nov 17, 2014 10:09 pm
No new posts DSECT ID in listing. milind suman PL/I & Assembler 7 Mon Aug 24, 2009 11:06 am
No new posts Instructions Within a DSECT Pankaj Shrivastava PL/I & Assembler 3 Fri Jul 24, 2009 7:03 pm
No new posts Steps to add Extended Addressability ... vinchuh JCL & VSAM 7 Mon Apr 06, 2009 5:29 pm
No new posts How to solve problem in establishing ... srikar tenali IMS DB/DC 2 Wed May 14, 2008 9:54 am


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