View previous topic :: View next topic
|
Author |
Message |
ap_mainframes
Active User
Joined: 29 Dec 2005 Posts: 181 Location: Canada
|
|
|
|
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 |
|
|
Bharanidharan
New User
Joined: 20 Jun 2005 Posts: 86 Location: Chennai, India
|
|
|
|
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 |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
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 |
|
|
|