Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
PL/I moving 0 to char field

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
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    Post subject: PL/I moving 0 to char field
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    Post subject: Reply to: PL/I moving 0 to char field
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: 1789
Location: Bloomington, IL

PostPosted: Fri Jan 18, 2013 10:13 pm    Post subject:
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    Post subject: Reply to: PL/I moving 0 to char field
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    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 SECTION BASED ON FIELD speermb DFSORT/ICETOOL 10 Mon Jun 17, 2019 9:41 pm
No new posts Send text at cursor position on an IS... Domenic Ailati CLIST & REXX 10 Sun Jun 02, 2019 7:34 am
No new posts Display Signed ZD field socker_dad DFSORT/ICETOOL 11 Thu Feb 28, 2019 1:17 am
No new posts DB2 Timestamp field weird behaviour. rizwanaccy DB2 7 Wed Dec 26, 2018 4:33 pm
No new posts Replace comp-3 field value to comp-3 ... dharmaraok DFSORT/ICETOOL 5 Fri Sep 14, 2018 3:46 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us