View previous topic :: View next topic |
Author |
Message |
SMS Beginner
Joined: 16 Oct 2005 Posts: 53 Topics: 24
|
Posted: Mon Dec 10, 2007 6:32 pm Post subject: Passing parameter values using PARM statement |
|
|
Hi,
I need to call a cobol-db2 program using 4 parameters.
I have coded the run control card and the linkage section as below.
The first value is moving to field L-IN1 correctly, but the remaining values are getting concatenated and moved to L-IN2. I am not sure what is wrong with this.
Any help would be appreciated.
Code: | DSN SYSTEM(DSN)
RUN PROGRAM(PROGRAM1) PLAN(PROGRAM1) -
PARM ('SYSTEM,1,0,TEST')
END |
Code: | 01 LINK-PARM.
05 L-PARM-LENGTH PIC S9(4) COMP.
05 L-IN1 PIC X(08).
05 L-IN2 PIC X(30).
05 L-OUT1 PIC 9(04).
05 L-OUT2 PIC X(200).
PROCEDURE DIVISION USING LINK-PARM. |
Regards,
SMS |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Mon Dec 10, 2007 7:26 pm Post subject: |
|
|
SMS,
I see 2 issues with your definition.
1. You canNOT pass more 100 characters via PARM
2. If your program is compiled with LE runtime modules, then you must use a slash('/') to separate the LE runtime parameters and program parameters. Thus, with LE, your PARM will look as follows:
Code: |
DSN SYSTEM(DSN)
RUN PROGRAM(PROGRAM1) PLAN(PROGRAM1) -
PARM ('SYSTEM,1,0,TEST/')
END
|
Hope this helps...
Cheers _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
CraigG Intermediate
Joined: 02 May 2007 Posts: 202 Topics: 0 Location: Viginia, USA
|
Posted: Mon Dec 10, 2007 7:36 pm Post subject: |
|
|
kolusu wrote: | SMS,
I see 2 issues with your definition.
1. You canNOT pass more 100 characters via PARM
2. If your program is compiled with LE runtime modules, then you must use a slash('/') to separate the LE runtime parameters and program parameters. Thus, with LE, your PARM will look as follows:
Code: |
DSN SYSTEM(DSN)
RUN PROGRAM(PROGRAM1) PLAN(PROGRAM1) -
PARM ('SYSTEM,1,0,TEST/')
END
|
Hope this helps...
Cheers | And you must pass the parameters in the same format and length as they are defined in the linkage section.Leading zeros, leading and/or trailing spaces, and no separators. I think the '/' is needed only if there are LE RUNTIME parameters. |
|
Back to top |
|
|
jsharon1248 Intermediate
Joined: 08 Aug 2007 Posts: 291 Topics: 2 Location: Chicago
|
Posted: Tue Dec 11, 2007 9:25 am Post subject: |
|
|
COBOL will not treat the comma's as delimiters; they will be treated as part of the parm values. Are you certain that the first value is being passed as you expect? Here's what I would expect to see based on your LS definition:
Code: |
01 LINK-PARM.
05 L-PARM-LENGTH PIC S9(4) COMP. 15
05 L-IN1 PIC X(08). 'SYSTEM,1'
05 L-IN2 PIC X(30). ',0,TEST'
05 L-OUT1 PIC 9(04).
05 L-OUT2 PIC X(200).
|
Here's how you would need to pass the parm values based on your definition:
Code: |
PARM ('SYSTEM 1 0000TEST/')
|
I've forgotten all the rules about LE parms, but as kolusu and CraigG pointed out, you'll need to be aware of the rules. Look at Chapter 11 in the OS/390 V2R10.0 Language Environment for OS/390 & VM Programming Guide:
http://www-03.ibm.com/servers/s390/os390/bkserv/r10pdf/le.html |
|
Back to top |
|
|
SMS Beginner
Joined: 16 Oct 2005 Posts: 53 Topics: 24
|
Posted: Tue Dec 11, 2007 6:41 pm Post subject: |
|
|
I have tried like the below one, it is working.
Code: |
PARM ('SYSTEM 1 0000TEST/')
|
Thanks,
SMS |
|
Back to top |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Wed Dec 12, 2007 4:39 am Post subject: |
|
|
This format
Quote: |
PARM ('SYSTEM,1,0,TEST/'
|
requires that you do an UNSTRING DELIMITED BY COMMA.
Using the commas to delimit the fields would be easier than constructing a parm card as you have here:
Code: |
PARM ('SYSTEM 1 0000TEST/')
|
the above format is difficult to modify parm values. _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
|
SMS Beginner
Joined: 16 Oct 2005 Posts: 53 Topics: 24
|
Posted: Wed Dec 12, 2007 7:54 am Post subject: |
|
|
Thanks dbzTHEdinosauer. I will try that _________________ Regards,
SMS |
|
Back to top |
|
|
|
|