[Info-vax] Error Messages in Basic - %BASIC-E-PARMODNOT, mode for parameter <n> of routine <procedure-name> not as declared
John Reagan
xyzzy1959 at gmail.com
Sat Jun 8 16:46:42 EDT 2019
On Saturday, June 8, 2019 at 4:24:03 PM UTC-4, Bob Gezelter wrote:
> On Saturday, June 8, 2019 at 2:21:45 PM UTC-4, Jeffrey H. Coffield wrote:
> > On 06/05/2019 07:45 AM, DuncanMorris wrote:
> > > On Wednesday, June 5, 2019 at 3:28:00 PM UTC+1, Jeffrey H. Coffield wrote:
> > >> The following compiles and runs for me on both Alpha and Itanium. You
> > >> must have something wrong in how you are declaring the function.
> > >>
> > >> program test
> > >>
> > >> external long function lib$convert_date_string
> > >>
> > >> Declare Long Date_Time_Context_gl
> > >> Declare String End_of_Month_Date_gs
> > >> Declare Quad End_of_Month_Date_Time_gq
> > >> Declare Long End_of_Month_Weekday_gl
> > >> Declare Long VMS_Condition_Code_gl
> > >>
> > >> End_of_Month_Date_gs = '31-may-2019 01:23:45.67'
> > >>
> > >> VMS_Condition_Code_gl &
> > >> = LIB$CONVERT_DATE_STRING (End_of_Month_Date_gs, &
> > >> End_of_Month_Date_Time_gq, &
> > >> Date_Time_Context_gl )
> > >>
> > >> print VMS_Condition_Code_gl
> > >> print End_of_Month_Date_Time_gq
> > >>
> > >> end
> > >>
> > >>
> > >>
> > >> On 06/05/2019 06:48 AM, Craig Dedo wrote:
> > >>> VMS_Condition_Code_gl = LIB$CONVERT_DATE_STRING ( End_of_Month_Date_gs, End_of_Month_Date_Time_gq, Date_Time_Context_gl )
> > >
> > > Nothing wrong, per se, with the program.
> > >
> > > As Hoff has pointed out, the external definition in the library expects BASIC$QUADWORD for parameter 2. This is not seen as the same type as QUAD.
> > >
> > > Try this-
> > > program test
> > >
> > > %include "starlet" %from %library "sys$library:basic$starlet" ! System Services declarations
> > > %include "$ssdef" %from %library "sys$library:basic$starlet" ! condition codes
> > > %include "lib$routines" %from %library "sys$library:basic$starlet" ! LIBRTL routines
> > >
> > > Declare Long Date_Time_Context_gl
> > > Declare String End_of_Month_Date_gs
> > > Declare Quad End_of_Month_Date_Time_gq
> > > Declare Long End_of_Month_Weekday_gl
> > > Declare Long VMS_Condition_Code_gl
> > >
> > > End_of_Month_Date_gs = '31-may-2019 01:23:45.67'
> > >
> > > VMS_Condition_Code_gl &
> > > = LIB$CONVERT_DATE_STRING (End_of_Month_Date_gs, &
> > > End_of_Month_Date_Time_gq, &
> > > Date_Time_Context_gl )
> > >
> > > print VMS_Condition_Code_gl
> > > print End_of_Month_Date_Time_gq
> > >
> > > end
> > >
> > > I1 12238 ! LIB$CONVERT_DATE_STRING
> > > I1 12239 !
> > > I1 12240 ! Convert Date String to Quadword
> > > I1 12241 !
> > > I1 12242 ! The Convert Date String to Quadword routine converts an absolute date
> > > I1 12243 ! string into a VMS internal format date-time quadword. That is, given
> > > I1 12244 ! an input date/time string of a specified format,
> > > I1 12245 ! LIB$CONVERT_DATE_STRING converts this string to a VMS internal format
> > > I1 12246 ! time.
> > > I1 12247 !
> > > I1 12248 EXTERNAL LONG FUNCTION lib$convert_date_string &
> > > I1 12249 ( &
> > > I1 12250 STRING BY DESC, &
> > > I1 12251 BASIC$QUADWORD BY REF, &
> > > I1 12252 OPTIONAL LONG BY REF, &
> > >
> >
> > There are a number of places in both text libraries as well as .BAS
> > files that have the following "patch":
> >
> > %IF %DECLARED(%BASIC$QUADWORD_DECLARED) = 0 %THEN
> > RECORD BASIC$QUADWORD
> > LONG FILL(2)
> > END RECORD
> > %LET %BASIC$QUADWORD_DECLARED = 1
> > %END %IF
> >
> > because Basic didn't have a quad data type. It does now and this
> > could/should be cleaned up.
> >
> > There are other long time errors and omissions in Basic support that I
> > have had to keep my own fixed/stable versions of some of the library
> > files so my programs will work. Notably the files concerning XAB
> > structures for Basic would change/break with new versions of OpenVMS.
> >
> > If anyone is interested in fixing, I can dig up some small samples.
> >
> > Also, if there is a list of things to do, Basic still does not support a
> > get/find key "LT" or "LE" which RMS supports.
>
> Jeffrey,
>
> At first glance, when I encountered this I agreed. However, on detailed consideration, the problem is more complex.
>
> Changing the BASIC$QUADWORD definition to a simple quadword would invalidate all existing code. It would be a nasty incompatibility, causing a lot of rework to existing code.
>
> One could do something with conditional code, but it would be complex to implement and document.
>
> Hoff has referred to this type of problem using words along the line of "curse of compatibility". I am forced to agree. The solution (using a struct) made sense when done, but events have made the existing solution awkward and dated. Changing the solution breaks existing code.
>
> - Bob Gezelter, http://www.rlgsc.com
The Pascal STARLET.PAS has the same problem. It uses a record with two fields to hold a quadword back on VAX. We've had to keep that in place since then to avoid breaking existing programs. It is a little easier for Pascal since it has the "[UNSAFE]" attribute which is sorta like a "permanent typecast to anything of the same size regardless of shape" but I looked years ago and decided it wouldn't be 100% transparent. It was heading towards a "_NEW_STARLET" situation and I ran as fast as I could in the other direction.
More information about the Info-vax
mailing list