× 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: CALLB vs.CALLP
  • From: Rob Berendt <rob@xxxxxxxxx>
  • Date: Fri, 31 Mar 2000 12:45:44 -0500

Good counterpoint.  I wanted to get the guy walking before he ran.




bvstone@taylorcorp.com on 03/31/2000 12:22:46 PM
Please respond to RPG400-L@midrange.com@Internet
To:     RPG400-L@midrange.com@Internet
cc:      
Fax to: 
Subject:        RE: CALLB vs.CALLP

I never understood this example, and I've seen it from a lot of people.  If
you're making a subprocedure, prototype it so you only send the command.
Not the length.  You can define the length as %size(Command) in the
Subprocedure.

Then, you only need to do..

CALLP   #QcmdExc('CLRPFM FILE1')

Much easier.  And only 2 more seconds of setup.

Other times you will definatly want to do this when making wrappers for
APIs.  Sometimes they have a lot of parms you don't need to pass.  The
command length on QCMDEXC is one of them.

Brad

> -----Original Message-----
> From: Rob Berendt [mailto:rob@dekko.com]
> Sent: Friday, March 31, 2000 10:00 AM
> To: RPG400-L@midrange.com
> Subject: Re: CALLB vs.CALLP
> 
> 
> Prototyped calls take a little more setup.  However, they do give 
> you some advantages.  One is consistancy.  Two is the ability to do 
> calcs and stuff.
> 
> For example 
> << source member STDCOPY in QRPGLESRC in library MYCOPY >>
> D qcmdexc         PR                  EXTPGM('QCMDEXC')      
> D  cmd                       32702A   CONST OPTIONS(*VARSIZE)
> D  cmdlen                       15P 5 CONST                  
> << end of above source >>
> 
> The CONST will allow you to work with mismatched parameters 
> by automatically remapping them.
> For example
> << source member PGM in QRPGLESRC in library MYLIB >>
>  /COPY MYCOPY/QRPGLESRC,STDCOPY                               
>              
> D mycmd           C                   'OVRDBF INPUT 
> TOFILE(MYLIB/FTPSCRPT)'
> D CmdLen          S              3P 0 inz(35)                 
>              
> C                   callp     qcmdexc(mycmd:CmdLen)           
>              
>  * Notice that CmdLen is defined as 3,0 but it still works.
>  * We could skip the garbage of determining the size for CmdLen and 
>  * simply do the following:
> C                   callp     qcmdexc(mycmd:%len(%trim(mycmd)))
>  * Or even:
> C                   callp     qcmdexc('OVRDBF INPUT 
> TOFILE(MYLIB/FTPSCRPT)':
> C                                     %len(%trim('OVRDBF 
> INPUT TOFILE(MYLIB/FTPSCRPT)'
> C                                     )))
>  * We could also nest functions.  On this example I am leaving out
>  * the prototypes.
>  * DayOfW determines a numeric day of the week
>  * DayName takes this number and returns a name for this number.
> C                   eval      Text=DayName(DayOfW(datefield))
> 
> 
> 
> 
> 
> mwalter@netrax.net on 03/31/2000 10:40:42 AM
> Please respond to RPG400-L@midrange.com@Internet
> To:   rpg400-l@midrange.com@Internet
> cc:    
> Fax to:       
> Subject:      CALLB vs.CALLP
> 
> Is there an advantage of CALLP over CALLB when not returning a value?
> +---
> | This is the RPG/400 Mailing List!
> | To submit a new message, send your mail to RPG400-L@midrange.com.
> | To subscribe to this list send email to RPG400-L-SUB@midrange.com.
> | To unsubscribe from this list send email to 
> RPG400-L-UNSUB@midrange.com.
> | Questions should be directed to the list owner/operator: 
> david@midrange.com
> +---
> 
> 
> +---
> | This is the RPG/400 Mailing List!
> | To submit a new message, send your mail to RPG400-L@midrange.com.
> | To subscribe to this list send email to RPG400-L-SUB@midrange.com.
> | To unsubscribe from this list send email to 
> RPG400-L-UNSUB@midrange.com.
> | Questions should be directed to the list owner/operator: 
> david@midrange.com
> +---
> 
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-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.