IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

What is the use of DSECT


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ap_mainframes

Active User


Joined: 29 Dec 2005
Posts: 181
Location: Canada

PostPosted: Mon Sep 04, 2006 12:01 pm
Reply with quote

Hi,

I know the theoritical concept of DSECT.
But when we say that with DESCT no actual virtual storage is allocated, what do we mean ??? What exactly happens ???
Can any body throw some light on DSECT and its usage???
Back to top
View user's profile Send private message
Bharanidharan

New User


Joined: 20 Jun 2005
Posts: 86
Location: Chennai, India

PostPosted: Tue Sep 05, 2006 9:23 am
Reply with quote

Have you ever used a stencil? DSECT's exactly that.
You can place a stencil over certain data and read the data in symbolic ashion, rather than referring them via absolute displacements.
You can move the stencil over repetitive data (arrays) and read it using same variables if you know the element size.
If you have multiple data formats, you can use different stencils to read the same data, by choosing one among them at a time.

The only restriction is that you have to tell the compiler before hand which stencil you are going to use for a particular portion of the code; it doesn't matter which path your routine takes during run time; all you have to ensure is you have the right mapping for the right code.
Does that answer your question?
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Wed Sep 06, 2006 6:11 pm
Reply with quote

A DSECT is much like the LINKAGE SECTION in a COBOL program. It allows you to work with field names instead of register+disp.
DSECTs are used together with the USING statement.
As Bharanidharan said, you can simulate the cobol OCCURS statement:
Without DSECT:
Code:
          L     6,0(1)
LOOP      EQU   *
          MVC   0(4,6),MYAREA1
          MVC   4(8,6),MYAREA2
          LA    6,12(6)
          B     LOOP
With DSECT:
Code:
          USING MYDSECT,6
          L     6,0(1)
LOOP      EQU   *
          MVC   DSFLD1,MYAREA1
          MVC   DSFLD2,MYAREA2
          LA    6,12(6)
          B     LOOP

MYDSECT   DSECT
DSFLD1    DS    CL4
DSFLD2    DS    CL8

The USING command means that MYDSECT describes the area pointed to by register 6.
(I don't work anymore in Assembler, so I don't have actual examples. Sorry for the infinite loop)
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts Using DSECT - for file reading PL/I & Assembler 2
No new posts DSECT and Establishing Addressability PL/I & Assembler 11
No new posts DSECT ID in listing. PL/I & Assembler 7
No new posts Instructions Within a DSECT PL/I & Assembler 3
Search our Forums:

Back to Top