This is of course for a COBOL BATCH MAIN program.
-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf
Of Roberts, John J
Sent: Wednesday, October 02, 2013 11:43 AM
To: [email protected]
Subject: Re: Determining number of Parameters passed to a COBOL program
"Is there a way to determine how many parameters are being passed into a
COBOL program?"
It all depends on the convention you employ for passing parameters. The most
common is to pass the PARM string as a comma delimited string. So in the
simplest form, the number of parameters is the number of commas plus one.
In the example" //S1 EXEC PGM=P1,PARM='ABC,12345,X87,,55' "you have five
parameters, one of which is the null string.
Typically you use the COBOL UNSTRING statement to parse the PARM string looking
for delimiters.
The PARM string is typically declared like this:
LINKAGE SECTION.
01 LS-PARM.
05 LS-PARM-LEN PIC S9(4) COMP.
05 LS-PARM-TXT PIC X(100).
PROCEDURE DIVISION USING LS-PARM.
John
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions, send email to
[email protected] with the message: INFO IBM-MAIN
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN