View previous topic :: View next topic |
Author |
Message |
annie Beginner
Joined: 06 Sep 2004 Posts: 1 Topics: 1
|
Posted: Mon Sep 06, 2004 12:20 am Post subject: PLI -- BASED POINTER |
|
|
I have a doubt.
If anyone of you have any idea kindly share with me.
The following Program is coded and tested .
DCL FOURTH CHAR(4) INIT(' ');
DCL THIRD PIC'9999' BASED(ADDR(FOURTH));
DCL SECOND FIXED DEC(8 ) BASED(ADDR(FOURTH));
FOURTH ='AB*D';
DISPLAY('FOURTH='||FOURTH);
DISPLAY('THIRD='||THIRD);
DISPLAY('SECOND='||SECOND);
Giving following outputs :
F8 0008 FOURTH=AB*D
F8 0008 THIRD=AB*D
After that It abended. How come the variable THIRD which is of PIC '9999' type( supposed to display only numeric value) is displaying 'AB*D' whereas SECOND which is of FIXED DEC type cant ?
If THIRD is not based on ADDR( FOURTH) and assigned a value of AB*D then it will give error in compilation ( data conversion error) as '9999' specification is only for displaying numeric value.
thx
annie |
|
Back to top |
|
 |
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Mon Sep 06, 2004 3:24 pm Post subject: |
|
|
I suspect there is no conversion being done for pic'9999' because it is assumed to be a valid string which contains F0 - F9. It doesn't but since it is not a mathematical operation, no conversion is done. For SECOND, a conversion is required to turn it into a character representation and hence you get an 0C7 abend (or similar). The best way to answer this question is to use the LIST option and look at the assembler to see what it is doing. (At least it was LIST when I last used a PL/I compiler 25 years ago ) |
|
Back to top |
|
 |
|
|