× 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: CL enhancements
  • From: "Simon Coulter" <shc@xxxxxxxxxxxxxxxxx>
  • Date: Tue, 24 Feb 98 00:08:56 +1100

//--- forwarded letter -------------------------------------------------------
> Date: Sat, 21 Feb 98 23:53:40 -0500
> From: "John Carr" <74711.77@compuserve.com>
> To: "Midrange-L" <MIDRANGE-L@midrange.com>
> Reply-To: MIDRANGE-L@midrange.com
> Subject: Re: CL enhancements

> 
> Never defining numeric fields(invoice #, Customer#, etc) as alpha 
> because numerics are a pain as parms in CL !!!
> (Note: defining the numerics in the file as zoned makes this work)
> 
> Just my opinion
> John Carr


I was quite content to let this topic be hashed out amongst you but this 
comment I cannot let pass.  
Passing numeric parameters in CL is NO MORE DIFFICULT than any other AS/400 
language.  I NEVER 
define numeric parameters as character because it simply is not necessary.  The 
only time you may 
have a difficulty is when passing numeric literals because the CALL command 
assumes a 15,5 
representation for these numeric data.  Passing numeric variables between 
programs is 
straight-forward.

All parameters on the AS/400 are passed by address.  If you try to call a CL 
passing 1234 the 
command analyser converts the parameter value to 0000001234.00000 and passes 
the address of this 
value to the CL.  If the CL defines the receiving variable as anything other 
than a 15,5 numeric 
variable you will create a parameter mismatch.  Lets say the receiver is 5,0 
what will it contain?  
Since they are both addresses you get the first 5 digits from the 15,5 value, 
that is 00000.  You 
also lose the sign -- awkward ==> probable decimal data error

So the solution is to understand this situation and when passing numeric 
literals do the following:
        CALL PGMA PARM(X'01234F')
or 
        CALL PGMA PARM(X'01234D') if you need negative numbers

That wasn't so hard was it?  Defining numeric parameters as character is as 
much a cop out as always 
defining them to be 15,5.  How often do CL programs get passed literals anyway? 
 They are mostly 
invoked from a menu, or a command, or the CL puts up a display file to request 
'parameters'.

Regards,
Simon Coulter.

//----------------------------------------------------------
// FlyByNight Software         AS/400 Technical Specialists
// Phone: +61 3 9419 0175      Mobile: +61 3 0411 091 400
// Fax:   +61 3 9419 0175      E-mail: shc@flybynight.com.au
// 
// Windoze should not be open at Warp speed.
 

+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to "MIDRANGE-L@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.