View previous topic :: View next topic
|
Author |
Message |
rakeshvp3 Currently Banned New User
Joined: 19 May 2008 Posts: 2 Location: bangalore
|
|
|
|
Hi
Please help me
1. what will happen if we didnt decalre the length variable in Linkage section for passing a value from a jcl to cobol through Parm parameter?
2.What is the advantage of declaring Length parameter as S9(4) COMP, why it is 9(4)?
3.In a calling program
W-S section.
01 A Pic X(4).
01 B PIC 9(4).
PD.
Call 'subpgm' using A,B
subpgm.
Linkage section.
01 A PIC 9(4).
01 B PIC 9(4).
Procedure division using A,B
what will happen in this case ?
3. Calling program
W-S section.
01 A Pic X(4).
01 B PIC 9(4).
01 C PIC 9(4).
PD
call 'subpgm' using A,B,C.
Subpgm
Linkage section.
01 A PIC 9(4).
01 B PIC 9(4).
Procedure division using A,B.
will it create any error message or not?
4.Calling program
W-S section.
01 A Pic X(4).
01 B PIC 9(4).
PD
call 'subpgm' using A,B.
Subpgm
Linkage section.
01 A PIC 9(4).
01 B PIC 9(4).
01 C PIC 9(4)
Procedure division using A,B,C.
will execute sucessfully? |
|
Back to top |
|
|
the_gautam
Active User
Joined: 05 Jun 2005 Posts: 165 Location: Bangalore
|
|
|
|
If you dont declare the length variable in the linkage section, you may loose the first 2 bytes of data that you are passing through JCL as the program assumes the first 2 bytes to be the length of the data.
In the first program you are receiving all the variables that are passed through the main program. so, no problem.
In the second program you are not receiving all the variables that are passed through the main program. so, the data in C will be lost.
In the last program you are passing only two variables and receiving three variables. the last variable will carry junk data.
note : in the second and third case, you may get the errors S0C4 and S0C7 depending upon the use of the variable C. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
2.What is the advantage of declaring Length parameter as S9(4) COMP, why it is 9(4)? |
The advantage is that is the way it works. It is 9(4) (and don't forget the COMP) because that is the way it is designed. This not something a programmer chooses - it is pre-defined. |
|
Back to top |
|
|
|