Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums 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: 56
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: 56
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: 1777
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: 56
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 sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Partial color change of a field in CI... waseem0424 CICS 5 Fri Sep 29, 2017 7:56 pm
No new posts Moving UDB database to Db2 on z/OS Keith Hooley DB2 4 Wed Sep 27, 2017 12:38 am
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
No new posts Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am

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