View previous topic :: View next topic
|
Author |
Message |
Ambili S
Active User
Joined: 06 Sep 2007 Posts: 112 Location: India
|
|
|
|
When data is passed to a cobol program using PARM in JCL , then the linkage section of the cobol pgm has the following.
01 PARM-DETAILS.
49 parm-length pic s9(4) comp.
49 parm-text pix x(3).
PROCEDURE DIVISION USING PARM-DETAILS.
My question is how does parm-length get the value because is JCL it's
step1 exec pgm=pgm1,parm='abc'
Thanks |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
1. even though it is legal, I would not use lvl-49 for anything accept db2 varchar host variables.
it is for others reading the code, and has nothing to do with whether it works or not.
2. the acceptable characters following the 'parm=' are counted by jes and the count is placed in the S9(4) comp field preceding the actual parm text.
I make it a habit of defining my parms as follows:
Code: |
LINKAGE SECTION.
01 PARM-AREA.
05 PARM-LENGTH PIC S9(4) COMP.
88 EXPECTED-LENGTH VALUE 3.
05 PARM-INPUT PIC X(100).
05 EXPECTED-INPUT
REDEFINES
PARM-INPUT.
10 PARM-TEXT PIC X(03).
10 FILLER PIC X(97).
PROCEDURE DIVISION USING PARM-AREA.
IF EXPECTED-LENGTH
THEN
...use PARM-TEXT
ELSE
DISPLAY 'OTHER THAN EXPECTED PARM LENGTH ECEIVED: '
PARM-LENGTH
' '
PARM-INPUT
GOBACK
END-IF
|
|
|
Back to top |
|
|
Ambili S
Active User
Joined: 06 Sep 2007 Posts: 112 Location: India
|
|
|
|
Thanks for the explanation . It was really helpful. |
|
Back to top |
|
|
|