× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Bill,

>      D SortMods        pr                  Extpgm('SORTMODS')
>      D  smArrPtr                      1
>      D  smCount                       5  0 Const
>      D  smElemLen                     5  0 Const
>      D  smNumKeys                     3  0 Const
>      D  smKeyPos                      5  0 Const
>      D  smKeyLen                      5  0 Const
>      D  smKeyType                     1    Const
>      D  smKeyDir                      1    Const
>      D  smExitCd                      1
>
> If the prototype is correct, what would the callp look like?  Here's what

Neither the prototype, not the callp is correct.  The prototype is wrong
because the smKeyPos, smKeyLen, smKeyType, smKeyDir parameters are
supposed to be arrays, and you don't have them defined as arrays.

Also, the smArrPtr is not supposed to be a pointer, but rather the start
of your MODS passed by reference.  It should be defined to be the size of
your MODS, but since that can vary, I just prototype it as a very large
string, and use options(*varsize) to allow the size to vary.

Instead, it should look like this:

      D SortMods        pr                  Extpgm('SORTMODS')
      D  smArrPtr                  32767A   options(*varsize)
      D  smCount                       5  0 Const
      D  smElemLen                     5  0 Const
      D  smNumKeys                     3  0 Const
      D  smKeyPos                      5  0 Const
      D                                     dim(32767) options(*varsize)
      D  smKeyLen                      5  0 Const
      D                                     dim(32767) options(*varsize)
      D  smKeyType                     1    Const
      D                                     dim(32767) options(*varsize)
      D  smKeyDir                      1    Const
      D                                     dim(32767) options(*varsize)
      D  smExitCd                      1

The reason that I used dim(32767) is to allow as many array elements as
you like to be passed to the program.  The options(*varsize) parameter
allows you to pass fewer elements than 32767, since you won't usually need
that many keys :)

Now the callp statement:

>             CallP SortMods (%Addr(arrDtOrd) : x : %Size(arrDtOrd) :
>                     %Size(arrDtOrd) : 1 : 1 : %Size(arrDODte) : 'A' :
>                     'A' : cExitCd ) ;

The %addr() does not make sense here.  The system will automatically pass
the address of arrDtOrd, you don't have to tell it to.   The way you've
got it coded would work if the prototype received a pointer by value, but
you can't pass parameters by value to a program, you can only use that
technique with subprocedures.

Instead, just pass arrDtOrd itself:

      SortMods (arrDtOrd :  . . .


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.