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
 

 

Initialization of DS and DC variable problem.

 
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: Mon May 24, 2010 6:43 pm    Post subject: Initialization of DS and DC variable problem.
Reply with quote

Hi, I am facing a basic problem and request you all to kindly correct my ignorace. I was trying to initialize a variable CVAL DC 41CL1'@' using the following instruction:

MVI CVAL,C' '
MVC CVAL+1(L'CVAL-1),CVAL

Only 2 chars of the variable CVAL were initialized to spaces.

After sometime when I defined the variable as CVAL DS CL41 I was able to initialize it to spaces.

Now my queries:

1. Why the first process of initialization partially failed.
2. Inspite being a failure, why only 2 bytes of CVAL were initialized to spaces with the first process. Has it got something to do with length (41CL1)??

Kindly help.

Yours truly,

K. Rajesh
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


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

PostPosted: Mon May 24, 2010 6:47 pm    Post subject:
Reply with quote

41CL1 means you have 41 occurrences of a one-byte field. The length of a one-byte field is 1 byte, so your initialization logic fails. Specifically, the first byte was initialized by the MVI and the next byte by the MVC. Then the length was detected as being exceeded and the MVC stopped. 2 bytes initialized.

CL41 means you have 1 occurrence of a 41-byte field. The initialization logic will succeed for this field.

Both reserve 41 bytes, but they are handled differently since the lengths are 40 bytes apart.
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: Mon May 24, 2010 6:51 pm    Post subject: Reply to: Initialization of DS and DC variable problem.
Reply with quote

If you want this to work properly, you need to define this as a CL41. As a 41CL1, the MVC length will be for 01-Byte and therefore, that's why only two-bytes were set to X'40'.

Or, directly after the CVAL definition define -

Code:

CVALLEN  EQU   *-CVAL

And issue -

Code:

               MVI    CVAL,C' '
               MVC    CVAL+1(CVALLEN-1),CVAL

I must assume this is Batch Assembler and not CICS?

Constants should be "constant" and not require any type of execution initialization.

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

New User


Joined: 14 May 2010
Posts: 14
Location: hyd

PostPosted: Tue May 25, 2010 1:40 pm    Post subject:
Reply with quote

Hi Frens,

Thanks for the explanation. I always used to think that the only difference between Cl41 and 41Cl1 is the way storage is allocated. Now I even understand that MVC handles them differently.

I wonder if there are nay more differences like these???

Can you suggest any reference or if the differences are small can you list one or two here??

Thanks,

Rajesh.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10210
Location: italy

PostPosted: Tue May 25, 2010 1:51 pm    Post subject: Reply to: Initialization of DS and DC variable problem.
Reply with quote

Quote:
I always used to think that the only difference between Cl41 and 41Cl1 is the way storage is allocated.


Code:
var1   ds clxx
var2   ds xxcl1


reserve/allocate/increment_the_location_counter exactly (by) the same amount

for var1 the lenght of the elementary item is xx
for var2 the lenght of the elementary item is 1

is almost i said almost like defining
a string of xx bytes
an array of xx elements 1 byte each

and assembler will treat the lengths accordingly
Back to top
View user's profile Send private message
mkreutzian

New User


Joined: 26 Jan 2007
Posts: 3
Location: Iowa

PostPosted: Wed Jun 23, 2010 11:55 pm    Post subject: Reply to: Initialization of DS and DC variable problem.
Reply with quote

You can slightly modify your DC/DS configuration to make what you want to do work:


CVAL DS 0CL41
DC 41CL'@'

this will give you the length for the MVC and still not require you to type in 41 '@' signs, but then again, why put them in a constant if you are just going to initialize it to space.
Back to top
View user's profile Send private message
k_rajesh

New User


Joined: 14 May 2010
Posts: 14
Location: hyd

PostPosted: Mon Aug 02, 2010 9:58 am    Post subject: Re: Reply to: Initialization of DS and DC variable problem.
Reply with quote

Hi Frens,

Thankyou all for clarifying my doubts.

Regards,

Rajesh.
mkreutzian wrote:
You can slightly modify your DC/DS configuration to make what you want to do work:


CVAL DS 0CL41
DC 41CL'@'

this will give you the length for the MVC and still not require you to type in 41 '@' signs, but then again, why put them in a constant if you are just going to initialize it to space.
Back to top
View user's profile Send private message
k_rajesh

New User


Joined: 14 May 2010
Posts: 14
Location: hyd

PostPosted: Mon Aug 02, 2010 10:02 am    Post subject: Re: Reply to: Initialization of DS and DC variable problem.
Reply with quote

Hi Bill,

I got your point. I will improve the coding standard. From now on constants will be constants. Sorry for the delay in reply.

Rajesh.


Bill O'Boyle wrote:
If you want this to work properly, you need to define this as a CL41. As a 41CL1, the MVC length will be for 01-Byte and therefore, that's why only two-bytes were set to X'40'.

Or, directly after the CVAL definition define -

Code:

CVALLEN  EQU   *-CVAL

And issue -

Code:

               MVI    CVAL,C' '
               MVC    CVAL+1(CVALLEN-1),CVAL

I must assume this is Batch Assembler and not CICS?

Constants should be "constant" and not require any type of execution initialization.

Bill
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 SYMNAMES problem jacobdng DFSORT/ICETOOL 7 Thu Dec 22, 2016 7:47 am
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm
No new posts Problem in Running Query via JCL vickey_dw DB2 3 Tue Oct 18, 2016 11:11 pm
No new posts DB2 Streaming Batch Processing Problem Manshadi DB2 4 Sat Sep 24, 2016 12:14 pm
No new posts Format to pipe delimited with variabl... pshongal SYNCSORT 6 Wed Sep 14, 2016 2:48 pm


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