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

PL/I moving 0 to char field


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

New User


Joined: 24 Feb 2008
Posts: 62
Location: Boston

PostPosted: Fri Jan 18, 2013 9:44 pm
Reply with quote

Hi,
Really i got confused like how this code works,

DCL 01 STRING_1 CHAR(03);
..
.
STRING_1 = 0 ;
PUT SKIP LIST(' STRING 1 VALUE IS :' ,STRING_1);

I Compiled with old compiler and getting the Value as spaces.
can any one explain how it works.
Back to top
View user's profile Send private message
Karthikeyan Subbarayan

New User


Joined: 24 Feb 2008
Posts: 62
Location: Boston

PostPosted: Fri Jan 18, 2013 9:57 pm
Reply with quote

do this is simply flagging code that has always been wrong.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1787
Location: Bloomington, IL

PostPosted: Fri Jan 18, 2013 10:13 pm
Reply with quote

The effective precision (p,q) of the decimal constant zero is (1,0). When a decimal constant of precision (p,q) is converted to a string, an intermediate string of length p+k+3 is created, where k is the of digits expressed by q; hence is this case the string has length = 4; the character '0' is right-justified in it, the rest of the positions being spaces. When assigning it to the target STRING_1, it is of course truncated to the length of STRING_1, viz., 3; those three positions are all spaces. Q.E.D.
Back to top
View user's profile Send private message
Karthikeyan Subbarayan

New User


Joined: 24 Feb 2008
Posts: 62
Location: Boston

PostPosted: Fri Jan 18, 2013 10:40 pm
Reply with quote

Thanks a lot Akatsukami, now it sounds good.
Back to top
View user's profile Send private message
View previous topic : : View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts To Unstring spaces in a field COBOL Programming 3
No new posts Problem moving a cobol program into E... COBOL Programming 3
No new posts Help required to reset decimal points... DFSORT/ICETOOL 10
No new posts Sorting Date Field DFSORT/ICETOOL 4
No new posts sort to find out the char which repea... Mainframe Interview Questions 10
Search our Forums:


Back to Top