IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

what will happen if we didnt decalre the length in Linkage


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rakeshvp3
Currently Banned

New User


Joined: 19 May 2008
Posts: 2
Location: bangalore

PostPosted: Thu May 22, 2008 10:33 am
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
the_gautam

Active User


Joined: 05 Jun 2005
Posts: 165
Location: Bangalore

PostPosted: Thu May 22, 2008 10:54 am
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
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu May 22, 2008 10:50 pm
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
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts Store the data for fixed length COBOL Programming 1
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
Search our Forums:

Back to Top