Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
what will happen if we didnt decalre the length in Linkage

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Interview Questions
Author Message
rakeshvp3
Currently Banned

New User


Joined: 19 May 2008
Posts: 2
Location: bangalore

PostPosted: Thu May 22, 2008 10:33 am    Post subject: what will happen if we didnt decalre the length in Linkage
Reply with quote

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

Active User


Joined: 05 Jun 2005
Posts: 168
Location: Bangalore

PostPosted: Thu May 22, 2008 10:54 am    Post subject:
Reply with quote


    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
View user's profile Send private message
Moved: Thu May 22, 2008 1:48 pm by William Thompson From Mainframe COBOL to Interview Questions
dick scherrer

Global Moderator


Joined: 23 Nov 2006
Posts: 8756
Location: 221 B Baker St

PostPosted: Thu May 22, 2008 10:50 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Interview Questions All times are GMT + 6 Hours
Page 1 of 1