× 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: R: COBOL and varying argument lists, etc.
  • From: Finucci Domenico <Domenico.Finucci@xxxxxxxxxxxx>
  • Date: Fri, 10 Nov 2000 13:09:20 +0100

Hi, Simon. At the moment I may answer first question only. 
Try this program:
** -------------------------------------------------------------------
  Identification Division.
  Program-Id. UArgc.
 * ------------------------------------------------------
 * Compile as CBLLE and run this way:  
*  Call Uargc
 * Call Uargc parm('1')
 * Call Uargc parm('1' '2')
 * ------------------------------------------------------
  Data Division.
  Working-Storage Section.
  01 Wp   usage  pointer.
  01 w-parametri-ok pic 9(3) value zero.
  Linkage Section.
  01  LParm01          Pic X(10).
  01  LParm02          Pic X(10).

  Procedure Division Using LParm01
                           LParm02
  UArgcMain.
   ****
           display ' start'
           Set Wp to address of LParm01
           If Wp not = Null
              add 1 to w-parametri-ok
           end-if

           Set Wp to address of LParm02
           If Wp not = Null
              add 1 to w-parametri-ok
           end-if

           If Wp is = Null
              display ' n. of parameters passed ' w-parametri-ok
           end-if
           display ' end  '
          GoBack.
** -------------------------------------------------------------------
Regards
Domenico Finucci
Fiditalia , Milano, 02- 4301-2494


-----Messaggio originale-----
Da: Simon Coulter [mailto:shc@flybynight.com.au]
Inviato: venerd́ 10 novembre 2000 08.33
A: COBOL400-L@midrange.com; Jon Paris
Oggetto: COBOL and varying argument lists, etc.



Hello,

I have spent a few hours with the manual and example code but haven't been
able to 
determine satisfactory answers.

Question 1.
Does COBOL support a mechanism to determine the number of parameters passed
in to the 
program or ILE procedure?  (Something like *PARMS or %PARMS in RPG IV)  I
know COBOL 
programs can be called with a varying argument list but how does the program
know how 
many parameters it received?  I expected a SPECIAL-NAME would be available
but can't find 
one.  Must I test the parameter comparing the ADDRESS OF to NULL?

Question 2.
I have an RPG procedure in a service program with the following interface:
D getDay          PR             5I 0                                    
D   aDate                         D   DATFMT(*ISO) CONST OPTIONS(*NOPASS)

I am invoking that procedure from COBOL using the following methods:
     call linkage procedure "GETDAY"                  
          returning day-nbr       

     call linkage procedure "GETDAY"      
          using a-date           
          returning day-nbr       

Both procedure calls are in the same program and the parameters are defined
thus:
01  a-date                  FORMAT DATE "@Y-%m-%d". 
01  day-nbr                 pic s9(04) binary.      

Would you expect both procedure calls to work assuming that the getDay
procedure 
functions correctly?

Question 3.
Would you expect the %PARMS value to be set correctly in getDay after each
of the above 
calls?  That is:
     call linkage procedure "GETDAY"                  
          returning day-nbr       

and %PARMS should be zero

     call linkage procedure "GETDAY"      
          using a-date           
          returning day-nbr       

and %PARMS should be one

Question 4.
Not strictly a COBOL question but it strikes me as useful to define the
above RPG 
prototype with both *NOPASS and *OMIT options.  The nett result is the same
but the 
caller can choose the call construct that suits them.  Comments?

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.                      «»
«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»
+---
| This is the COBOL/400 Mailing List!
| To submit a new message, send your mail to COBOL400-L@midrange.com.
| To subscribe to this list send email to COBOL400-L-SUB@midrange.com.
| To unsubscribe from this list send email to COBOL400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator:
david@midrange.com
+---END
+---
| This is the COBOL/400 Mailing List!
| To submit a new message, send your mail to COBOL400-L@midrange.com.
| To subscribe to this list send email to COBOL400-L-SUB@midrange.com.
| To unsubscribe from this list send email to COBOL400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---END


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.