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




Hey guys and gals

Here a jeopardy question for most AS/400 programmers,  
Whats the default length for Numeric parms in CL?,  
Whats the Default Alpha length?

We all know about the 15,5 numerics because we've been killed many times
defining 3,0 or 7,0 etc. numeric parms and either decided to always use
15,5 or use alpha and pretend it was numeric.  (How many date or invoice 
number parms have YOU defined as alpha just so it would work?  
Hey, How do you call that program with numeric parms from the command line
again?  Heck, never mind I'll just define it as Alpha its simpler.)

The answer to these questions are defined in the 1st or 2nd chapter of the 
CL reference manual since around 1978.  The rational is very simple
and straight forward(I taught the COMMON University CLP class for
a couple of years and this subject tripped up even veteran 400 programmers
alot)

The default length for Alpha parms is 32 (ta da)  

If ProgramA defines a variable as 10 bytes alpha and passes to 
ProgramB, and programB defines it as 20,  What will happen?
NOTHING,   because if the length is UNDER 32 the system always pads
the rest with blanks. HOWEVER if you define past the magic 32 byte
boundary,  its every man for himself.  

If programA defines a parm as 40 and ProgramB defines it as 50 
well, the programmer will have a learning experience.
(by the way "Experience is like a hard teacher, She gives the test 
first, and Then the lession") 

Have you ever passed (say) a 200 byte data structure from one RPG
program to another and in the called program define it as 300?  
You in essence stomp over the working storage of the calling program 
(I've seen many a programmer spend days tracking down that problem)

>>>> Can anybody explain me what is the purpose of defining it for
>>>> a maximum length of 32? Thanx in advance for any help / suggestions.
>>>> Regards,
>>>> VenuGopal

AAAAnyway, thats the reason for the "magic 32" number Venu.


John P. Carr CDP
EdgeTech Inc.

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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 MAJORDOMO@midrange.com and specify            *
* 'unsubscribe MIDRANGE-L' in the body of your message.  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.