PIC 
Author Message
 PIC

I'm a rookie at PL1 (I'm learning about PL1 by just looking at the code) and
I've been assigned to make changes to some programs for Y2K.  My question
is, if a variable is declared as PIC '99' and the number 100 is assigned to
it, what happens?  Does it truncate it to 10 or 00?  I know this is a basic
question, please bare with me.

Is the number 99 significant?  It doesn't seem to handle the year 99
correctly.

Is there a way to put a halt in a program as it is processing in order to
view variable values?



Sun, 11 Feb 2001 03:00:00 GMT  
 PIC

Quote:

> I've been assigned to make changes to some programs for Y2K.  My question
> is, if a variable is declared as PIC '99' and the number 100 is assigned to
> it, what happens?  Does it truncate it to 10 or 00?  I know this is a basic
> question, please bare with me.

If the SIZE condition is enabled, you will get the SIZE condition raised.

It is a good idea to have the SIZE condition enabled, as any such error
will be immediately reported to you.

Quote:
> Is the number 99 significant?  It doesn't seem to handle the year 99
> correctly.

There's nothing special about the number 99.

Quote:
> Is there a way to put a halt in a program as it is processing in order to
> view variable values?

Have you tried CALL PLITEST ?

You could also include an ON unit for the ATTENTION condition,
and in the ATTENTION ON-unit include some output statements
to write out the values of certain variables.

(Note that you may also need to specify a compiler option for
the ATTENTION condition.)



Mon, 12 Feb 2001 03:00:00 GMT  
 PIC
In a message dated 08-26-98, Jill Green said to All about PIC

JG>I'm a rookie at PL1 (I'm learning about PL1 by just looking at the code)
JG>and I've been assigned to make changes to some programs for Y2K.  My
JG>question is, if a variable is declared as PIC '99' and the number 100 is
JG>assigned to it, what happens?  Does it truncate it to 10 or 00?  I know
JG>this is a basic question, please bare with me.
                                    ^^^^
Nudity will get you everywhere. .... :-))))
[Sorry, couldn't resist, since I'm an old EDSer myself.]

If the SIZE condition is enabled, it is raised. You can trap this with an
ON-unit for that condition. Just what you do inside such an ON-unit is
difficult to say. If you don't have an ON-unit the program will simply
crash, which is probably the best course anyway, since it is in error.

If you leave SIZE disabled, the number should be truncated to 00.

JG>Is the number 99 significant?  It doesn't seem to handle the year 99
JG>correctly.

I don't quite follow you here. A PIC '99' variable should hold 0 to 99
correctly. What are you doing with the number 99 and what happens?

JG>Is there a way to put a halt in a program as it is processing in order to
JG>view variable values?

  *** Assuming you are not debugging a CICS transaction!! ***

You can use PLITEST, but it is a little involved in batch. I used it at work
today, so the requirements are fresh in my mind. The interactive PLITEST
de{*filter*} looks really pretty running in an ISPF session, although the TSO
overheads make it a bit of a resource hog. You must set the TEST compilation
option; best to use TEST(ALL,SYM) as this allows all the debugging options
and facilities at run time.

More simply, you can use PUT SKIP DATA(<I/O list>); at strategic points and
snap whatever variables are of interest. Just put the interesting stuff in
place of <I/O list> and make sure your print operator is strong enough to
lift the listing.

A CICS transaction is more complicated to debug, at least in a CICS-friendly
manner. Ask again if you must debug a CICS routine.

Regards

Dave
<Team PL/I>
___
 * MR/2 2.25 #353 * Cult (n): A Religion with no Political Power.



Mon, 12 Feb 2001 03:00:00 GMT  
 PIC

Quote:

> I'm a rookie at PL1 (I'm learning about PL1 by just looking at the code)

Looks like an unholy mixture of BASIC and COBOL eh ?

Quote:
> I've been assigned to make changes to some programs for Y2K.  My question
> is, if a variable is declared as PIC '99' and the number 100 is assigned to
> it, what happens?  Does it truncate it to 10 or 00?

As a general rule PL/1 will left justify all data in a pic field that is
before
a "V" symbol, and right justify whatever is after the "V".

Quote:
> Is the number 99 significant?

No.

Quote:
> It doesn't seem to handle the year 99
> correctly.

Weird.

Quote:
> Is there a way to put a halt in a program as it is processing in order to
> view variable values?

Have you tried :

PUT SKIP LIST('DESCRIPTION =',VARIABLE)

?
Where 'description' is whatever description you would want to give,
and 'variable' is the variable name to be displayed.

This should appear in your sysprint.

--
Bub
bub at videotron dot ca
http://www.*-*-*.com/ ~sd_fort

        " To err is human, to really {*filter*} things up
                requires a computer ! "



Tue, 13 Feb 2001 03:00:00 GMT  
 PIC

Quote:

> Nudity will get you everywhere. .... :-))))
> [Sorry, couldn't resist, since I'm an old EDSer myself.]

Gee, when I was at EDS the dress code required clothing. Nudity was not
encouraged.

Quote:
> If the SIZE condition is enabled, it is raised. You can trap this with an
> ON-unit for that condition. Just what you do inside such an ON-unit is
> difficult to say. If you don't have an ON-unit the program will simply
> crash, which is probably the best course anyway, since it is in error.

It's desirable to have at least a traceback; depending on the program, other
diagnostics may be appropriate as well. You don't want to simply crash; you want
to crash with enough information to do something about it.


Tue, 13 Feb 2001 03:00:00 GMT  
 PIC

Quote:

> Looks like an unholy mixture of BASIC and COBOL eh ?

PL/I is an amalgam of ALGOL 60, COBOL and fortran; there is no taint of BASIC.

Quote:
> Have you tried :

> PUT SKIP LIST('DESCRIPTION =',VARIABLE)

IMHO it's better to use PUT DATA, since that gives you the actual variable
names.


Tue, 13 Feb 2001 03:00:00 GMT  
 PIC

Quote:


> > Looks like an unholy mixture of BASIC and COBOL eh ?

> PL/I is an amalgam of ALGOL 60, COBOL and FORTRAN; there is no taint of BASIC.

...and then someone wanted an interpreted language with the same
philosophy, and Rexx was born....

Quote:

> > Have you tried :

> > PUT SKIP LIST('DESCRIPTION =',VARIABLE)

> IMHO it's better to use PUT DATA, since that gives you the actual variable
> names.

Nice thought, but not all compilers carry data-oriented stream
I/O...it's one of my biggest gripes about the VOS PL1 compilers from
Stratus...(I have a copy of Joan Hughes' PL1 Structured Programming with
a paper clip for every feature that's not implemented...woe unto him who
tries to get it thru the airport metal detectors)....

I remember sitting outside a conference room while a contracted trainer
tried to teach a group of people PL1 basics...(I was exempted from
attending the class because I'd already worked in it for 4 years at
another company)...one entire afternoon was taken up trying to get
across the concept of GENERIC ENTRY declares, which Stratus doesn't
do....r



Thu, 15 Feb 2001 03:00:00 GMT  
 PIC

Quote:
>> If the SIZE condition is enabled, it is raised. You can trap this with an
>> ON-unit for that condition. Just what you do inside such an ON-unit is
>> difficult to say. If you don't have an ON-unit the program will simply
>> crash, which is probably the best course anyway, since it is in error.

>It's desirable to have at least a traceback; depending on the program, other
>diagnostics may be appropriate as well. You don't want to simply crash; you want
>to crash with enough information to do something about it.

In fact, in the SIZE ON-unit you can always re-assign the offending value to a different variable,
but it may in turn cause ON-SIZE to get triggered, etc.
Therefore, it's just a perversive way of checking variable lengths.


Sat, 17 Feb 2001 03:00:00 GMT  
 PIC

Quote:


> > > Looks like an unholy mixture of BASIC and COBOL eh ?

> > PL/I is an amalgam of ALGOL 60, COBOL and FORTRAN; there is no taint of BASIC.

> ...and then someone wanted an interpreted language with the same
> philosophy, and Rexx was born....

> > > Have you tried :

> > > PUT SKIP LIST('DESCRIPTION =',VARIABLE)

> > IMHO it's better to use PUT DATA, since that gives you the actual variable
> > names.

> Nice thought, but not all compilers carry data-oriented stream
> I/O...it's one of my biggest gripes about the VOS PL1 compilers from
> Stratus.......r

Unfortunately.  However, it's relatively straightforward to
implement PUT DATA for scalar variables, using the macro facility.

And, I guess, if you don't have that facility, you could
always do your own pre-processor....



Sun, 18 Feb 2001 03:00:00 GMT  
 
 [ 27 post ]  Go to page: [1] [2]

 Relevant Pages 

1. Moving a PIC X(20) to PIC S9(8)V9(2) COMP 3 field

2. moving data from pic 99 to pic 99

3. Moving PIC X(06) to PIC 9(06)

4. Moving PIC X(06) to PIC 9(06)

5. Print pic and styled text on same page?

6. UNIBASIC, PIC BASIC or Business Basic

7. DST, Gemstone and PIC

8. Scrolling a Canvas(jpg pic)

9. Comments about PIC...

10. chg pic at run time.

11. Forth for PIC 18fxxx series?

12. MXI-3 as PCI-PIC expansion system ?

 

 
Powered by phpBB® Forum Software