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: 1788
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Exclude rows with > than x occurre... DFSORT/ICETOOL 6
No new posts Join 2 files according to one key field. JCL & VSAM 3
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
Search our Forums:

Back to Top