Compiling DR PL/I code with IBM Personal PL/I 
Author Message
 Compiling DR PL/I code with IBM Personal PL/I

Please bear with me as I'm new to PL/I but have been a programmer for
over 12 years in RPG, COBOL, C, Xbase, etc.

I've acquired some source code originally compiled with Digital Research
PL/I. After figuring out IBM's PL/I Personal and Visual Age PL/I
(somewhat), I've managed to compile about 30 source files. Two of the
files are troublesome in that they produce the following compiler
message: Function MYFUNCTION contains no RETURN statement. The odd thing
is that there IS a RETURN statement within the function. The first file
is for displaying a menu and returning an option. The section with the
RETURN looks like this:

do while(true);
       MenuPtr = addr(m(menunr,1));
       MainLevel = menunr;
       optnr = STDMENU('0000000110'b);
       if optnr = 10 then
         call exit;
       if optnr < 8 then
         return((menunr-1)*10+optnr);          /*   <--- Here's the
RETURN statement */
       if optnr=8 then
         begin;
           if menunr=1 then
             menunr=2;
           else /* Opt 8 sets menu 1*/
             menunr=1;
         end;
       else /*optnr must be 9 */
         begin;
           if menunr=3 then
             menunr=2;
           else /* Opt 9 sets menu 3*/
             menunr=3;
         end;
     end;

I'm seriously considering converting the system to C. Does anyone out
there have experience going from DR PL/I to IBM or with C conversions? I
think that there is some MASM in some .lib files, too, so I probably
have some challenges ahead. Your input is appreciated.

Stephen Nall



Sun, 02 Dec 2001 03:00:00 GMT  
 Compiling DR PL/I code with IBM Personal PL/I
Going from DR PL/I to IBM VA PL/I is normally easy. Most of the time error
messages really mean problems in the original source. Some things require
judicious choice of compiler options (esp. RULES option).

Please post the complete source file containing the MYFUNCTION routine if
you'd like help on resolving the compiler message. You can also e-mai lme
directly.

Also are you using VA PL/I V2.1 CSD#2, or Personal PL/I (=V1.2)? If the
latter, upgrade to the former. That will resolve a large number of problems
with Personal PL/I.


Quote:
> Please bear with me as I'm new to PL/I but have been a programmer for
> over 12 years in RPG, COBOL, C, Xbase, etc.

> I've acquired some source code originally compiled with Digital Research
> PL/I. After figuring out IBM's PL/I Personal and Visual Age PL/I
> (somewhat), I've managed to compile about 30 source files. Two of the
> files are troublesome in that they produce the following compiler
> message: Function MYFUNCTION contains no RETURN statement. The odd thing
> is that there IS a RETURN statement within the function. The first file
> is for displaying a menu and returning an option. The section with the
> RETURN looks like this:

> do while(true);
>        MenuPtr = addr(m(menunr,1));
>        MainLevel = menunr;
>        optnr = STDMENU('0000000110'b);
>        if optnr = 10 then
>          call exit;
>        if optnr < 8 then
>          return((menunr-1)*10+optnr);          /*   <--- Here's the
> RETURN statement */
>        if optnr=8 then
>          begin;
>            if menunr=1 then
>              menunr=2;
>            else /* Opt 8 sets menu 1*/
>              menunr=1;
>          end;
>        else /*optnr must be 9 */
>          begin;
>            if menunr=3 then
>              menunr=2;
>            else /* Opt 9 sets menu 3*/
>              menunr=3;
>          end;
>      end;

> I'm seriously considering converting the system to C. Does anyone out
> there have experience going from DR PL/I to IBM or with C conversions? I
> think that there is some MASM in some .lib files, too, so I probably
> have some challenges ahead. Your input is appreciated.

> Stephen Nall



Mon, 03 Dec 2001 03:00:00 GMT  
 Compiling DR PL/I code with IBM Personal PL/I


Quote:
>The section with the RETURN looks like this:

>do while(true);
>       MenuPtr = addr(m(menunr,1));
>       MainLevel = menunr;
>       optnr = STDMENU('0000000110'b);
>       if optnr = 10 then
>         call exit;
>       if optnr < 8 then
>         return((menunr-1)*10+optnr); /* <--- Here's the RETURN statement */
>       if optnr=8 then
>         begin;
>...<snip>...
>         end;
>     end;

You only have a return when [optnr < 8].    I'm surprised the compiler is able
to determine that, but it would be a problem at run-time.  

Frank Clarke
Tampa Area REXX Programmers' Alliance (TARPA)
Member of the REXX Language Assn
  Join us at http://www.rexxla.org
(remove currency symbol when replying)



Mon, 03 Dec 2001 03:00:00 GMT  
 Compiling DR PL/I code with IBM Personal PL/I

Quote:



> >The section with the RETURN looks like this:

> >do while(true);
> >       MenuPtr = addr(m(menunr,1));
> >       MainLevel = menunr;
> >       optnr = STDMENU('0000000110'b);
> >       if optnr = 10 then
> >         call exit;
> >       if optnr < 8 then
> >         return((menunr-1)*10+optnr); /* <--- Here's the RETURN statement */
> >       if optnr=8 then
> >         begin;
> >...<snip>...
> >         end;
> >     end;

> You only have a return when [optnr < 8].    I'm surprised the compiler is able
> to determine that, but it would be a problem at run-time.

I seem to recall a problem with DR PL/I (when I used it about 15y ago)
that it generated an error message if there was no return statement just
before the "end" closing a "procedure ... returns ..."

Peter
--


Opinions expressed are my own and not necessarily those of my employer.



Mon, 03 Dec 2001 03:00:00 GMT  
 Compiling DR PL/I code with IBM Personal PL/I

Quote:

> Please bear with me as I'm new to PL/I but have been a programmer for
> over 12 years in RPG, COBOL, C, Xbase, etc.

> I've acquired some source code originally compiled with Digital Research
> PL/I. After figuring out IBM's PL/I Personal and Visual Age PL/I
> (somewhat), I've managed to compile about 30 source files. Two of the
> files are troublesome in that they produce the following compiler
> message: Function MYFUNCTION contains no RETURN statement. The odd thing
> is that there IS a RETURN statement within the function. The first file
> is for displaying a menu and returning an option. The section with the
> RETURN looks like this:

> do while(true);
>        MenuPtr = addr(m(menunr,1));
>        MainLevel = menunr;
>        optnr = STDMENU('0000000110'b);
>        if optnr = 10 then
>          call exit;
>        if optnr < 8 then
>          return((menunr-1)*10+optnr);          /*   <--- Here's the
> RETURN statement */
>        if optnr=8 then
>          begin;
>            if menunr=1 then
>              menunr=2;
>            else /* Opt 8 sets menu 1*/
>              menunr=1;
>          end;
>        else /*optnr must be 9 */
>          begin;
>            if menunr=3 then
>              menunr=2;
>            else /* Opt 9 sets menu 3*/
>              menunr=3;
>          end;
>      end;

There may be a return statement here, but what about the
rest of the code?  Perhaps there's another section that can return,
but does not have a RETURN statement?

If you want an opinion, you'll need to post the entire function.

Quote:
> I'm seriously considering converting the system to C.

Generally a waste of time., but in this case even more
so, because DR PL/I is so close to
PL/I that it shouldn't be a problem to compile.

- Show quoted text -

Quote:
> Does anyone out
> there have experience going from DR PL/I to IBM or with C conversions? I
> think that there is some MASM in some .lib files, too, so I probably
> have some challenges ahead. Your input is appreciated.

> Stephen Nall



Mon, 03 Dec 2001 03:00:00 GMT  
 Compiling DR PL/I code with IBM Personal PL/I


Quote:
> ...
> Two of the
> files are troublesome in that they produce the following compiler
> message: Function MYFUNCTION contains no RETURN statement.
> ...

I have not tried on PC, but the MVS PL/I compiler did not complain on a
similar construct.  The program section is semantically correct.

However, why the use of BEGIN block?  This serves no purpose in this case
and will only introduce unnecessary overhead. It is better to use DO - END,
no overhead.

From the MVS PL/I Programmer's Guide:

"Avoid unnecessary program segmentation and block structure.  This includes
all procedures, ON-units, and begin-blocks that need activation and
termination.  The initialization and program management for these carry an
overhead."

Quote:
> ...
> I'm seriously considering converting the system to C.
> ...

That is a matter of taste.  I cannot see why PL/I should not do the job.

Gunnar.



Mon, 03 Dec 2001 03:00:00 GMT  
 Compiling DR PL/I code with IBM Personal PL/I

Thanks to everyone for their input. I'm attaching the complete file,
RSMM.PLI, as some suggested.

I tried inserting this statement,  "RETURN(menur); ", minus the quotes, just
before the last "end;" - the one at the DO group level, to ensure that there
was an unconditioned return. I also moved it up one line to just above the
next end. Didn't work. Hmmm.

Stephen Nall

...Onward through the fog...

[ Rsmm.pli 2K ]
RSMM:  /* Menu Selection Overlay */
  proc(om) returns(bin(7));
%include  'rsmrepl.inc';
%include  'd:psil.inc';
%include  'rsmfile1.inc';
%include  'rsmfile3.inc';
  dcl /* The Following Global Variables Must Be Set Before Call          */
   (MainLevel bin,          /* 1 = Daily, 2 = Monthly, 3 = Supplementary */
    MenuTitle char(60) var, /* Secondary Menu Title                      */
    MenuPtr   pointer,      /* Set to Text Array                         */
    MenuWide  bin,          /* Width of array including length byte      */
    MenuTop   bin) ext;     /* TopMost Line of Menu                      */
    dcl om      bin(7);
    dcl menunr  bin(7);
    dcl optnr   bin(7);
    dcl i       bin(7);
    dcl dpos    dec(11,2);
    dcl STDMENU entry(bit(10)) returns(bin);
    dcl TOPBOX  entry;
    dcl m(3,10) char(30) var static initial
   ('Process Work Orders',
    'Add New Customer',
    'Find/Edit Existing Customer',
    'Process Daily Receipts',
    'Process Metered Routes',
    'Customer Changes Report',
    'Perform Daily Backup',
    'Select Monthly Menu',
    'Select Supplementary Menu',
    'Exit to System',
    'Customer Bills',
    'Disconnect Notices',
    'Management/Accounting Reports',
    'Customer Information Reports',
    'Perform Monthly Close-out',
    '',
    '',
    'Select Daily Menu',
    'Select Supplementary Menu',
    'Exit to System',
    'Change System Information',
    'Modify Rate Tables',
    '',
    'Re-Index Customer Files',
    'Restore Data from Backups',
    'Perform Annual Close-out',
    'Data Tests & Misc Functions',
    'Select Daily Menu',
    'Select Monthly Menu',
    'Exit to System');

     MenuTitle = '';
     MenuWide = 31;
     MenuTop = 8;
     call TOPBOX;
     menunr = 1 + divide(om-1,10,7);
     dpos = 0;
     msg = 'Total Deposits:';
     call PLOT(4,3);
     do i = 1 to 5; /* calculate total sys deposits */
       dpos = dpos + drh.dep.new(i) + drh.dep.adj(i) + drh.cb.depos(2,i);
     end;
     tbuf = dpos;
     msg = DECFIX(-2);
     call PLOTF(4,20,-14);
     msg = 'MTD Pmts Rcvd:';
     call PLOT(5,3);
     tbuf = drh.recpts;
     msg = DECFIX(-2);
     call PLOTF(5,20,-14);
     do while(true);
       MenuPtr = addr(m(menunr,1));
       MainLevel = menunr;
       optnr = STDMENU('0000000110'b);
       if optnr = 10 then
         call exit;
       if optnr < 8 then
         return((menunr-1)*10+optnr);
       if optnr=8 then
         begin;
           if menunr=1 then
             menunr=2;
           else /* Opt 8 sets menu 1*/
             menunr=1;
         end;
       else /*optnr must be 9 */
         begin;
           if menunr=3 then
             menunr=2;
           else /* Opt 9 sets menu 3*/
             menunr=3;
         end;
     return(menur);
     end;

exit:
 proc;
 dcl (cf,xf,df,jf,rtof,pf,wbp) pointer ext;
   call CLFROM(1);
   call CLOSEF(cf);
   call CLOSEF(xf);
   call CLOSEF(df);
   call CLOSEF(jf);
   call CLOSEF(rtof);
   call CLOSEF(pf);
   call WBOOT(wbp);
end exit;
end rsmm;



Tue, 04 Dec 2001 03:00:00 GMT  
 Compiling DR PL/I code with IBM Personal PL/I


Quote:
> Thanks to everyone for their input. I'm attaching the complete file,
> RSMM.PLI, as some suggested.
> I tried inserting this statement,  "RETURN(menur); ", minus the quotes,
> just before the last "end;" - the one at the DO group level, to ensure
> that there was an unconditioned return. I also moved it up one line
> to just above the next end. Didn't work. Hmmm.

Your code reads, in part:

        else /* Opt 9 sets menu 3*/              
               menunr=3;          
        end;
        return(menur);
        end;

COMMENTARY:
    IF LENGTH('M E N U R') + 2 = LENGTH ('M E N U N R')
   THEN PUT LIST ('Please check your spelling');

Quote:
> -------Begin Encoded File-------
> Encoded filename: Rsmm.pli
> Decoded path: file:///F:\PRONEWS\DECODED\Rsmm.pli
> --------End Encoded File--------



Tue, 04 Dec 2001 03:00:00 GMT  
 Compiling DR PL/I code with IBM Personal PL/I
I was hoping you wouldn't catch that spelling thing. I saw it right after I
clicked send! Correcting it made no difference, however.
Quote:



> > Thanks to everyone for their input. I'm attaching the complete file,
> > RSMM.PLI, as some suggested.
> > I tried inserting this statement,  "RETURN(menur); ", minus the quotes,
> > just before the last "end;" - the one at the DO group level, to ensure
> > that there was an unconditioned return. I also moved it up one line
> > to just above the next end. Didn't work. Hmmm.

> Your code reads, in part:

>         else /* Opt 9 sets menu 3*/
>                menunr=3;
>         end;
>         return(menur);
>         end;

> COMMENTARY:
>     IF LENGTH('M E N U R') + 2 = LENGTH ('M E N U N R')
>    THEN PUT LIST ('Please check your spelling');

> > -------Begin Encoded File-------
> > Encoded filename: Rsmm.pli
> > Decoded path: file:///F:\PRONEWS\DECODED\Rsmm.pli
> > --------End Encoded File--------



Wed, 05 Dec 2001 03:00:00 GMT  
 Compiling DR PL/I code with IBM Personal PL/I
Stephen,

Just happened across this thread and I think I can shed some light on the
problem...apparently (as one or two have already pointed out), your compiler is
unhappy because there's no return statement right before the end that finishes
the procedure...so far I've heard you say you tried inserting an additional
return just inside the do-loop (the one beginning "do while (true)") and one
level deeper inside that, but nothing outside the loop...what you need to try
is moving it the OTHER way, so your (never-to-be-executed) return statement is
the last executable in the proc....

What you've got here is a typical example of excessive structuring, where the
actual return is in the middle of the loop logic...in CS terms that's perfectly
legal--you just go 'round and 'round until the condition is finally satisfied
and then return from the middle...but either the compiler is being overly rigid
about placement of return stmts, or it's optimizing the code and in the process
exceeding its own intelligence....r

Quote:

> I was hoping you wouldn't catch that spelling thing. I saw it right after I
> clicked send! Correcting it made no difference, however.




> > > Thanks to everyone for their input. I'm attaching the complete file,
> > > RSMM.PLI, as some suggested.
> > > I tried inserting this statement,  "RETURN(menur); ", minus the quotes,
> > > just before the last "end;" - the one at the DO group level, to ensure
> > > that there was an unconditioned return. I also moved it up one line
> > > to just above the next end. Didn't work. Hmmm.

> > Your code reads, in part:

> >         else /* Opt 9 sets menu 3*/
> >                menunr=3;
> >         end;
> >         return(menur);
> >         end;



Thu, 06 Dec 2001 03:00:00 GMT  
 Compiling DR PL/I code with IBM Personal PL/I

Quote:

> > BTW, DR PL/I is still available (free for non-commercial
> > use).
> Could anyone please post a URL for DR PL/I ?

http://www.mathcs.emory.edu/~cfs/cpm
Quote:
> --




Fri, 07 Dec 2001 03:00:00 GMT  
 
 [ 13 post ] 

 Relevant Pages 

1. Mapping local files to FILE declarations in PL/I with IBM VisualAge PL./I for Windows

2. PL/I (was: IBM Needs to seed the PL/I Compiler)

3. Personal PL/1 Samples

4. User's Personal PL/I Neural Network Leaks

5. Performance of Personal PL/I on a Thinkpad 600 (300MHz Pentium II)

6. Performance of Personal PL/I

7. Status of Personal PL/1

8. PL/I Personal is still available according to the web site

9. WTB: PL/I Personal for OS/2

10. Personal PL/1 for NT

11. Personal PL/I?

12. PL/I Personal and WIN98

 

 
Powered by phpBB® Forum Software