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

PLI:A strange thing(difference between pic'-9'&pic'99')


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

New User


Joined: 22 Mar 2012
Posts: 6
Location: china

PostPosted: Thu Apr 26, 2012 12:55 pm
Reply with quote

PLI CODE:
Code:
EV63TS01:PROC OPTIONS(MAIN);                       
  DCL SPKKYIF        FILE INPUT  RECORD;           
  DCL QTFAZ     PIC'ZZZV.ZZ-';                     
  DCL 1 IN_SPKKYIF   ,                             
        2 IN_FILLER1   CHAR(261),                   
        2 DUABD9       PIC'99',                     
        2 IN_FILLER2   CHAR(27);                   
  OPEN FILE(SPKKYIF);                               
  READ FILE(SPKKYIF) INTO(IN_SPKKYIF);             
  PUT SKIP LIST('IN_DUABD9 = '||IN_SPKKYIF.DUABD9);
  QTFAZ       = IN_SPKKYIF.DUABD9;                 
  PUT SKIP LIST('OT_QTFAZ  = '||QTFAZ);             
   CLOSE FILE(SPKKYIF);                             
END EV63TS01;                                       


In the SPKKYIF file.the DUABD9 is 112

RUN1: With the code above.and
Code:
2 DUABD9       PIC'99', 

JOBLOG1:
Code:
*******************
IN_DUABD9 = 12     
OT_QTFAZ  =  12.00
*******************


RUN2: CHANGE the PIC'99' TO PIC'-9'.LIKE BELOW
Code:
2 DUABD9       PIC'-9', 

JOBLOG2:
Code:
********************
IN_DUABD9 = 12     
OT_QTFAZ  =   2.00 
********************


STRANGE:
the two time ,we both read value of the DUABD9 from the input file.
and get the same value 12 .
but when we move the value to QTFAZ.we get the different result.

Q/A:
1.do you think is there some wrong with the compiler.
2.what's the reason about this thing.

if there is anything that is diffcult to read the page.please connect me.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Apr 26, 2012 1:46 pm
Reply with quote

I don't know PL/I, but why don't you look in the manual and see whether the "-" always takes a byte, so what you have defined is a field which can contain -9 through 9. Then, when you try to set it to a value with two or more digits after the leading zeros, you'll get truncation.

No compiler error. It is what you have asked the compiler to do.
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Thu Apr 26, 2012 1:54 pm
Reply with quote

Now why would there be anything wrong with the compiler, a compiler that has been around since somewhere in the mid 1960'ies? If there was something wrong, it would have been solved about 45 years ago.

Learn about the PIC format and how it is moved from one PIC to another PIC, try putting '!!' in the input file, and then come back to us. (Hint: Compile you program with OPT(0),LIST and look at the generated code)
Back to top
View user's profile Send private message
senthilnathanj

New User


Joined: 31 Jul 2007
Posts: 47
Location: chennai

PostPosted: Thu Apr 26, 2012 4:50 pm
Reply with quote

Hi,
Here Z denotes a zero suppression Characters. It specifies a conditional digit position and causes a leading zero in the associated data position to be replaced by a blank. Otherwise, the digit in the position is unchanged. The picture character Z cannot appear in the same field as the picture character * or a drifting character, nor can it appear to the right of any of the picture characters in a field.

Please let me know..
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Thu Apr 26, 2012 8:42 pm
Reply with quote

senthilnathanj wrote:
Hi,
Here Z denotes a zero suppression Characters. It specifies a conditional digit position and causes a leading zero in the associated data position to be replaced by a blank. Otherwise, the digit in the position is unchanged. The picture character Z cannot appear in the same field as the picture character * or a drifting character, nor can it appear to the right of any of the picture characters in a field.

Please let me know..

What should we let you know? That you can copy text from a manual, text that has abso-fluck-ingly zilch to do with the non-problem the TS has.
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 Timestamp difference and its average ... DB2 11
No new posts Difference when accessing dataset in ... JCL & VSAM 7
No new posts What is the difference between Taskty... Compuware & Other Tools 2
No new posts Difference between VALIDPROC and CHEC... DB2 3
No new posts Strange MNOTE related to BMS using PI... CICS 0
Search our Forums:

Back to Top