Use the DMPCLPGM command to determine the actual value of the variable. Dave
Unconfigured Ad Widget
Collapse
Announcement
Collapse
No announcement yet.
Passing parameters to CL
Collapse
X
-
Passing parameters to CL
ami_as400 wrote: > > Hi, > While calling a CL program from a RPG programe using a prototype, I am passing a variable. I need to use this variable in a cl command. eg passing the file name 'TEST' from RPG to CL. But when this is used in the cl command it gives an error. I think it is because the file name is considered as the entire string 'TEST'. But I am not sure. How to resolve this and use the variables to CL pgm in some commands within the CL pgm. > Just guessing a bit here about what you are passing and what you are coding in the CL ... If you are passing a value like 'MYLIB/TEST', you won't be able to use say FILE(&filename) in any command parameter that would allow say FILE(MYLIB/TEST). You have to split it back up into two separate variables &LIB and &FILE, and code FILE(&lib/&test). If you have separate variables &LIB and &FILE, and sometimes &LIB is blank, you can't code FILE(&lib/&file). You have to code something like this: if (&lib = ' ') then(do) somecommand FILE(&file) enddo else do somecommand FILE(&lib/&file) enddo
-
Passing parameters to CL
Barbara Morris wrote: > ami_as400 wrote: >> Hi, >> While calling a CL program from a RPG programe using a prototype, I am passing a variable. I need to use this variable in a cl command. eg passing the file name 'TEST' from RPG to CL. But when this is used in the cl command it gives an error. I think it is because the file name is considered as the entire string 'TEST'. But I am not sure. How to resolve this and use the variables to CL pgm in some commands within the CL pgm. >> > > Just guessing a bit here about what you are passing and what you are > coding in the CL ... > > If you are passing a value like 'MYLIB/TEST', you won't be able to use > say FILE(&filename) in any command parameter that would allow say > FILE(MYLIB/TEST). You have to split it back up into two separate > variables &LIB and &FILE, and code FILE(&lib/&test). > > If you have separate variables &LIB and &FILE, and sometimes &LIB is > blank, you can't code FILE(&lib/&file). You have to code something like > this: > > if (&lib = ' ') then(do) > somecommand FILE(&file) > enddo > else do > somecommand FILE(&lib/&file) > enddo Or set &lib to *LIBL, like this: if (&lib = ' ') then(do) chgvar &lib '*LIBL' enddo somecommand FILE(&lib/&file) -- -- Jeff Crosby Dilgard Frozen Foods, Inc. P.O. Box 13369 Ft. Wayne, IN 46868-3369 260-422-7531 The opinions expressed are my own and not necessarily the opinion of my company. Unless I say so.
Comment
-
Passing parameters to CL
Hi, While calling a CL program from a RPG programe using a prototype, I am passing a variable. I need to use this variable in a cl command. eg passing the file name 'TEST' from RPG to CL. But when this is used in the cl command it gives an error. I think it is because the file name is considered as the entire string 'TEST'. But I am not sure. How to resolve this and use the variables to CL pgm in some commands within the CL pgm. Please advise. Regds,
Comment
-
Passing parameters to CL
Dont bother using &libl, with due respect to comrades. Let the system default to the library list. Just pass the parameter-value in the call to QCMDEXEC and check it thorough. Use STRISDBG to debug the CL and the program. Use step-into if CL is interactive call. Otherwise, put the CL on debug mode, put job queue on-hold, run your program, start service job on the job-queue job and debug your job. Check the log report to see the variable content. You may need to strip the file name of blanks to get it the way the system likes it.
Comment
-
Passing parameters to CL
Jeff Crosby wrote: > > Or set &lib to *LIBL, like this: > > if (&lib = ' ') then(do) > chgvar &lib '*LIBL' > enddo > > somecommand FILE(&lib/&file) > That would indeed be a good way to handle it, especially if the somecommand had any more parameters; the way I had it would require too much duplication.
Comment
Comment