View previous topic :: View next topic
|
Author |
Message |
herewego
New User
Joined: 20 Feb 2006 Posts: 14
|
|
|
|
A) You are passing parm value ?ABCDE? to cobol programme through JCL. What will happen if you declare in linkage section 1) picx(5)
2)pic x(6)
3)pic x(4)
B) In cobol programme A you are calling Programe B using ws-va1,ws-va2,ws-va3.
1) what will happen if you call B using ws-va1,ws-va2 not using ws-va3.
2) what will happen in programme B
you have written procedure division using ws-va1,ws-va2 not using ws-va3 |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
Quote: |
A) You are passing parm value ?ABCDE? to cobol programme through JCL. What will happen if you declare in linkage section 1) picx(5)
2)pic x(6)
3)pic x(4)
|
First, your definition in linkage needs to include a length as PIC S9(4) COMP.
i.e.
01 JCL-PARM.
05 PARM-LEN PIC S9(4) COMP.
05 PARM-STRING PIC X(??).
Second, the definition in LINKAGE section does not allocate storage; it only defines the storage that is passed to you. So in your example, regardless of how you have the storage defined, the storage will contain:
01 JCL-PARM.
05 PARM-LEN PIC S9(4) COMP VALUE 5.
05 PARM-STRING PIC X(??) VALUE ?ABCDE?.
Whenever you process the PARM, you need to interrogate the PARM-LEN to see how long the PARM-STING is. If the PARM-LEM = 0, no parm exists.
So, the PIC X(5) = ?ABCDE?
PIC X(6) = ?ABCDE.? The ?.? Is an undefined value, usually binary zeros
PIC X(4) = ?ABCD?
Dave |
|
Back to top |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
Hi !
You always have to take care, that the structure in the Linkage corresponds to the receiving Parameters. Also take care of the LengthField, as DavidK told you before.
Regards, UmeySan |
|
Back to top |
|
|
herewego
New User
Joined: 20 Feb 2006 Posts: 14
|
|
|
|
Dave,
Thanks for the reply.
I know that passing parameter is 'ABCDE' of lengh 5. So I don't understand why do we need to allocate PARM-LEN as S9(4) COMP.
Thanks,
Herewego |
|
Back to top |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
Hi !
You allways have to declare the PARM-LEN as S9(4) COMP, because this
field is used and insertet by system mechanisem automaticaly before the
real parameters.
regards, UmeySan |
|
Back to top |
|
|
vijay_bn79
New User
Joined: 20 Nov 2006 Posts: 48 Location: Hyderabad
|
|
|
|
S9(4) Comp takes 2 bytes
in linkage section expects 2 bytes of length variable
so we should give S9(4) comp in linkage section |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Hi HWG,
The len field is used to verify that the field is the len you expected. You would check that as you would the content if the field is to be alpha or numeric for example.
It's not a good idea to assume. |
|
Back to top |
|
|
|