Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.
Happy Friday everyone. I know there's been this discussion in the past, and I know IBM does a terrible job of insuring that parms are blank beyond, I think it is, 32 characters? I have a CL program where I am passing an email address parm that is 128 in length and I'm curious, what is the best way to handle it to insure that I don't have garbage in the parm after the actual email address?
I'm just curious how some of you handle this. Any ideas would be greatly appreciated!
Just did some searching on the web and found some possible solutions. Just in case any of you are interested, here's what I found:
Some solutions:
I pad the parm with blanks and add an 'x' at the very end, in your case in position 129 or greater.
Parms are passed by address. Your program gets that address and uses 128 characters. It doesn't care or know that we passed more characters at the end of the string. And since we padded with blanks, OS400 (IBM i?) won't put junk after position 32.
Chris Ringer
I write my own commands. The only time your issue is an issue is when you are calling the CL program from Command Entry. It does not apply for program-to-program calls. The Idea to use RQSDTA is probably not accurate. The CMD parameter simply permits you to enter a command, then it shifts that command string to the RQSDTA. So... perhaps they've modified it in the last 25 years and I missed that update.
Numerics are always passed as Packed(15,5) from a CALL placed on the command line to a program. However, again, variables specified in programs and passed are passed as is--without mapping them to 15,5.
I'm with Bob. Write your own commands. I didn't used to; used to pad with blanks and stuff, but the *CMD definitions are too easy not to use. Plus you gain the ability to pass numerics as the descired size, use integer parameters, date parameters, and so on.