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: 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: 1786
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 How to include a particular field val... sakrat DFSORT/ICETOOL 8 Fri Apr 06, 2018 8:27 pm
No new posts Extract the records with a PD field's... sudhakar84 DFSORT/ICETOOL 11 Mon Apr 02, 2018 7:26 pm
No new posts Searching a table for the field name? socker_dad COBOL Programming 8 Sat Mar 31, 2018 2:57 am
No new posts Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm
No new posts Moving a PS file as body of a mail! Vignesh Sid JCL & VSAM 4 Tue Nov 21, 2017 9:23 pm

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