× 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: "Simon Coulter" <shc@xxxxxxxxxxxxxxxxx>
  • Date: Thu, 29 Apr 99 11:43:21 +1000

Œ
Hello Rob,

Interesting piece of lateral thinking happening there!  That technique is going 
in my bag of 
tricks.

Since the compiler always generates two variables for each argument -- the 
pointer and the 
variable based on that pointer -- testing the addressability of the variable 
will work and 
should also be future-proof (the generated pointer name may change but you 
never reference 
that).

This technique would work with any language which allows testing the 
addressability of a 
variable -- COBOL, C, RPG IV.

You could even handle this in RPG III although it would involve use of the 
*PSSR and 
contortions with GOTO to continue processing.  Something like:

C       *ENTRY  PLIST
C               PARM            PARM1   2
C               PARM            PARM2   2
C               PARM            PARM3   2
C               PARM            PARM4   2
 *
C               Z-ADD*ZERO      LABEL   50
C       P1      TAG
C               ADD  1          LABEL
C               MOVE '**'       PARM1
C       P2      TAG
C               ADD  1          LABEL
C               MOVE '##'       PARM2
C       P3      TAG
C               ADD  1          LABEL
C               MOVE '@@'       PARM3
C       P4      TAG
C               ADD  1          LABEL
C               MOVE '&&'       PARM4
C       END     TAG
C               SETON                           LR
C               RETRN
 *
CSR     *PSSR   BEGSR
C       LABEL   CABEQ1          P2
C       LABEL   CABEQ2          P3
C       LABEL   CABEQ3          P4
C       LABEL   CABEQ4          END
CSR             ENDSR

See! I can write crap (albeit structured crap) with the best of them! Burn me 
now, Flame-boy!

Regards,
Simon Coulter.

«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»
«» FlyByNight Software         AS/400 Technical Specialists       «»
«» Eclipse the competition - run your business on an IBM AS/400.  «»
«»                                                                «»
«» Phone: +61 3 9419 0175      Mobile: +61 0411 091 400           «»
«» Fax:   +61 3 9419 0175      mailto: shc@flybynight.com.au      «»
«»                                                                «»
«» Windoze should not be open at Warp speed.                      «»
«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»
//--- forwarded letter -------------------------------------------------------
> X-Mailer: Worldtalk (NetTalk for Windows NT 4.5-g5)/MIME
> Date: Wed, 28 Apr 99 08:54:40 -0500
> From: "Rob Berendt" <rob@dekko.com>
> To: MIDRANGE-L@midrange.com
> Reply-To: MIDRANGE-L@midrange.com
> Subject: Re: Pointers, Parms, and all that (Was: DSPPGM API)

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

+---
| 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-Ups:

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.