× 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.


  • Subject: Re: Pointers, Parms, and all that (Was: DSPPGM API)
  • From: Rob Berendt <rob@xxxxxxxxx>
  • Date: Wed, 28 Apr 1999 8:54:40 -0500

I wrote a RTVJOBD command, which uses many RTNVAL(*YES) parameters.  This 
command calls an 
ILERPG program.  I didn't know about the API you mentioned and I kept getting 
the MCH3601 
error.  I handled it differently.  I did a dump.  I noticed on the dump listing 
that if I 
had a variable JOBPTY then I would also have a variable PTR_JOBPTY and this was 
a pointer.  
And if I had not requested JOBPTY then PTR_JOBPTY would be null.  My solution 
was to check 
the variable JOBPTY for a null value by using the %addr built-in function.  
Example as follows:
...
C     Detail        BegSr                                           
C* We use %addr to see if the field is addressable.  This will occur
C* when a user uses RTVJOBD and doesn't fill out each and every one 
C* of the possible values.                                          
C                   If        %addr(InlLibl) <> *NULL               
C                   Eval      InlLibl = *blanks                     
C                   Eval      InlLibl=%subst(JOBD0100:              
C                                            Offliblst+1:           
C                                            NbrLibLst*11)          
C                   EndIf                                           
C                   If        %addr(RqsDta) <> *NULL                
C                   Eval      RqsDta =%subst(JOBD0100:              
C                                            OffRqsDta+1:           
C                                            LenRqsDta)             
C                   EndIf                                           
...





shc@flybynight.com.au on 04/28/99 08:39:12 AM
Please respond to MIDRANGE-L@midrange.com@Internet
To:     MIDRANGE-L@midrange.com@Internet
cc:      

Subject:        Pointers, Parms, and all that (Was: DSPPGM API)

H
Hello Henrik,

Well, being pedantic (as is my wont), CL still requires the declared number of 
parameters to 
be passed.  The situation you are referring to occurs when a command is defined 
with 
parameters that specify RTNVAL(*YES) -- like all the RTVxxx commands.  The 
command analyser 
passes NULL pointers for the unspecified keywords so the command processing 
program still 
receives the correct number of pointers -- it just happens that some of the 
pointers have no 
storage allocated, hence the MCH3601 message that occurs when the parameters 
are referenced.

The primary difference between NULL parameters and the variable argument list 
of the original 
question is that a pointer is actually passed for the NULL parameter.  The 
variable argument 
list allows NOTHING AT ALL to be passed.  Note that it doesn't allow holes in 
the argument 
list i.e., if 5 arguments are declared then they must be consecutive from the 
first e.g., 1 or 
1 and 2 or 1, 2, and 3 etc but not 1 and 5.  For the situation you describe, 
knowing the 
number of parameters passed would not help; you really need to know which 
specific ones were 
passed.

RPG IV (and other languages) allows parameters to be omitted and ILE allows you 
to use the 
CEETSTA API determine exactly which parameters were passed and operational 
descriptors allow 
you to determine information about those parameters.  These should work for CLE 
programs but 
nothing will assist with CL programs (other than the afore-mentioned MONMSG 
MCH3601).

You probably know this but it may be educational to others.

Regards,
Simon Coulter.

ŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪg
Ūg FlyByNight Software         AS/400 Technical Specialists       Ūg
Ūg Eclipse the competition - run your business on an IBM AS/400.  Ūg
Ūg                                                                Ūg
Ūg Phone: +61 3 9419 0175      Mobile: +61 0411 091 400           Ūg
Ūg Fax:   +61 3 9419 0175      mailto: shc@flybynight.com.au      Ūg
Ūg                                                                Ūg
Ūg Windoze should not be open at Warp speed.                      Ūg
ŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪgŪg
//--- forwarded letter -------------------------------------------------------
> X-Mailer: Microsoft Internet Mail 4.70.1155
> Date: Mon, 26 Apr 99 21:27:21 +0200
> From: "Henrik Krebs" <hkrebs@hkrebs.dk>
> To: MIDRANGE-L@midrange.com
> Reply-To: MIDRANGE-L@midrange.com
> Subject: Re: DSPPGM API

> 
> > Hello Jim,
> 
> > The API you are using IS the correct way to determine the number of
> parameters.  You are 
> > getting a range returned because RPG does not require you to pass all
> the parameters defined > on the *ENTRY PLIST.  This feature of RPG has
> existed since RPG III on System/38 (but I don't > know the first
> release).  It is a useful way of extending a programs function without 
> > breaking any existing code.
> >
> > Not all HLL's support this feature e.g., CL.
> 
> 
> 
> You do however need this feature inside a CL-program (and the AS/400 does
> it all the time): A command can 'call' a CL-program with maybe not a
> varying number of parameters but with 'null'-parameters. You can cope
> with this by monitoring for the genereted escape each time you refer to
> parameters that are not required.
> 
> Henrik

+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.comm
+---


+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.