MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Passing parameter values using PARM statement

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
SMS
Beginner


Joined: 16 Oct 2005
Posts: 53
Topics: 24

PostPosted: Mon Dec 10, 2007 6:32 pm    Post subject: Passing parameter values using PARM statement Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Mon Dec 10, 2007 7:26 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
CraigG
Intermediate


Joined: 02 May 2007
Posts: 202
Topics: 0
Location: Viginia, USA

PostPosted: Mon Dec 10, 2007 7:36 pm    Post subject: Reply with quote

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
View user's profile Send private message
jsharon1248
Intermediate


Joined: 08 Aug 2007
Posts: 291
Topics: 2
Location: Chicago

PostPosted: Tue Dec 11, 2007 9:25 am    Post subject: Reply with quote

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
View user's profile Send private message
SMS
Beginner


Joined: 16 Oct 2005
Posts: 53
Topics: 24

PostPosted: Tue Dec 11, 2007 6:41 pm    Post subject: Reply with quote

I have tried like the below one, it is working.
Code:

PARM ('SYSTEM  1                             0000TEST/')

Thanks,
SMS
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Wed Dec 12, 2007 4:39 am    Post subject: Reply with quote

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
View user's profile Send private message
SMS
Beginner


Joined: 16 Oct 2005
Posts: 53
Topics: 24

PostPosted: Wed Dec 12, 2007 7:54 am    Post subject: Reply with quote

Thanks dbzTHEdinosauer. I will try that
_________________
Regards,
SMS
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group